Skip to content

Commit 196bbd8

Browse files
ikskuhFelix "xq" Queißner
and
Felix "xq" Queißner
authored
Fixes CI Badge in README.md (#164)
* Fixes CI Badge in README.md * Removes additional fetching from git * More work on the CI script * Adds requirements.txt for tools, fixes CI script even more --------- Co-authored-by: Felix "xq" Queißner <[email protected]>
1 parent 829f860 commit 196bbd8

File tree

6 files changed

+20
-29
lines changed

6 files changed

+20
-29
lines changed

.github/workflows/build.yml

+4-16
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ jobs:
1919
uses: actions/checkout@v4
2020
with:
2121
fetch-tags: true # required for "git describe"
22-
23-
- name: Fetch more data from git
24-
run: |
25-
# fetch everything back till the $(ZIG_VERSION) tag.
26-
# https://stackoverflow.com/a/58082274
27-
git fetch --shallow-exclude ${{ env.ZIG_VERSION }}
28-
git fetch --deepen=2
22+
fetch-depth: 0
2923

3024
- name: Setup Zig
3125
uses: goto-bus-stop/setup-zig@v2
@@ -34,7 +28,7 @@ jobs:
3428

3529
- name: Install PIP packages
3630
run: |
37-
pip install dataclasses_json==0.6.3 marshmallow typing-inspect semver pathspec
31+
pip install -r tools/requirements.txt
3832
3933
- name: Generate and validate packages
4034
run: |
@@ -53,13 +47,7 @@ jobs:
5347
uses: actions/checkout@v4
5448
with:
5549
fetch-tags: true # required for "git describe"
56-
57-
- name: Fetch more data from git
58-
run: |
59-
# fetch everything back till the $(ZIG_VERSION) tag.
60-
# https://stackoverflow.com/a/58082274
61-
git fetch --shallow-exclude ${{ env.ZIG_VERSION }}
62-
git fetch --deepen=2
50+
fetch-depth: 0
6351

6452
- name: Setup Zig
6553
uses: goto-bus-stop/setup-zig@v2
@@ -68,7 +56,7 @@ jobs:
6856

6957
- name: Install PIP packages
7058
run: |
71-
pip install dataclasses_json==0.6.3 marshmallow typing-inspect semver pathspec
59+
pip install -r tools/requirements.txt
7260
7361
- name: Generate packages
7462
run: |

.github/workflows/deploy.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ jobs:
1616
uses: actions/checkout@v4
1717
with:
1818
fetch-tags: true # required for "git describe"
19-
20-
- name: Fetch more data from git
21-
run: |
22-
# fetch everything back till the $(ZIG_VERSION) tag.
23-
# https://stackoverflow.com/a/58082274
24-
git fetch --shallow-exclude ${{ env.ZIG_VERSION }}
25-
git fetch --deepen=2
19+
fetch-depth: 0
2620

2721
- name: Setup Zig
2822
uses: goto-bus-stop/setup-zig@v2
@@ -31,7 +25,7 @@ jobs:
3125

3226
- name: Install PIP packages
3327
run: |
34-
pip install dataclasses_json==0.6.3 marshmallow typing-inspect semver pathspec
28+
pip install -r tools/requirements.txt
3529
3630
- name: Generate and validate packages
3731
run: |

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Chat](https://img.shields.io/discord/824493524413710336.svg?logo=discord)](link=https://discord.gg/ShUWykk38X)
44
[![Downloads](https://img.shields.io/badge/Zig_Package-Download-blue)](https://downloads.microzig.tech/)
5-
[![Continuous Integration](https://github.com/ZigEmbeddedGroup/microzig-monorepo/actions/workflows/build.yml/badge.svg)](https://github.com/ZigEmbeddedGroup/microzig-monorepo/actions/workflows/build.yml)
5+
[![Continuous Integration](https://github.com/ZigEmbeddedGroup/microzig/actions/workflows/build.yml/badge.svg)](https://github.com/ZigEmbeddedGroup/microzig/actions/workflows/build.yml)
66

77
> **NOTE:** This is in development; breaks in the API are bound to happen.
88

tools/bundle.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"zig",
3939
"git",
4040
]
41+
REQUIRED_ZIG_VERSION="0.11.0"
4142

4243

4344
REPO_ROOT = Path(__file__).parent.parent
@@ -168,7 +169,10 @@ def build_zig_tools():
168169
# Determines the correct version:
169170
def get_version_from_git() -> str:
170171

171-
raw_git_out = slurp("git", "describe", "--match", "*.*.*", "--tags", "--abbrev=9", cwd=REPO_ROOT).strip().decode()
172+
raw_git_out = slurp("git", "describe", "--match", "*.*.*", "--tags", "--abbrev=9", cwd=REPO_ROOT, allow_failure=True).strip().decode()
173+
if len(raw_git_out) == 0:
174+
print("failed to get version from git, using 'development'", file=sys.stderr)
175+
return f"{REQUIRED_ZIG_VERSION}-development"
172176

173177
def render_version(major,minor,patch,counter,hash):
174178
return f"{major}.{minor}.{patch}-{counter}-{hash}"
@@ -251,7 +255,7 @@ def main():
251255

252256
check_required_tools(REQUIRED_TOOLS)
253257

254-
check_zig_version("0.11.0")
258+
check_zig_version(REQUIRED_ZIG_VERSION)
255259

256260
print("preparing environment...")
257261

tools/lib/common.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
VERBOSE = False
55

6-
def execute_raw(*args,hide_stderr = False,**kwargs):
6+
def execute_raw(*args,hide_stderr: bool = False, allow_failure: bool = False, **kwargs):
77
args = [ str(f) for f in args]
88
if VERBOSE:
99
print(*args)
1010
res = subprocess.run(args, **kwargs, check=False)
1111
if res.stderr is not None and (not hide_stderr or res.returncode != 0):
1212
sys.stderr.buffer.write(res.stderr)
13-
if res.returncode != 0:
13+
if not allow_failure and res.returncode != 0:
1414
sys.stderr.write(f"command {' '.join(args)} failed with exit code {res.returncode}")
1515
sys.exit(res.returncode)
1616
return res

tools/requirements.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dataclasses_json==0.6.3
2+
marshmallow
3+
typing-inspect
4+
semver
5+
pathspec

0 commit comments

Comments
 (0)