Cargo-cache 0.3.4: faster $CARGO_HOME caching on CI

Hello fellow rustaceans!
I have released a small update to cargo-cache, a tool that lets you manage your local cargo home, the download cache of all the crates that cargo downloads before a build.

There are not a lot of changes in this release.
I fixed a panic of cargo cache local on crates with workspaces but also added a new feature for cleaning the cargo cache before caching it on a CI server.

For those wanting to cache the $CARGO_HOME, on continuous integration,
I have added a ci-autoclean feature that skips most dependencies by stripping away most of the crates functionality that is not needed in this case.
This reduces the time needed to install to < 10 seconds on my system (in release mode!).
In order to save time and space when caching the $CARGO_HOME on CI, you can omit duplicate data before caching the directory.
The binary automatically runs cargo-cache --autoclean when executed and that's everything it can do.
This will remove git repos that have been checked out, as well as extracted .crate archive sources,
leaving the original bare git repos, installed binaries and .crate archives in the cargo home for caching.
Without this step, we would have duplicate data, for example
as well as the extracted sources in
There is no need to compress, upload, download and extract both of these every time the CI runs.

cargo-cache does not do the caching between CI-runs itself though, you still have to set that up with whatever methods your CI-system provides.

To install cargo-cache and perform the cache pruning on ci, simply add the following commands to your CI config:

cargo install cargo-cache --no-default-features --features ci-autoclean

cargo-cache on github
cargo-cache on
changelog on github

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.