diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6e2337bb4..d1e374d08 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,14 @@ jobs: go.mod go.sum .github/workflows/test.yml + # This setup-go action will cache/restore using a key with a hash of go.sum. + - uses: actions/setup-go@v5 + id: setup-go + with: + go-version-file: 'go.mod' + - name: Populate Mod Cache + if: steps.setup-go.outputs.cache-hit != 'true' + run: go mod download - name: Define Variables id: def-vars run: | @@ -80,10 +88,8 @@ jobs: path: ./pkgs.txt.part.04 outputs: should-run: ${{ env.GIT_DIFF }} - go-version: '1.21' file-prefix: ${{ steps.def-vars.outputs.file-prefix }} - tests: needs: setup-tests # Note: There's a required check on this, and it must pass. A skip doesn't count as a pass. @@ -104,7 +110,7 @@ jobs: - uses: actions/setup-go@v5 if: needs.setup-tests.outputs.should-run with: - go-version: ${{ needs.setup-tests.outputs.go-version }} + go-version-file: 'go.mod' - uses: actions/download-artifact@v4 if: needs.setup-tests.outputs.should-run with: @@ -191,7 +197,7 @@ jobs: - uses: actions/setup-go@v5 if: needs.setup-tests.outputs.should-run with: - go-version: ${{ needs.setup-tests.outputs.go-version }} + go-version-file: 'go.mod' - uses: actions/download-artifact@v4 if: needs.setup-tests.outputs.should-run with: