Skip to content

Commit a22b72d

Browse files
committed
Cache bazel setup runs
1 parent 17d8315 commit a22b72d

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

.github/workflows/workflow.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,30 @@ jobs:
2121
steps:
2222
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
2323
- run: echo "🐧 Job is running on a ${{ runner.os }} server!"
24-
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
24+
- run: echo "🔎 The name of your branch is ${{ GITHUB_REF }} and your repository is ${{ github.repository }}."
2525
- name: Check out repository code
2626
uses: actions/checkout@v6
2727
- name: Setup Bazel
2828
uses: bazel-contrib/setup-bazel@0.18.0
29+
with:
30+
# Avoid downloading Bazel every time.
31+
bazelisk-cache: true
32+
# Store build cache per workflow.
33+
disk-cache: ${{ github.workflow }}
34+
# Share repository cache between workflows.
35+
repository-cache: true
2936
- name: Unwanted Dependencies
3037
run: .github/workflows/unwanted_deps.sh
3138
- name: Cross Artifact Duplicate Classes Check
3239
run: .github/workflows/cross_artifact_dependencies_check.sh
3340
- run: echo "🍏 This job's status is ${{ job.status }}."
34-
3541
Bazel-Tests:
3642
runs-on: ubuntu-latest
3743
timeout-minutes: 30
3844
steps:
3945
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
4046
- run: echo "🐧 Job is running on a ${{ runner.os }} server!"
41-
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
47+
- run: echo "🔎 The name of your branch is ${{ GITHUB_REF }} and your repository is ${{ github.repository }}."
4248
- name: Check out repository code
4349
uses: actions/checkout@v6
4450
- name: Setup Bazel
@@ -60,15 +66,14 @@ jobs:
6066
run: bazelisk test ... --deleted_packages=//codelab/src/test/codelab --test_output=errors --test_tag_filters=-conformance_maven --build_tag_filters=-conformance_maven
6167
- run: echo "🍏 This job's status is ${{ job.status }}."
6268

63-
6469
# -- Start of Maven Conformance Tests (Ran only when there's version changes) --
6570
Maven-Conformance:
6671
runs-on: ubuntu-latest
6772
timeout-minutes: 30
6873
steps:
6974
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
7075
- run: echo "🐧 Job is running on a ${{ runner.os }} server!"
71-
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
76+
- run: echo "🔎 The name of your branch is ${{ GITHUB_REF }} and your repository is ${{ github.repository }}."
7277
- name: Check out repository code
7378
uses: actions/checkout@v6
7479
- name: Get changed files
@@ -79,6 +84,13 @@ jobs:
7984
- name: Setup Bazel
8085
if: steps.changed_file.outputs.any_changed == 'true'
8186
uses: bazel-contrib/setup-bazel@0.18.0
87+
with:
88+
# Avoid downloading Bazel every time.
89+
bazelisk-cache: true
90+
# Store build cache per workflow.
91+
disk-cache: ${{ github.workflow }}
92+
# Share repository cache between workflows.
93+
repository-cache: true
8294
- name: Verify Version Consistency
8395
if: steps.changed_file.outputs.any_changed == 'true'
8496
run: |

0 commit comments

Comments
 (0)