Skip to content

Commit dd604f7

Browse files
committed
Drop repo/bazel cache, prune disk cache entries
1 parent 872fc15 commit dd604f7

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

‎.github/workflows/workflow.yml‎

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ jobs:
2424
- 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
27+
- name: Mark job start
28+
run: touch "$RUNNER_TEMP/job-start"
2729
- name: Setup Bazel
2830
uses: bazel-contrib/setup-bazel@0.18.0
2931
with:
30-
# Avoid downloading Bazel every time.
31-
bazelisk-cache: true
3232
# Store build cache per workflow.
3333
disk-cache: ${{ github.workflow }}-${{ github.job }}
34-
# Share repository cache between workflows.
35-
repository-cache: true
3634
# Prevent PRs from polluting cache
3735
cache-save: ${{ github.event_name != 'pull_request' }}
3836
- name: Bazel Output Version
@@ -43,6 +41,13 @@ jobs:
4341
run: .github/workflows/unwanted_deps.sh
4442
- name: Cross-artifact Duplicate Classes Check
4543
run: .github/workflows/cross_artifact_dependencies_check.sh
44+
- name: Prune disk cache entries not used by this job
45+
# Bazel bumps mtimes on use; drop stale entries so the saved cache doesn't grow unbounded.
46+
if: github.event_name != 'pull_request'
47+
run: |
48+
du -sh ~/.cache/bazel-disk
49+
find ~/.cache/bazel-disk -type f ! -newer "$RUNNER_TEMP/job-start" -delete
50+
du -sh ~/.cache/bazel-disk
4651
- run: echo "🍏 This job's status is ${{ job.status }}."
4752

4853
Bazel-Tests:
@@ -54,15 +59,13 @@ jobs:
5459
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
5560
- name: Check out repository code
5661
uses: actions/checkout@v6
62+
- name: Mark job start
63+
run: touch "$RUNNER_TEMP/job-start"
5764
- name: Setup Bazel
5865
uses: bazel-contrib/setup-bazel@0.18.0
5966
with:
60-
# Avoid downloading Bazel every time.
61-
bazelisk-cache: true
6267
# Store build cache per workflow.
6368
disk-cache: ${{ github.workflow }}-${{ github.job }}
64-
# Share repository cache between workflows.
65-
repository-cache: true
6669
# Prevent PRs from polluting cache
6770
cache-save: ${{ github.event_name != 'pull_request' }}
6871
- name: Bazel Output Version
@@ -71,6 +74,13 @@ jobs:
7174
# Exclude codelab exercises as they are intentionally made to fail
7275
# Exclude maven conformance tests. They are only executed when there's version change.
7376
run: bazelisk test ... --deleted_packages=//codelab/src/test/codelab --test_output=errors --test_tag_filters=-conformance_maven --build_tag_filters=-conformance_maven
77+
- name: Prune disk cache entries not used by this job
78+
# Bazel bumps mtimes on use; drop stale entries so the saved cache doesn't grow unbounded.
79+
if: github.event_name != 'pull_request'
80+
run: |
81+
du -sh ~/.cache/bazel-disk
82+
find ~/.cache/bazel-disk -type f ! -newer "$RUNNER_TEMP/job-start" -delete
83+
du -sh ~/.cache/bazel-disk
7484
- run: echo "🍏 This job's status is ${{ job.status }}."
7585

7686
# -- Start of Maven Conformance Tests (Ran only when there's version changes) --
@@ -92,12 +102,8 @@ jobs:
92102
if: steps.changed_file.outputs.any_changed == 'true'
93103
uses: bazel-contrib/setup-bazel@0.18.0
94104
with:
95-
# Avoid downloading Bazel every time.
96-
bazelisk-cache: true
97105
# Store build cache per workflow.
98106
disk-cache: ${{ github.workflow }}-${{ github.job }}
99-
# Share repository cache between workflows.
100-
repository-cache: true
101107
# Never write to the cache, strictly read-only
102108
cache-save: false
103109
- name: Verify Version Consistency

0 commit comments

Comments
 (0)