Skip to content

Commit b79faaf

Browse files
committed
[build] add Github Cache workflow and cancel-on-failure guard in bazel.yml
1 parent 9045e3b commit b79faaf

3 files changed

Lines changed: 28 additions & 9 deletions

File tree

.github/workflows/bazel.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ jobs:
166166
bazelrc: common --color=yes
167167
# Workaround for long path issues: https://github.com/bazelbuild/bazel/pull/22532
168168
output-base: ${{ inputs.os == 'windows' && 'D://b' || '' }}
169-
cache-version: 2
170169
disk-cache: false
171170
external-cache: |
172171
manifest:
@@ -297,3 +296,9 @@ jobs:
297296
if [ "$AVAIL_GB" -lt 5 ]; then
298297
echo "::warning::Low disk space: ${AVAIL_GB}GB remaining"
299298
fi
299+
- name: Cancel run on bazel failure to prevent poisoned cache save
300+
if: failure() && steps.run-bazel.outcome == 'failure' && inputs.cache-save
301+
env:
302+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
303+
shell: bash
304+
run: gh run cancel ${{ github.run_id }}

.github/workflows/ci-rbe.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ concurrency:
2121
permissions:
2222
contents: read
2323
packages: read
24+
actions: write
2425

2526
jobs:
2627
test:

.github/workflows/gh-cache.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
name: CI Cache
1+
name: Github Cache
22

33
on:
4+
push:
5+
branches: [trunk]
6+
paths:
7+
- 'MODULE.bazel'
8+
- 'rust/Cargo.lock'
9+
- 'java/maven_install.json'
10+
- 'py/requirements_lock.txt'
11+
- 'rb/Gemfile.lock'
12+
- 'dotnet/paket.lock'
13+
- 'common/repositories.bzl'
14+
- 'common/browsers.bzl'
15+
schedule:
16+
- cron: '30 6 * * *'
417
workflow_dispatch:
518

619
concurrency:
7-
group: ci-cache-${{ github.ref }}
20+
group: gh-cache-${{ github.ref }}
821
cancel-in-progress: true
922

1023
permissions:
1124
contents: read
25+
actions: write
1226

1327
jobs:
1428
populate:
@@ -21,9 +35,8 @@ jobs:
2135
with:
2236
name: ${{ matrix.os }}
2337
os: ${{ matrix.os }}
24-
cache-save: false
25-
run: >
26-
bazel build --nobuild --build_tests_only --keep_going
27-
--repo_contents_cache=
28-
//java/... //py/... //rb/... //rust/...
29-
//javascript/selenium-webdriver/... //dotnet/...
38+
cache-save: true
39+
run: >-
40+
bazel build --nobuild --build_tests_only --keep_going --repo_contents_cache=
41+
//java/test/... //py:* //rb/spec/... //rust/tests/...
42+
//javascript/selenium-webdriver:* //dotnet/test/...

0 commit comments

Comments
 (0)