From 5545c2fc177311d3ec03ac8cb8466f4ae92990ed Mon Sep 17 00:00:00 2001 From: Derek Cormier Date: Mon, 17 Jan 2022 18:31:48 -0800 Subject: [PATCH] build: fix ci build caching --- .github/workflows/ci.bazelrc | 4 ++-- .github/workflows/ci.yaml | 14 ++++++-------- .github/workflows/release.yml | 8 ++++++++ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.bazelrc b/.github/workflows/ci.bazelrc index cdb2b24..cb9c32a 100644 --- a/.github/workflows/ci.bazelrc +++ b/.github/workflows/ci.bazelrc @@ -7,7 +7,7 @@ build --announce_rc # 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 +build --disk_cache=~/.cache/bazel +build --repository_cache=~/.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 480853b..1f0bc17 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,16 +20,14 @@ 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. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f21c3c..94a42cf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,14 @@ 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