Skip to content

Commit

Permalink
.github/workflows: More specific cache key, use actions/cache@v3, stu…
Browse files Browse the repository at this point in the history
…b action if there's a cache miss.
  • Loading branch information
ivucica committed May 8, 2024
1 parent 39da343 commit 3ef86d9
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: C/C++ and Bazel CI

on: [push, pull_request]

# Not using 'inputs' here, since we take no inputs at this time -- just the 'github' context.
run-name: Run CI with ${{ github.ref_name }} by @${{ github.actor }}

jobs:
cpp:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -37,15 +40,26 @@ jobs:

# Caches and restores the bazel build directory.
- name: Cache bazel build results
uses: actions/cache@v2.0.0
uses: actions/cache@v3
env:
cache-name: bazel-cache
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }}
key: bazel-${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }}
restore-keys: |
bazel-${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }}
bazel-${{ runner.os }}-${{ env.cache-name }}-master
bazel-${{ runner.os }}-${{ env.cache-name }}-
bazel-${{ runner.os }}-
${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }}
${{ runner.os }}-${{ env.cache-name }}-master
- if: ${{ steps.bazel-cache.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
# More useful with e.g. npm.
run: echo "Stub action: merely printing a notice that there was a cache miss"

- name: Checkout submodules
run: git submodule init && git submodule update
- name: install deps
Expand All @@ -65,15 +79,26 @@ jobs:

# Caches and restores the bazel build directory.
- name: Cache bazel build results
uses: actions/cache@v2.0.0
uses: actions/cache@v3
env:
cache-name: bazel-cache
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }}
key: bazel-${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }}
restore-keys: |
bazel-${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }}
bazel-${{ runner.os }}-${{ env.cache-name }}-master
bazel-${{ runner.os }}-${{ env.cache-name }}-
bazel-${{ runner.os }}-
${{ runner.os }}-${{ env.cache-name }}-${{ github.ref }}
${{ runner.os }}-${{ env.cache-name }}-master
- if: ${{ steps.bazel-cache.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
# More useful with e.g. npm.
run: echo "Stub action: merely printing a notice that there was a cache miss"

- name: Checkout submodules
run: git submodule init && git submodule update
- name: rbe bazel build
Expand Down

0 comments on commit 3ef86d9

Please sign in to comment.