ci(caching): make caching more effective #3215
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.
Description
Currently, we create a new cache for each workflow run for each crate. That ends up blowing the maximum allowed cache size of 10GB and GitHub deletes the least-recently used cache again. Effectively, this means we don't have any caching.
This patch introduces a cache factory workflow that only runs on master and always saves a new cache. The CI workflow run for pull-requests on the other hand only restore these caches but don't save them.
Notes
Here is an example of a cache factory run: https://github.com/thomaseizinger/rust-libp2p/actions/runs/3672495214
With the new configuration, the
libp2p-core
job finishes in about 5 minutes: https://github.com/thomaseizinger/rust-libp2p/actions/runs/3672680646/jobs/6209084632.With the old configuration, the same job takes about 13 minutes: https://github.com/libp2p/rust-libp2p/actions/runs/3651158690/jobs/6168039236
A good chunk of those 5 minutes is still used up by cargo semver-checks which will hopefully improve further but overall, these are already massive savings in computing time :)
Links to any relevant issues
Open Questions
Change checklist