From 785778dcfc2d038799e8fe15453bb427a43ca8c7 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 16 Oct 2026 13:38:03 +0200 Subject: [PATCH] CI: Store ccache only from branch runs A pull request's ccache entries can be restored only by later runs of the same pull request, and those rarely exist: 26 of the 35 pull requests tested since 2026-10-15 had a single CI run. Even then, master's cache, which every first run restores, already gives 97-99% ccache hits. So these entries, 9.4 of the 10.6 GB in the repository's Actions cache, serve almost nobody. Store the cache only from branch runs: pushes to master and stable-*, and the nightly schedule. Pull request runs keep restoring their base branch's cache through the existing fallback key; one that changes build rules or widely included headers now recompiles those parts on each push. Tag runs stop storing as well, since no other ref can restore their caches either. Assisted-by: Generative AI --- .github/workflows/CI.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1b982d43e1..44b48012da 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -232,12 +232,16 @@ jobs: python -m pip install gcovr # Setup ccache, to speed up repeated compilation of the same binaries - # (i.e., GAP and the packages) + # (i.e., GAP and the packages). Only branch runs store the cache: a PR + # or tag cache is restorable only by later runs of that same ref, which + # rarely exist. PRs restore their base branch's cache via the fallback + # key. - name: "Setup ccache" if: ${{ runner.os != 'Windows' }} uses: Chocobo1/setup-ccache-action@v1 with: update_packager_index: false + store_cache: ${{ startsWith(github.ref, 'refs/heads/') }} override_cache_key: ${{ runner.os }}-${{ hashFiles('extra.flags') }}-${{ github.ref }} override_cache_key_fallback: ${{ runner.os }}-${{ hashFiles('extra.flags') }} - name: "Workaround GitHub security concerns" # see https://github.com/gap-system/gap/issues/4861