Skip to content

Commit 0b69dc1

Browse files
committed
ci: skip cache update on PR runs.
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 9699b32 commit 0b69dc1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/cpp.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,14 @@ jobs:
137137

138138
- name: Bazel cache
139139
if: ${{ matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker') }}
140-
uses: actions/cache@v2
140+
uses: PiotrSikora/cache@v2.1.7-with-skip-cache
141141
with:
142142
path: |
143143
~/.cache/bazel
144144
/private/var/tmp/_bazel_runner/
145145
key: ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
146146
restore-keys: |
147147
${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-
148-
${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}
149148
150149
- name: Bazel build/test
151150
run: >
@@ -169,7 +168,7 @@ jobs:
169168
//test:signature_util_test
170169
171170
- name: Cleanup Bazel cache
172-
if: ${{ matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker') }}
171+
if: ${{ github.ref == ‘refs/heads/master’ && (matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker')) }}
173172
run: |
174173
export OUTPUT=$(bazel info output_base)
175174
# BoringSSL's test data (90 MiB).
@@ -191,3 +190,7 @@ jobs:
191190
# Bazel's repository cache (650-800 MiB) and install base (155 MiB).
192191
rm -rf $(bazel info repository_cache)
193192
rm -rf $(bazel info install_base)
193+
194+
- name: Skip cache update
195+
if: ${{ github.ref != ‘refs/heads/master’ }}
196+
run: echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV

0 commit comments

Comments
 (0)