Skip to content

Commit fdc1942

Browse files
danmarclaude
andauthored
Fix #15229 (CI: we are running out of cache) (cppcheck-opensource#9041)
The repository Actions cache is above its 10 GB limit (~10.9 GB). Most of it is ccache entries written by pull requests (~330 MB per docker image, ~150 MB per cmake configuration, several per push). Caches evict each other, so many jobs get 0% ccache hits and the scriptcheck binary cache was evicted before the test jobs could restore it. With this change `hendrikmuhs/ccache-action` only saves the cache when the run is not a pull request (push to main/release branches, scheduled runs). Pull requests still restore the cache of the base branch, so they keep getting cache hits without writing their own entries. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 05ff791 commit fdc1942

9 files changed

Lines changed: 34 additions & 0 deletions

File tree

‎.github/workflows/CI-mingw.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ jobs:
5252
uses: hendrikmuhs/ccache-action@v1.2.24
5353
with:
5454
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
55+
# only save cache in main/release branches, PRs restore the cache of the base branch
56+
save: ${{ github.event_name != 'pull_request' }}
5557

5658
- name: Build cppcheck
5759
run: |

‎.github/workflows/CI-unixish-docker.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ jobs:
6969
uses: hendrikmuhs/ccache-action@v1.2.24
7070
with:
7171
key: ${{ github.workflow }}-${{ matrix.image }}
72+
# only save cache in main/release branches, PRs restore the cache of the base branch
73+
save: ${{ github.event_name != 'pull_request' }}
7274

7375
- name: Run CMake
7476
run: |
@@ -117,6 +119,8 @@ jobs:
117119
uses: hendrikmuhs/ccache-action@v1.2.24
118120
with:
119121
key: ${{ github.workflow }}-${{ matrix.image }}
122+
# only save cache in main/release branches, PRs restore the cache of the base branch
123+
save: ${{ github.event_name != 'pull_request' }}
120124

121125
# /usr/lib/ccache/bin - Alpine Linux
122126

‎.github/workflows/CI-unixish.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
uses: hendrikmuhs/ccache-action@v1.2.24
3939
with:
4040
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
41+
# only save cache in main/release branches, PRs restore the cache of the base branch
42+
save: ${{ github.event_name != 'pull_request' }}
4143

4244
- name: Install missing software on ubuntu
4345
if: contains(matrix.os, 'ubuntu')
@@ -92,6 +94,8 @@ jobs:
9294
uses: hendrikmuhs/ccache-action@v1.2.24
9395
with:
9496
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
97+
# only save cache in main/release branches, PRs restore the cache of the base branch
98+
save: ${{ github.event_name != 'pull_request' }}
9599

96100
# TODO: move latest compiler to separate step
97101
# TODO: bail out on warnings with latest GCC
@@ -222,6 +226,8 @@ jobs:
222226
uses: hendrikmuhs/ccache-action@v1.2.24
223227
with:
224228
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}-${{ matrix.cxxstd }}
229+
# only save cache in main/release branches, PRs restore the cache of the base branch
230+
save: ${{ github.event_name != 'pull_request' }}
225231

226232
- name: Install missing software on ubuntu
227233
if: contains(matrix.os, 'ubuntu')
@@ -270,6 +276,8 @@ jobs:
270276
uses: hendrikmuhs/ccache-action@v1.2.24
271277
with:
272278
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
279+
# only save cache in main/release branches, PRs restore the cache of the base branch
280+
save: ${{ github.event_name != 'pull_request' }}
273281

274282
# coreutils contains "nproc"
275283
- name: Install missing software on macos
@@ -304,6 +312,8 @@ jobs:
304312
uses: hendrikmuhs/ccache-action@v1.2.24
305313
with:
306314
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
315+
# only save cache in main/release branches, PRs restore the cache of the base branch
316+
save: ${{ github.event_name != 'pull_request' }}
307317

308318
# coreutils contains "nproc"
309319
- name: Install missing software on macos
@@ -366,6 +376,8 @@ jobs:
366376
uses: hendrikmuhs/ccache-action@v1.2.24
367377
with:
368378
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
379+
# only save cache in main/release branches, PRs restore the cache of the base branch
380+
save: ${{ github.event_name != 'pull_request' }}
369381

370382
- name: Run CMake on macOS (force Boost)
371383
run: |
@@ -466,6 +478,8 @@ jobs:
466478
uses: hendrikmuhs/ccache-action@v1.2.24
467479
with:
468480
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
481+
# only save cache in main/release branches, PRs restore the cache of the base branch
482+
save: ${{ github.event_name != 'pull_request' }}
469483

470484
- name: Install missing software on ubuntu
471485
if: contains(matrix.os, 'ubuntu')
@@ -716,6 +730,8 @@ jobs:
716730
uses: hendrikmuhs/ccache-action@v1.2.24
717731
with:
718732
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
733+
# only save cache in main/release branches, PRs restore the cache of the base branch
734+
save: ${{ github.event_name != 'pull_request' }}
719735

720736
- name: Install missing software on ubuntu
721737
run: |

‎.github/workflows/corpus.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
uses: hendrikmuhs/ccache-action@v1.2.24
2525
with:
2626
key: ${{ github.workflow }}-${{ runner.os }}
27+
# only save cache in main/release branches, PRs restore the cache of the base branch
28+
save: ${{ github.event_name != 'pull_request' }}
2729

2830
- name: Install missing software on ubuntu
2931
run: |

‎.github/workflows/coverage.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
uses: hendrikmuhs/ccache-action@v1.2.24
3030
with:
3131
key: ${{ github.workflow }}-${{ runner.os }}
32+
# only save cache in main/release branches, PRs restore the cache of the base branch
33+
save: ${{ github.event_name != 'pull_request' }}
3234

3335
- name: Install missing software on ubuntu
3436
run: |

‎.github/workflows/sanitizers.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ jobs:
5858
uses: hendrikmuhs/ccache-action@v1.2.24
5959
with:
6060
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}-${{ matrix.sanitizer }}
61+
# only save cache in main/release branches, PRs restore the cache of the base branch
62+
save: ${{ github.event_name != 'pull_request' }}
6163

6264
- name: Set up Python
6365
uses: actions/setup-python@v6

‎.github/workflows/scriptcheck.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
uses: hendrikmuhs/ccache-action@v1.2.24
3030
with:
3131
key: ${{ github.workflow }}-${{ runner.os }}
32+
# only save cache in main/release branches, PRs restore the cache of the base branch
33+
save: ${{ github.event_name != 'pull_request' }}
3234

3335
- name: Cache Cppcheck
3436
uses: actions/cache@v5

‎.github/workflows/selfcheck.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
uses: hendrikmuhs/ccache-action@v1.2.24
3333
with:
3434
key: ${{ github.workflow }}-${{ runner.os }}
35+
# only save cache in main/release branches, PRs restore the cache of the base branch
36+
save: ${{ github.event_name != 'pull_request' }}
3537

3638
- name: Install missing software
3739
run: |

‎.github/workflows/valgrind.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
uses: hendrikmuhs/ccache-action@v1.2.24
3030
with:
3131
key: ${{ github.workflow }}-${{ runner.os }}
32+
# only save cache in main/release branches, PRs restore the cache of the base branch
33+
save: ${{ github.event_name != 'pull_request' }}
3234

3335
- name: Install missing software
3436
run: |

0 commit comments

Comments
 (0)