From 81eaa054b75edff1f1ac753533db9bd8e3cba660 Mon Sep 17 00:00:00 2001 From: Derek Cormier Date: Fri, 21 Jan 2022 08:48:43 -0800 Subject: [PATCH] build: fix ci build caching (#25) --- .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 967616a..5c5d995 100644 --- a/.github/workflows/ci.bazelrc +++ b/.github/workflows/ci.bazelrc @@ -2,6 +2,6 @@ # Included with a --bazelrc option in the call to bazel build --announce_rc test --test_output=errors -build --disk_cache=$HOME/.cache/bazel -build --repository_cache=$HOME/.cache/bazel-repo +build --disk_cache=~/.cache/bazel +build --repository_cache=~/.cache/bazel-repo test --test_env=XDG_CACHE_HOME diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 880bd5f..a7cdde2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,16 +21,14 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - uses: bazelbuild/setup-bazelisk@v1 - - 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 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