ci: rework GitHub caching strategy #3886
Merged
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.
I realised today that we are facing many cache misses in CI because we skip running workflows on
main
, and GitHub Actions caches only populate from the default branch or the current branch.So the vast majority of jobs will be cache misses until their branch is populated, because the default branch (
main
) runs nothing.This PR therefore reworks things in an attempt to put some oomph back into our build times:
main
just as they would in the merge queueSwatinem/rust-cache
, which shouldn't be necessary based on what it uses by default (job ID + OS + rust version)CI Cache Cleanup
workflow which is a direct copy of https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries, to eagerly purge branch caches when a PR gets merged or closed.save-if
setting toSwatinem/rust-cache
to avoid uploading caches from the merge queue, as that will produce a bulk of largely useless cache.If this looks like it builds, I'll probably merge it right away without review and hope it speeds up CI times. If it creates problems we can easily revert.