diff --git a/.github/workflows/callable-build.yaml b/.github/workflows/callable-build.yaml index 9a1744c..372abd2 100644 --- a/.github/workflows/callable-build.yaml +++ b/.github/workflows/callable-build.yaml @@ -38,16 +38,19 @@ jobs: ) echo "checksum=$checksum" >> "$GITHUB_OUTPUT" - # Use restore-keys to always use a cache that was created with the same - # prefix. - - name: Cache go modules and the buildcache + - name: Cache Go module cache uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: - path: | - ~/go/pkg/mod - ~/.cache/go-build + path: ~/go/pkg/mod + key: go-mod-${{ hashFiles('go.sum') }} + + - name: Cache Go build cache + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ~/.cache/go-build key: build-${{ matrix.go-version-alias }}-${{ steps.checksum.outputs.checksum }} - restore-keys: build- + restore-keys: | + build-${{ matrix.go-version-alias }}- - name: Build sample mod run: make examples/samplemod/build diff --git a/.github/workflows/callable-test-function.yaml b/.github/workflows/callable-test-function.yaml index 0af4f4e..e8e654c 100644 --- a/.github/workflows/callable-test-function.yaml +++ b/.github/workflows/callable-test-function.yaml @@ -38,16 +38,19 @@ jobs: ) echo "checksum=$checksum" >> "$GITHUB_OUTPUT" - # Use restore-keys to always use a cache that was created with the same - # prefix. - - name: Cache go modules and the buildcache + - name: Cache Go module cache uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: - path: | - ~/go/pkg/mod - ~/.cache/go-build + path: ~/go/pkg/mod + key: go-mod-${{ hashFiles('go.sum') }} + + - name: Cache Go build cache + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ~/.cache/go-build key: function-test-${{ matrix.go-version-alias }}-${{ steps.checksum.outputs.checksum }} - restore-keys: function-test- + restore-keys: | + function-test-${{ matrix.go-version-alias }}- - name: Run samplemod executable run: make examples/samplemod/run diff --git a/.github/workflows/callable-test-unit.yaml b/.github/workflows/callable-test-unit.yaml index a90cd91..2af3d24 100644 --- a/.github/workflows/callable-test-unit.yaml +++ b/.github/workflows/callable-test-unit.yaml @@ -38,20 +38,24 @@ jobs: ) echo "checksum=$checksum" >> "$GITHUB_OUTPUT" - # Use restore-keys to always use a cache that was created with the same - # prefix. - - name: Cache go modules and the buildcache + - name: Cache Go module cache uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: - path: | - ~/go/pkg/mod - ~/.cache/go-build + path: ~/go/pkg/mod + key: go-mod-${{ hashFiles('go.sum') }} + + - name: Cache Go build cache + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ~/.cache/go-build key: unit-test-${{ matrix.go-version-alias }}-${{ steps.checksum.outputs.checksum }} - restore-keys: unit-test- + restore-keys: | + unit-test-${{ matrix.go-version-alias }}- - name: Run tests run: make test/unit-json + - name: Publish test results uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3.0.0 if: always() diff --git a/.github/workflows/code-scanning.yaml b/.github/workflows/code-scanning.yaml index 2be5450..bc1ecf9 100644 --- a/.github/workflows/code-scanning.yaml +++ b/.github/workflows/code-scanning.yaml @@ -41,11 +41,37 @@ jobs: uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version: stable - cache-dependency-path: tools/go.sum + cache: false + + - name: Checksum + id: checksum + run: | + checksum=$( + { + sha256sum tools/go.mod tools/go.sum + find . -type f -name "*.go" -print0 | sort -z | xargs -0 sha256sum + } | sha256sum | awk '{print $1}' + ) + echo "checksum=$checksum" >> "$GITHUB_OUTPUT" + + - name: Cache Go module cache + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ~/go/pkg/mod + key: govulncheck-go-mod-${{ hashFiles('tools/go.sum') }} + + - name: Cache Go build cache + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ~/.cache/go-build + key: govulncheck-build-${{ steps.checksum.outputs.checksum }} + restore-keys: | + govulncheck-build- - name: Run govulncheck run: make static-analysis/vulncheck-sarif + - name: Upload SARIF report if: always() uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.53.3 diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 819e4c6..541ad03 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -26,14 +26,30 @@ jobs: go-version-file: go.mod cache: false - - name: Cache Go modules and build cache + - name: Checksum + id: checksum + run: | + checksum=$( + { + sha256sum go.mod go.sum tools/go.mod tools/go.sum + find . -type f -name "*.go" -print0 | sort -z | xargs -0 sha256sum + } | sha256sum | awk '{print $1}' + ) + echo "checksum=$checksum" >> "$GITHUB_OUTPUT" + + - name: Cache Go module cache + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ~/go/pkg/mod + key: copilot-go-mod-${{ hashFiles('go.sum', 'tools/go.sum') }} + + - name: Cache Go build cache uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: - path: | - ~/go/pkg/mod - ~/.cache/go-build - key: copilot-go-${{ hashFiles('go.sum', 'tools/go.sum') }} - restore-keys: copilot-go- + path: ~/.cache/go-build + key: copilot-go-build-${{ steps.checksum.outputs.checksum }} + restore-keys: | + copilot-go-build- - name: Download Go module dependencies run: |