diff --git a/.github/workflows/ci.bazelrc b/.github/workflows/ci.bazelrc index cdb2b24a..bba743bc 100644 --- a/.github/workflows/ci.bazelrc +++ b/.github/workflows/ci.bazelrc @@ -6,8 +6,5 @@ build --announce_rc # Don't rely on test logs being easily accessible from the test runner, # though it makes the log noisier. test --test_output=errors -# This directory is configured in GitHub actions to be persisted between runs. -build --disk_cache=$HOME/.cache/bazel -build --repository_cache=$HOME/.cache/bazel-repo # Allows tests to run bazelisk-in-bazel, since this is the cache folder used test --test_env=XDG_CACHE_HOME diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 480853b7..c3b5d402 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,18 +20,23 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - - name: Mount bazel action cache + - name: Mount bazel caches uses: actions/cache@v2 with: - path: "~/.cache/bazel" - key: bazel - - name: Mount bazel repo cache - uses: actions/cache@v2 - with: - path: "~/.cache/bazel-repo" - key: bazel-repo + path: | + "~/.cache/bazel" + "~/.cache/bazel-repo" + key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE') }} + restore-keys: bazel-cache- - name: bazel test //... env: # Bazelisk will download bazel to here, ensure it is cached between runs. XDG_CACHE_HOME: ~/.cache/bazel-repo - run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //... + run: | + bazel \ + --bazelrc=.github/workflows/ci.bazelrc \ + --bazelrc=.bazelrc \ + test \ + --disk_cache=${HOME}/.cache/bazel \ + --repository_cache=${HOME}/.cache/bazel-repo \ + //... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f21c3ca..616bca19 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,11 +14,26 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - name: Mount bazel caches + uses: actions/cache@v2 + with: + path: | + "~/.cache/bazel" + "~/.cache/bazel-repo" + key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE') }} + restore-keys: bazel-cache- - name: bazel test //... env: # Bazelisk will download bazel to here XDG_CACHE_HOME: ~/.cache/bazel-repo - run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test //... + run: | + bazel \ + --bazelrc=.github/workflows/ci.bazelrc \ + --bazelrc=.bazelrc \ + test \ + --disk_cache=${HOME}/.cache/bazel \ + --repository_cache=${HOME}/.cache/bazel-repo \ + //... - name: Prepare workspace snippet run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt - name: Release