From a8cb0ad2467eca49348b269dd2061106cc19b383 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Tue, 28 Jan 2025 18:58:13 +0000 Subject: [PATCH] .github/zephyr: simplify and fix the git describe performance hack Fixes the git describe/tag performance hack added in commit 23284780d7cb (".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 4bc6488b24e4 (".github/zephyr: de-hardcode the name of the zephyr remote") Signed-off-by: Marc Herbert --- .github/workflows/zephyr.yml | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/zephyr.yml b/.github/workflows/zephyr.yml index 3fe3e8982d58..e304dee8220c 100644 --- a/.github/workflows/zephyr.yml +++ b/.github/workflows/zephyr.yml @@ -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 --filter=tree:0 sof_zep_rem "$rem_rev" + # Fix problem 1. Indirectly fetches useless branches but should be quick enough + # thanks to the --filter + time git fetch --filter=tree:0 --tags sof_zep_rem + west list west status git log --oneline -n 5 --decorate --graph --no-abbrev-commit @@ -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 --filter=tree:0 sof_zep_rem main + git fetch --filter=tree:0 --tags sof_zep_rem + 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