Skip to content

Commit 898d2cb

Browse files
authored
ci: skip cache update on PRs. (proxy-wasm#244)
Cache updates on PRs result in early eviction of primary cache, due to the limited cache quota on GitHub Actions. While there, remove fallback to restore cache key based only on the Wasm runtime name, since it prevents pruning of stale data. Signed-off-by: Piotr Sikora <[email protected]>
1 parent 9818f68 commit 898d2cb

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

.github/workflows/cpp.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
- uses: actions/checkout@v2
6767

6868
- name: Bazel cache
69-
uses: actions/cache@v2
69+
uses: PiotrSikora/cache@v2.1.7-with-skip-cache
7070
with:
7171
path: |
7272
~/.cache/bazel
@@ -88,7 +88,12 @@ jobs:
8888
if-no-files-found: error
8989
retention-days: 3
9090

91+
- name: Skip Bazel cache update
92+
if: ${{ github.ref != 'refs/heads/master' }}
93+
run: echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV
94+
9195
- name: Cleanup Bazel cache
96+
if: ${{ github.ref == 'refs/heads/master' }}
9297
run: |
9398
export OUTPUT=$(bazel info output_base)
9499
# Distfiles for Rust toolchains (350 MiB).
@@ -179,15 +184,14 @@ jobs:
179184

180185
- name: Bazel cache
181186
if: ${{ matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker') }}
182-
uses: actions/cache@v2
187+
uses: PiotrSikora/cache@v2.1.7-with-skip-cache
183188
with:
184189
path: |
185190
~/.cache/bazel
186191
/private/var/tmp/_bazel_runner/
187192
key: ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
188193
restore-keys: |
189194
${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-
190-
${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}
191195
192196
- name: Download test data
193197
uses: actions/download-artifact@v2
@@ -224,8 +228,12 @@ jobs:
224228
--per_file_copt=src/signature_util.cc,test/signature_util_test.cc@-DPROXY_WASM_VERIFY_WITH_ED25519_PUBKEY=\"$(xxd -p -c 256 test/test_data/signature_key1.pub | cut -b9-)\"
225229
//test:signature_util_test
226230
231+
- name: Skip Bazel cache update
232+
if: ${{ github.ref != 'refs/heads/master' && (matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker')) }}
233+
run: echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV
234+
227235
- name: Cleanup Bazel cache
228-
if: ${{ matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker') }}
236+
if: ${{ github.ref == 'refs/heads/master' && (matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker')) }}
229237
run: |
230238
export OUTPUT=$(bazel info output_base)
231239
# BoringSSL's test data (90 MiB).

0 commit comments

Comments
 (0)