Repository navigation
Prune older ccaches in a dedicated workflow - #304
Merged
Merged
Conversation
Each push to main saved a new copy of every ccache, pushing the repository past its 10 GB cache limit. A shared composite action now keeps only the newest cache per key prefix on the current ref. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the prune job now holds actions: write. The build jobs, which run third-party actions and downloaded dependencies, keep the repository's read-only default token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a
Prune Cachesworkflow (.github/workflows/prune-caches.yml) that deletes older ccaches, keeping only the newest per key prefix and ref. No existing workflow changes.<prefix>-ccache-<run_id>, because cache entries are immutable. Restores only read the newest one.mainsaves about 3.3 GB across all workflows, and old copies stay until they go 7 days unused. The repo reached 12.0 GB, and GitHub's eviction has since trimmed it to 10.1 GB. Over the limit, eviction can also drop PR caches and fresh entries, undoing the warm builds from Fix stale ccache keys and slow Debug CI tests #301 and Build Windows Debug CI with /O2 /Ob1 #302.Mechanism:
workflow_run(completed) ofBuild,Python,Coverage,CUDA,DocsandODR Check, plus a dailyscheduleandworkflow_dispatch.-ccache-[0-9]+$only, so PantheonSim's toolkit cache is untouched), and deletes all but the newest in each group.concurrency: prune-cachescollapses a burst of triggers into one running and one pending run.Security
actions: write. The build jobs keep the repo's read-only default token.SimenB/github-actions-cpu-cores@v2,ilammy/msvc-dev-cmd@v1,Jimver/cuda-toolkit,codecov/codecov-action,JamesIves/github-pages-deploy-action) and compile dependencies downloaded through CPM. Withactions: write, compromised code there could delete caches and logs, cancel runs, or dispatchdocs.yml, which deploys togh-pageswithout approval.gh, so PR code never sees its token, including when a fork's PR triggersworkflow_run.Impact:
--jqquery against the current caches deletes 44 older copies (6.0 GB) and keeps 29 ccaches plus PantheonSim's, leaving about 4.1 GB.Type of change
How Has This Been Tested?
gh cache list --jqquery (gh's built-in jq) against the live cache list: 44 deletions, 43 onmainand 1 onrefs/pull/184/merge, with the newest kept in each of the 29 groups.workflow_runnames match thename:of all six workflows.workflow_run,scheduleandworkflow_dispatchonly use the workflow file from the default branch, so this can't run before merge. After merge, it runs on the next CI completion or by manual dispatch.Checklist