Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/actions/warm-go-cache/action.yaml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 1 addition & 6 deletions .github/workflows/test-reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: With GOCACHE removed from the job-level env: block and now set inside this composite action via $GITHUB_ENV, the variable is no longer visible at a glance in the workflow file. If someone adds a Go step before warm-go-cache (or reorders steps), it would silently use Go's default cache path instead.

Consider adding a brief comment here or keeping GOCACHE in the job-level env as a declarative default that the action can override.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense — restored GOCACHE: /tmp/go-build-cache in the job-level env: block here and in all 4 workflow files in #8495. The composite action still sets it via $GITHUB_ENV as a runtime override, but the declarative default ensures it's always visible and safe against step reordering.

- name: Run tests
run: make test-shard TEST_PACKAGES="${{ matrix.packages }}" COVER_PROFILE="cover-${{ matrix.shard }}.out"
- name: Upload to Codecov
Expand Down