Skip to content

Commit 7fd412f

Browse files
committed
ci: only restore main cache integration-assets
Storing many large cache assets (one per PR) causes claircore to exhaust its GH cache size limit and potentially evict the main integration-asset cache key, which is vital to the CI not being very slow. Signed-off-by: crozzy <joseph.crosland@gmail.com>
1 parent f99e8f9 commit 7fd412f

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/main.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ jobs:
104104
with:
105105
go-version: ${{ matrix.go }}
106106
- name: Cache Integration Assets
107+
id: integ
107108
if: steps.previous.outputs.cache-hit != 'true'
108-
uses: actions/cache@v5
109+
uses: actions/cache/restore@v5
109110
with:
110111
key: integration-assets-${{ hashFiles('**/*_test.go') }}
111112
restore-keys: |
@@ -128,6 +129,19 @@ jobs:
128129
go mod download
129130
GOMAXPROCS=2 go test -race ${RUNNER_DEBUG:+-v} "-coverprofile=${{ runner.temp }}/$(go list -m | tr / _).codecov.out" -covermode=atomic ./...
130131
); done
132+
# Pull requests restore ~/.cache/clair-testing but do not upload it.
133+
# Only pushes to main refresh the integration-assets cache (one matrix leg).
134+
- name: Save integration assets cache
135+
if: >-
136+
github.event_name == 'push' &&
137+
github.ref == 'refs/heads/main' &&
138+
matrix.go == 'stable' &&
139+
steps.previous.outputs.cache-hit != 'true' &&
140+
steps.integ.outputs.cache-hit != 'true'
141+
uses: actions/cache/save@v5
142+
with:
143+
key: integration-assets-${{ hashFiles('**/*_test.go') }}
144+
path: ~/.cache/clair-testing
131145
- name: Codecov
132146
if: >-
133147
steps.previous.outputs.cache-hit != 'true' &&

0 commit comments

Comments
 (0)