diff --git a/.github/actions/warm-go-cache/action.yaml b/.github/actions/warm-go-cache/action.yaml new file mode 100644 index 00000000000..8b4a192314c --- /dev/null +++ b/.github/actions/warm-go-cache/action.yaml @@ -0,0 +1,13 @@ +name: 'Warm Go build cache' +description: 'Set GOCACHE and optionally warm from EFS-backed PV' +runs: + using: composite + steps: + - shell: bash + run: | + echo "GOCACHE=/tmp/go-build-cache" >> "$GITHUB_ENV" + if [ -d /cache/go-build ]; then + mkdir -p /tmp/go-build-cache && \ + timeout 120 cp -a /cache/go-build/. /tmp/go-build-cache/ || \ + echo "Warning: failed to copy EFS cache, proceeding without cache" + fi diff --git a/.github/workflows/test-reusable.yaml b/.github/workflows/test-reusable.yaml index 30bf654a229..4f86dd1919d 100644 --- a/.github/workflows/test-reusable.yaml +++ b/.github/workflows/test-reusable.yaml @@ -86,12 +86,7 @@ jobs: with: go-version-file: go.mod cache: false - - name: Restore Go build cache - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 - with: - path: /tmp/go-build-cache - key: go-build-${{ matrix.shard }}-${{ hashFiles('go.mod') }}-${{ github.sha }} - restore-keys: go-build-${{ matrix.shard }}-${{ hashFiles('go.mod') }}- + - uses: ./.github/actions/warm-go-cache - name: Run tests run: make test-shard TEST_PACKAGES="${{ matrix.packages }}" COVER_PROFILE="cover-${{ matrix.shard }}.out" - name: Upload to Codecov