-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Leafwing-Studios/cargo-cache in CI #13040
Conversation
Add a concurrency group, disable fail-fast, and install dependencies on Linux.
You might be interested in this: https://github.com/Leafwing-Studios/cargo-cache It uses a the hash of the updated lock file instead of the current date to calculate the hash key, also with several levels of fallbacks. Honestly, debugging caching actions and figuring out why cargo keeps recompiling dependencies is super annoying, I hope that you'll get it to work! |
Thank you! I'll definitely take inspiration from that. I chose not to hash the lockfile because I figured that the amount of dependency change in 1 day cannot be so great that it would hurt performance, but that assumption will definitely require testing. It's good to see an alternate approach, though! |
Actually export cache keys to Github output, only use a cache when not in a merge group, customize Rust installation for WASM, and use proper command for docs.
Also split it out into a separate job.
This should hopefully speed up the doc job by ~3 minutes. Since `cargo test` needs to build the entire workspace but `cargo doc` only needs to check it, `cargo doc` can take advantage of the work that `cargo test` has already done.
A few other driveby fixes too. I removed the unecessary `components: rustfmt, clippy` specification. I also made the doc job use nightly Rust.
This bug caused the cache to never be restored.
This is a just in case, and likely will never become a problem. Github's cache isolation policy prevents caches created in merge queues from being used by any other branch.
So far things are working well. I'm having some issues with the cache not being found, so I may have to move my testing over to my fork, where I can actually delete caches and cancel runs. Building on MacOS and docs are the two longest jobs. I'm going to see if I can shorten their duration, if possible. |
This may prove easier to setup and maintain than the homespun implementation used earlier.
Following @TimJentzsch's interesting link, I've decided to switch this PR to use Leafwing-Studios/cargo-cache for everything. I think it's a lot more maintainable than my custom solution (and it's easy to use, too!). Performance seems roughly the same, except for |
Previously attempted in #7627, but the action has also improved since then |
Is there a reason the original PR was closed? |
If / when this gets merged, it would be good to wipe all of the existing caches here. This will make the migration a little quicker, and hopefully show the performance improvements sooner. |
Swapping to Controversial; I want to get Francois's sign-off here. |
Update to the newly released |
We can now do this via the - uses: Leafwing-Studios/cargo-cache@v2
with:
save-if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} |
Done! @mockersf, could you please review this? You're the last step before this can be merged :) |
I was waiting for my previous review to be addressed! Now unless there's an urgent need I'll do it after the Jam 🙂 |
Closing due to inactivity. If someone wants to adopt this, feel free! |
Objective
~/.cargo
andtarget
folders, to take advantage of faster, incremental, compilation.actions/cache@v4
step. It will always sayCache not found for input keys: ...
.Solution
main
can be used by any feature branch, but a cache created byfeature-a
branch cannot be used by the unrelatedfeature-b
branch.Changelog