diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e99e75b22..66d5c6d92 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -144,10 +144,10 @@ jobs: path: | ~/.cache/go-build ~\AppData\Local\go-build - key: ${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }} + key: ${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}-${{ hashFiles('*/go.sum') }}-${{ github.job }}-${{ github.run_id }} restore-keys: | - ${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}-${{ hashFiles('**/go.sum') }}-${{ github.job }}- - ${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}-${{ hashFiles('**/go.sum') }}- + ${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}-${{ hashFiles('*/go.sum') }}-${{ github.job }}- + ${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}-${{ hashFiles('*/go.sum') }}- ${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}- ${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go- - name: build all @@ -215,7 +215,7 @@ jobs: path: | ~/.cache/go-build ~\AppData\Local\go-build - key: ${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }} + key: ${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-${{ matrix.shard }}-${{ hashFiles('*/go.sum') }}-${{ github.job }}-${{ github.run_id }} windows: permissions: @@ -256,6 +256,20 @@ jobs: key: ${{ needs.gomod-cache.outputs.cache-key }} enableCrossOsArchive: true + - name: Restore bootstrap cache + id: restore-cache + uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + with: + # Note: this is only restoring the build cache. Mod cache is shared amongst + # all jobs in the workflow. + path: | + ~/.cache/go-build + ~\AppData\Local\go-build + key: cigocacher-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('*/go.sum', '*/cmd/cigocacher/**') }} + restore-keys: | + cigocacher-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('*/go.sum', '*/cmd/cigocacher/**') }} + cigocacher-${{ runner.os }}-${{ runner.arch }}- + - name: Set up cigocacher id: cigocacher-setup uses: ./src/.github/actions/go-cache @@ -265,6 +279,16 @@ jobs: cigocached-url: ${{ vars.CIGOCACHED_AZURE_URL }} cigocached-host: ${{ vars.CIGOCACHED_AZURE_HOST }} + - name: Save bootstrap cache + # Only save on cache miss and main branch to avoid thrashing. + if: steps.restore-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main' + uses: actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + with: + path: | + ~/.cache/go-build + ~\AppData\Local\go-build + key: cigocacher-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('*/go.sum', '*/cmd/cigocacher/**') }} + - name: test if: matrix.key != 'win-bench' # skip on bench builder working-directory: src @@ -404,10 +428,10 @@ jobs: path: | ~/.cache/go-build ~\AppData\Local\go-build - key: ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }} + key: ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go-${{ hashFiles('*/go.sum') }}-${{ github.job }}-${{ github.run_id }} restore-keys: | - ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}- - ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go-${{ hashFiles('**/go.sum') }}- + ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go-${{ hashFiles('*/go.sum') }}-${{ github.job }}- + ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go-${{ hashFiles('*/go.sum') }}- ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go- - name: build all working-directory: src @@ -439,7 +463,7 @@ jobs: path: | ~/.cache/go-build ~\AppData\Local\go-build - key: ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }} + key: ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}-go-${{ hashFiles('*/go.sum') }}-${{ github.job }}-${{ github.run_id }} ios: # similar to cross above, but iOS can't build most of the repo. So, just # make it build a few smoke packages. @@ -503,10 +527,10 @@ jobs: path: | ~/.cache/go-build ~\AppData\Local\go-build - key: ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }} + key: ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-${{ hashFiles('*/go.sum') }}-${{ github.job }}-${{ github.run_id }} restore-keys: | - ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}- - ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-${{ hashFiles('**/go.sum') }}- + ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-${{ hashFiles('*/go.sum') }}-${{ github.job }}- + ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-${{ hashFiles('*/go.sum') }}- ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go- - name: build core working-directory: src @@ -531,7 +555,7 @@ jobs: path: | ~/.cache/go-build ~\AppData\Local\go-build - key: ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }} + key: ${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-${{ hashFiles('*/go.sum') }}-${{ github.job }}-${{ github.run_id }} android: # similar to cross above, but android fails to build a few pieces of the @@ -584,10 +608,10 @@ jobs: path: | ~/.cache/go-build ~\AppData\Local\go-build - key: ${{ runner.os }}-js-wasm-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }} + key: ${{ runner.os }}-js-wasm-go-${{ hashFiles('*/go.sum') }}-${{ github.job }}-${{ github.run_id }} restore-keys: | - ${{ runner.os }}-js-wasm-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}- - ${{ runner.os }}-js-wasm-go-${{ hashFiles('**/go.sum') }}- + ${{ runner.os }}-js-wasm-go-${{ hashFiles('*/go.sum') }}-${{ github.job }}- + ${{ runner.os }}-js-wasm-go-${{ hashFiles('*/go.sum') }}- ${{ runner.os }}-js-wasm-go- - name: build tsconnect client working-directory: src @@ -617,7 +641,7 @@ jobs: path: | ~/.cache/go-build ~\AppData\Local\go-build - key: ${{ runner.os }}-js-wasm-go-${{ hashFiles('**/go.sum') }}-${{ github.job }}-${{ github.run_id }} + key: ${{ runner.os }}-js-wasm-go-${{ hashFiles('*/go.sum') }}-${{ github.job }}-${{ github.run_id }} tailscale_go: # Subset of tests that depend on our custom Go toolchain. runs-on: ubuntu-24.04