Skip to content

Commit 8f3b261

Browse files
committed
[build] add github cache workflow with cache-save parameter
1 parent 000ded7 commit 8f3b261

3 files changed

Lines changed: 35 additions & 1 deletion

File tree

.github/workflows/bazel.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ on:
7171
required: false
7272
type: string
7373
default: ''
74+
cache-save:
75+
description: Save the Bazel cache after the run (avoids multiple jobs clobbering it)
76+
required: false
77+
type: boolean
78+
default: false
7479
gem-trusted-publishing:
7580
description: Exchange GitHub OIDC token for a RubyGems API token (requires trusted publisher configured on rubygems.org)
7681
required: false
@@ -156,7 +161,7 @@ jobs:
156161
continue-on-error: true
157162
uses: bazel-contrib/setup-bazel@0.19.0
158163
with:
159-
cache-save: ${{ github.ref_name == 'trunk' }}
164+
cache-save: ${{ inputs.cache-save }}
160165
bazelisk-cache: true
161166
bazelrc: common --color=yes
162167
# Workaround for long path issues: https://github.com/bazelbuild/bazel/pull/22532

.github/workflows/ci-rbe.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
uses: ./.github/workflows/bazel.yml
3030
with:
3131
name: All RBE tests
32+
cache-save: ${{ github.ref_name == 'trunk' }}
3233
rerun-with-debug: true
3334
ruby-version: jruby-10.1.0.0
3435
run: ./scripts/github-actions/ci-build.sh ${{ github.event.inputs.disable_test_cache }}

.github/workflows/gh-cache.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI Cache
2+
3+
on:
4+
workflow_dispatch:
5+
6+
concurrency:
7+
group: ci-cache-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
populate:
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [macos, windows]
19+
uses: ./.github/workflows/bazel.yml
20+
with:
21+
name: Populate cache (${{ matrix.os }})
22+
os: ${{ matrix.os }}
23+
cache-save: false
24+
run: >
25+
bazel build --nobuild --build_tests_only --keep_going
26+
--repository_contents_cache=
27+
//java/... //py/... //rb/... //rust/...
28+
//javascript/selenium-webdriver/... //dotnet/...

0 commit comments

Comments
 (0)