From 988fd4f50010582b669911575af8430de40f3aaa Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Mon, 7 Feb 2022 22:44:22 -0800 Subject: [PATCH 1/4] 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 --- .github/workflows/cpp.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 556f2dc5c..833f8ff3f 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -137,7 +137,7 @@ jobs: - name: Bazel cache if: ${{ matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker') }} - uses: actions/cache@v2 + uses: PiotrSikora/cache@v2.1.7-with-skip-cache with: path: | ~/.cache/bazel @@ -145,7 +145,6 @@ jobs: key: ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }} restore-keys: | ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}- - ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }} - name: Bazel build/test run: > @@ -169,7 +168,7 @@ jobs: //test:signature_util_test - name: Cleanup Bazel cache - if: ${{ matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker') }} + if: ${{ github.ref == 'refs/heads/master' && (matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker')) }} run: | export OUTPUT=$(bazel info output_base) # BoringSSL's test data (90 MiB). @@ -191,3 +190,7 @@ jobs: # Bazel's repository cache (650-800 MiB) and install base (155 MiB). rm -rf $(bazel info repository_cache) rm -rf $(bazel info install_base) + + - name: Skip cache update + if: ${{ github.ref != 'refs/heads/master' }} + run: echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV From e337fef6f0655cd8e62a4ce5a4b710c1fbdf11cf Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Mon, 7 Feb 2022 23:02:58 -0800 Subject: [PATCH 2/4] review: style. Signed-off-by: Piotr Sikora --- .github/workflows/cpp.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 833f8ff3f..b84185b5a 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -167,6 +167,10 @@ jobs: --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-)\" //test:signature_util_test + - name: Skip Bazel cache update + if: ${{ github.ref != 'refs/heads/master' }} + run: echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV + - name: Cleanup Bazel cache if: ${{ github.ref == 'refs/heads/master' && (matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker')) }} run: | @@ -190,7 +194,3 @@ jobs: # Bazel's repository cache (650-800 MiB) and install base (155 MiB). rm -rf $(bazel info repository_cache) rm -rf $(bazel info install_base) - - - name: Skip cache update - if: ${{ github.ref != 'refs/heads/master' }} - run: echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV From 5c70518958c97f63c0ae5f4cc3e59d21b2f739dc Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Tue, 8 Feb 2022 02:29:58 -0800 Subject: [PATCH 3/4] review: adjust test_data. Signed-off-by: Piotr Sikora --- .github/workflows/cpp.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 6802a9942..8a52f346f 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -66,7 +66,7 @@ jobs: - uses: actions/checkout@v2 - name: Bazel cache - uses: actions/cache@v2 + uses: PiotrSikora/cache@v2.1.7-with-skip-cache with: path: | ~/.cache/bazel @@ -88,7 +88,12 @@ jobs: if-no-files-found: error retention-days: 3 + - name: Skip Bazel cache update + if: ${{ github.ref != 'refs/heads/master' }} + run: echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV + - name: Cleanup Bazel cache + if: ${{ github.ref == 'refs/heads/master' }} run: | export OUTPUT=$(bazel info output_base) # Distfiles for Rust toolchains (350 MiB). From 02d2f60364ba03b34b0a488c355003f9cb3f75c2 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Tue, 8 Feb 2022 02:42:21 -0800 Subject: [PATCH 4/4] review: skip the skip, when not needed. Signed-off-by: Piotr Sikora --- .github/workflows/cpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 8a52f346f..680268bfb 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -229,7 +229,7 @@ jobs: //test:signature_util_test - name: Skip Bazel cache update - if: ${{ github.ref != 'refs/heads/master' }} + if: ${{ github.ref != 'refs/heads/master' && (matrix.runtime != 'wasmtime' || startsWith(matrix.run_under, 'docker')) }} run: echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV - name: Cleanup Bazel cache