Skip to content

Commit

Permalink
Removes additional fetching from git
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix "xq" Queißner committed Feb 16, 2024
1 parent 20012c1 commit a5655b3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
with:
fetch-tags: true # required for "git describe"

- 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: 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
uses: goto-bus-stop/setup-zig@v2
Expand Down Expand Up @@ -54,12 +54,12 @@ jobs:
with:
fetch-tags: true # required for "git describe"

- 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: 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
uses: goto-bus-stop/setup-zig@v2
Expand Down
7 changes: 6 additions & 1 deletion tools/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,12 @@ def build_zig_tools():
# Determines the correct version:
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)
if raw_git_out is not None:
raw_git_out = raw_git_out.strip().decode()
else:
print("failed to get version from git, using 'development'", file=sys.stderr)
return "development"

def render_version(major,minor,patch,counter,hash):
return f"{major}.{minor}.{patch}-{counter}-{hash}"
Expand Down
4 changes: 2 additions & 2 deletions tools/lib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

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]
if VERBOSE:
print(*args)
res = subprocess.run(args, **kwargs, check=False)
if res.stderr is not None and (not hide_stderr or res.returncode != 0):
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.exit(res.returncode)
return res
Expand Down

0 comments on commit a5655b3

Please sign in to comment.