Skip to content

Commit

Permalink
.github/zephyr: simplify and fix the git describe performance hack
Browse files Browse the repository at this point in the history
Fixes the git describe/tag performance hack added in
commit 2328478 (".github/zephyr.yml: fix tags missing from `git -C
zephyr/ describe`") which worked for an amazingly long time (1.5 year)
but apparently ran its course. Git version 2.48 apparently does not like
it anymore. Replace it with something slower but simpler and safer.

Should fix build reproducibility issue #9797, much more details there.

Also fixes commit 4bc6488 (".github/zephyr: de-hardcode the name of
the zephyr remote")

Signed-off-by: Marc Herbert <[email protected]>
  • Loading branch information
marc-hb committed Jan 28, 2025
1 parent 503ae3e commit d087842
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions .github/workflows/zephyr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,19 @@ jobs:
# does not use --tags.
#
# 2. west fetches using the remote URL, not the remote name. So remote
# branches (if any) are missing from --decorate below
#
# => an "empty" and quick fetch _with_ a refspec and the remote name fixes
# both issues in no time.
# branches are missing from --decorate below. Cosmetic but annoying;
# especially in the "zmain" case.
cd zephyr
time git fetch --filter=tree:0 "$(git remote |head -n1)" "$rem_rev":_branch_placeholder
git branch -D _branch_placeholder
set -x
# Fix problem 2. Do NOT assume anything about remote names: nothing is guaranteed.
_zurl=$(west list -f '{url}' zephyr)
git remote add sof_zep_rem "$_zurl"
time git fetch sof_zep_rem "$rem_rev"
# Fix problem 1. Indirectly fetches useless branches but should be quick enough
# thanks to the --filter
time git fetch --tags --all
west list
west status
git log --oneline -n 5 --decorate --graph --no-abbrev-commit
Expand Down Expand Up @@ -327,12 +330,23 @@ jobs:
west init -l sof
west update --narrow --fetch-opt=--filter=tree:0
# Get some tags to fix `git describe`, see build-linux comments above.
cd zephyr
# Get some tags to fix `git describe` etc., see detailed build-linux comments above.
- name: Fetch tags for git describe
working-directory: ${{ github.workspace }}/workspace/zephyr
# Keep in sync with build-linux above
run: |
Set-PSDebug -Trace 2
$_rev = "$(git rev-parse HEAD)"
git fetch --filter=tree:0 "$(west list -f '{url}' zephyr)" "${_rev}:_branch_placeholder"
git branch -D _branch_placeholder
$_zurl = "$(west list -f '{url}' zephyr)"
git remote add sof_zep_rem "${_zurl}"
# Unlike Linux above, hardcode "main" for now. Will make no difference most
# of the time but keeps this bit consistent with Linux, tested and ready to use.
git fetch sof_zep_rem main
git fetch --tags --all
west list
west status
git log --oneline -n 5 --decorate --graph --no-abbrev-commit
# Call Setup Python again to save the PIP packages in cache
- name: Setup Python
Expand Down

0 comments on commit d087842

Please sign in to comment.