From e490492aa5fef558467cf39b7e8aa5356f991c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 17 Nov 2026 16:39:10 +0100 Subject: [PATCH] Fix #15229 (CI: we are running out of cache) Only save the ccache cache for push/scheduled runs. Pull requests restore the cache of their base branch but do not write their own entries, which filled the 10 GB repository cache and caused caches to be evicted. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/CI-mingw.yml | 2 ++ .github/workflows/CI-unixish-docker.yml | 4 ++++ .github/workflows/CI-unixish.yml | 16 ++++++++++++++++ .github/workflows/corpus.yml | 2 ++ .github/workflows/coverage.yml | 2 ++ .github/workflows/sanitizers.yml | 2 ++ .github/workflows/scriptcheck.yml | 2 ++ .github/workflows/selfcheck.yml | 2 ++ .github/workflows/valgrind.yml | 2 ++ 9 files changed, 34 insertions(+) diff --git a/.github/workflows/CI-mingw.yml b/.github/workflows/CI-mingw.yml index eb88a4a57fc..ac8d17704c4 100644 --- a/.github/workflows/CI-mingw.yml +++ b/.github/workflows/CI-mingw.yml @@ -52,6 +52,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} - name: Build cppcheck run: | diff --git a/.github/workflows/CI-unixish-docker.yml b/.github/workflows/CI-unixish-docker.yml index 94174689caa..7719fdb24a3 100644 --- a/.github/workflows/CI-unixish-docker.yml +++ b/.github/workflows/CI-unixish-docker.yml @@ -69,6 +69,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ matrix.image }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} - name: Run CMake run: | @@ -117,6 +119,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ matrix.image }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} # /usr/lib/ccache/bin - Alpine Linux diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index b739e008c26..b2031d5fab2 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -38,6 +38,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} - name: Install missing software on ubuntu if: contains(matrix.os, 'ubuntu') @@ -92,6 +94,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} # TODO: move latest compiler to separate step # TODO: bail out on warnings with latest GCC @@ -222,6 +226,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}-${{ matrix.cxxstd }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} - name: Install missing software on ubuntu if: contains(matrix.os, 'ubuntu') @@ -270,6 +276,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} # coreutils contains "nproc" - name: Install missing software on macos @@ -304,6 +312,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} # coreutils contains "nproc" - name: Install missing software on macos @@ -366,6 +376,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} - name: Run CMake on macOS (force Boost) run: | @@ -466,6 +478,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} - name: Install missing software on ubuntu if: contains(matrix.os, 'ubuntu') @@ -716,6 +730,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} - name: Install missing software on ubuntu run: | diff --git a/.github/workflows/corpus.yml b/.github/workflows/corpus.yml index d462222b268..71592bb8733 100644 --- a/.github/workflows/corpus.yml +++ b/.github/workflows/corpus.yml @@ -24,6 +24,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ runner.os }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} - name: Install missing software on ubuntu run: | diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index fd3b5063049..95791148741 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -29,6 +29,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ runner.os }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} - name: Install missing software on ubuntu run: | diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml index f7a0aa75201..5f11d80d847 100644 --- a/.github/workflows/sanitizers.yml +++ b/.github/workflows/sanitizers.yml @@ -58,6 +58,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}-${{ matrix.sanitizer }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} - name: Set up Python uses: actions/setup-python@v6 diff --git a/.github/workflows/scriptcheck.yml b/.github/workflows/scriptcheck.yml index 35efc35ca1b..d01915c6ea6 100644 --- a/.github/workflows/scriptcheck.yml +++ b/.github/workflows/scriptcheck.yml @@ -29,6 +29,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ runner.os }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} - name: Cache Cppcheck uses: actions/cache@v5 diff --git a/.github/workflows/selfcheck.yml b/.github/workflows/selfcheck.yml index 77d6d1bc483..26d83c2f406 100644 --- a/.github/workflows/selfcheck.yml +++ b/.github/workflows/selfcheck.yml @@ -32,6 +32,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ runner.os }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} - name: Install missing software run: | diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index 44f762030c3..ca5180e1687 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -29,6 +29,8 @@ jobs: uses: hendrikmuhs/ccache-action@v1.2.24 with: key: ${{ github.workflow }}-${{ runner.os }} + # only save cache in main/release branches, PRs restore the cache of the base branch + save: ${{ github.event_name != 'pull_request' }} - name: Install missing software run: |