]> git.feebdaed.xyz Git - 0xmirror/quic-go.git/commitdiff
ci: improve cache key generation for the cross compilation job (#5315)
authorMarten Seemann <martenseemann@gmail.com>
Thu, 28 Aug 2025 15:12:06 +0000 (23:12 +0800)
committerGitHub <noreply@github.com>
Thu, 28 Aug 2025 15:12:06 +0000 (17:12 +0200)
.github/workflows/cross-compile.yml

index 928d784c3909a327460a1c3294fe554dad852407..c434d4877daa45b1b77d370ea835c729bcc81c47 100644 (file)
@@ -13,12 +13,18 @@ jobs:
       - uses: actions/setup-go@v5
         with:
           go-version: ${{ matrix.go }}
+      - name: Get Date
+        id: get-date
+        run: echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
       - name: Load Go build cache
         id: load-go-cache
         uses: actions/cache/restore@v4
         with:
-          path: ~/.cache/go-build
-          key: go-${{ matrix.go }}-crosscompile
+          path: |
+            ~/.cache/go-build
+            ~/go/pkg/mod
+          key: go-${{ matrix.go }}-crosscompile-${{ steps.get-date.outputs.date }}
+          restore-keys: go-${{ matrix.go }}-crosscompile-
       - name: Install build utils
         run: |
           sudo apt-get update
@@ -34,4 +40,6 @@ jobs:
         uses: actions/cache/save@v4
         with:
           path: ~/.cache/go-build
-          key: go-${{ matrix.go }}-crosscompile
+          # Caches are immutable, so we only update it once per day (at most).
+          # See https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
+          key: go-${{ matrix.go }}-crosscompile-${{ steps.get-date.outputs.date }}