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 <git@random-projects.net>
wch-ch32v003
Felix Queißner 7 months ago committed by GitHub
parent 829f860b8c
commit 196bbd8094
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -19,13 +19,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-tags: true # required for "git describe" fetch-tags: true # required for "git describe"
fetch-depth: 0
- name: Fetch more data from git
run: |
# fetch everything back till the $(ZIG_VERSION) tag.
# https://stackoverflow.com/a/58082274
git fetch --shallow-exclude ${{ env.ZIG_VERSION }}
git fetch --deepen=2
- name: Setup Zig - name: Setup Zig
uses: goto-bus-stop/setup-zig@v2 uses: goto-bus-stop/setup-zig@v2
@ -34,7 +28,7 @@ jobs:
- name: Install PIP packages - name: Install PIP packages
run: | run: |
pip install dataclasses_json==0.6.3 marshmallow typing-inspect semver pathspec pip install -r tools/requirements.txt
- name: Generate and validate packages - name: Generate and validate packages
run: | run: |
@ -53,13 +47,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-tags: true # required for "git describe" fetch-tags: true # required for "git describe"
fetch-depth: 0
- name: Fetch more data from git
run: |
# fetch everything back till the $(ZIG_VERSION) tag.
# https://stackoverflow.com/a/58082274
git fetch --shallow-exclude ${{ env.ZIG_VERSION }}
git fetch --deepen=2
- name: Setup Zig - name: Setup Zig
uses: goto-bus-stop/setup-zig@v2 uses: goto-bus-stop/setup-zig@v2
@ -68,7 +56,7 @@ jobs:
- name: Install PIP packages - name: Install PIP packages
run: | run: |
pip install dataclasses_json==0.6.3 marshmallow typing-inspect semver pathspec pip install -r tools/requirements.txt
- name: Generate packages - name: Generate packages
run: | run: |

@ -16,13 +16,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-tags: true # required for "git describe" fetch-tags: true # required for "git describe"
fetch-depth: 0
- name: Fetch more data from git
run: |
# fetch everything back till the $(ZIG_VERSION) tag.
# https://stackoverflow.com/a/58082274
git fetch --shallow-exclude ${{ env.ZIG_VERSION }}
git fetch --deepen=2
- name: Setup Zig - name: Setup Zig
uses: goto-bus-stop/setup-zig@v2 uses: goto-bus-stop/setup-zig@v2
@ -31,7 +25,7 @@ jobs:
- name: Install PIP packages - name: Install PIP packages
run: | run: |
pip install dataclasses_json==0.6.3 marshmallow typing-inspect semver pathspec pip install -r tools/requirements.txt
- name: Generate and validate packages - name: Generate and validate packages
run: | run: |

@ -2,7 +2,7 @@
[![Chat](https://img.shields.io/discord/824493524413710336.svg?logo=discord)](link=https://discord.gg/ShUWykk38X) [![Chat](https://img.shields.io/discord/824493524413710336.svg?logo=discord)](link=https://discord.gg/ShUWykk38X)
[![Downloads](https://img.shields.io/badge/Zig_Package-Download-blue)](https://downloads.microzig.tech/) [![Downloads](https://img.shields.io/badge/Zig_Package-Download-blue)](https://downloads.microzig.tech/)
[![Continuous Integration](https://github.com/ZigEmbeddedGroup/microzig-monorepo/actions/workflows/build.yml/badge.svg)](https://github.com/ZigEmbeddedGroup/microzig-monorepo/actions/workflows/build.yml) [![Continuous Integration](https://github.com/ZigEmbeddedGroup/microzig/actions/workflows/build.yml/badge.svg)](https://github.com/ZigEmbeddedGroup/microzig/actions/workflows/build.yml)
> **NOTE:** This is in development; breaks in the API are bound to happen. > **NOTE:** This is in development; breaks in the API are bound to happen.

@ -38,6 +38,7 @@ REQUIRED_TOOLS = [
"zig", "zig",
"git", "git",
] ]
REQUIRED_ZIG_VERSION="0.11.0"
REPO_ROOT = Path(__file__).parent.parent REPO_ROOT = Path(__file__).parent.parent
@ -168,7 +169,10 @@ def build_zig_tools():
# Determines the correct version: # Determines the correct version:
def get_version_from_git() -> str: def get_version_from_git() -> str:
raw_git_out = slurp("git", "describe", "--match", "*.*.*", "--tags", "--abbrev=9", cwd=REPO_ROOT).strip().decode() raw_git_out = slurp("git", "describe", "--match", "*.*.*", "--tags", "--abbrev=9", cwd=REPO_ROOT, allow_failure=True).strip().decode()
if len(raw_git_out) == 0:
print("failed to get version from git, using 'development'", file=sys.stderr)
return f"{REQUIRED_ZIG_VERSION}-development"
def render_version(major,minor,patch,counter,hash): def render_version(major,minor,patch,counter,hash):
return f"{major}.{minor}.{patch}-{counter}-{hash}" return f"{major}.{minor}.{patch}-{counter}-{hash}"
@ -251,7 +255,7 @@ def main():
check_required_tools(REQUIRED_TOOLS) check_required_tools(REQUIRED_TOOLS)
check_zig_version("0.11.0") check_zig_version(REQUIRED_ZIG_VERSION)
print("preparing environment...") print("preparing environment...")

@ -3,14 +3,14 @@ import subprocess, sys
VERBOSE = False VERBOSE = False
def execute_raw(*args,hide_stderr = False,**kwargs): def execute_raw(*args,hide_stderr: bool = False, allow_failure: bool = False, **kwargs):
args = [ str(f) for f in args] args = [ str(f) for f in args]
if VERBOSE: if VERBOSE:
print(*args) print(*args)
res = subprocess.run(args, **kwargs, check=False) res = subprocess.run(args, **kwargs, check=False)
if res.stderr is not None and (not hide_stderr or res.returncode != 0): if res.stderr is not None and (not hide_stderr or res.returncode != 0):
sys.stderr.buffer.write(res.stderr) sys.stderr.buffer.write(res.stderr)
if res.returncode != 0: if not allow_failure and res.returncode != 0:
sys.stderr.write(f"command {' '.join(args)} failed with exit code {res.returncode}") sys.stderr.write(f"command {' '.join(args)} failed with exit code {res.returncode}")
sys.exit(res.returncode) sys.exit(res.returncode)
return res return res

@ -0,0 +1,5 @@
dataclasses_json==0.6.3
marshmallow
typing-inspect
semver
pathspec
Loading…
Cancel
Save