cargo
cargo copied to clipboard
Cache target directory between runs
Motivation
Building a Rust project takes a lot of time if many dependencies are involved. In my case I have >2 minutes build time, of which only a few seconds are from my own crates. This could be greatly reduced by caching the target directory with the dependency cache.
Workflow example
steps:
- name: Cargo check
uses: actions-rs/cargo@v2
with:
command: check
use-cache: true # cache the target directory between runs
Additional context
The action is actions/cache.
There is an example on how to use it for the .cargo directory. Employing that example prevents cargo from redownloading all the crates on every run, but it still recompiles them.
Hi, cache not work in my workflow either, what's the status of this issue? Does the use-cache config in the example above work now?
Adding myself to the list of interested users.
I found this repository while looking for a simple way to add caching to my crate's CI. I would absolutely adopt this action if caching were implemented.
For folks looking for a solution, there is: https://github.com/Swatinem/rust-cache