From 70b85cd5faa97b179b8c5e57c86473ab3305a403 Mon Sep 17 00:00:00 2001 From: Burke Davison <40617934+burkedavison@users.noreply.github.com> Date: Thu, 22 Dec 2022 15:54:25 -0500 Subject: [PATCH] ci: fix bazel cache (#1197) * ci: fix bazel cache * ci: fix bazel cache in all locations --- .github/workflows/ci-maven.yaml | 12 +++++------- .github/workflows/ci.yaml | 20 +++++++------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci-maven.yaml b/.github/workflows/ci-maven.yaml index c62607917c..db85f6f94e 100644 --- a/.github/workflows/ci-maven.yaml +++ b/.github/workflows/ci-maven.yaml @@ -124,7 +124,8 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/bazel - key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }} + key: ${{ runner.os }}-${{ hashFiles('WORKSPACE') }} + restore-keys: ${{ runner.os }}- - name: Bazel Cache Not Found if: steps.cache-bazel.outputs.cache-hit != 'true' run: | @@ -133,12 +134,9 @@ jobs: if: steps.cache-bazel.outputs.cache-hit == 'true' run: | echo -n "Cache found. Cache size: " - du -sh ~/.cache/bazel - echo "If the cache seems broken, update the CACHE_VERSION secret in" - echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions" - echo "(use any random string, any GUID will work)" - echo "and it will start over with a clean cache." - echo "The old one will disappear after 7 days." + du -sh ~/.cache/bazel + echo "If the cache seems broken, update the root WORKSPACE file with a trivial change." + echo "The old cache will disappear after 7 days." - name: Install maven modules run: | diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bd4848f6d1..60fddf8afb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,8 +24,8 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/bazel - key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }} - + key: ${{ runner.os }}-${{ hashFiles('WORKSPACE') }} + restore-keys: ${{ runner.os }}- - name: Bazel Cache Not Found if: steps.cache-bazel.outputs.cache-hit != 'true' run: | @@ -35,10 +35,7 @@ jobs: run: | echo -n "Cache found. Cache size: " du -sh ~/.cache/bazel - echo "If the cache seems broken, update the CACHE_VERSION secret in" - echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions" - echo "(use any random string, any GUID will work)" - echo "and it will start over with a clean cache." + echo "If the cache seems broken, update the root WORKSPACE file with a trivial change." echo "The old one will disappear after 7 days." - name: Integration Tests @@ -70,8 +67,8 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/bazel - key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }} - + key: ${{ runner.os }}-${{ hashFiles('WORKSPACE') }} + restore-keys: ${{ runner.os }}- - name: Bazel Cache Not Found if: steps.cache-bazel.outputs.cache-hit != 'true' run: | @@ -81,11 +78,8 @@ jobs: run: | echo -n "Cache found. Cache size: " du -sh ~/.cache/bazel - echo "If the cache seems broken, update the CACHE_VERSION secret in" - echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions" - echo "(use any random string, any GUID will work)" - echo "and it will start over with a clean cache." - echo "The old one will disappear after 7 days." + echo "If the cache seems broken, update the root WORKSPACE file with a trivial change." + echo "The old cache will disappear after 7 days." - name: Gradle Build Generated Storage Client Library run: |