CI caching tool: cargo-ci-precache

This is the first release of cargo-ci-precache, a tool for minimizing the cache size for CI runs. See README for github actions setup.

The main advantage of this tool over other options is the ability to detect which features are enabled, and which version of each dependency is used. This allows restoring a cache made with old dependencies or features and then removing anything not used by the current build.


  • Cleans $CARGO_HOME of unused dependencies. (specifically git/db and registry/cache)
  • Cleans the target folder of unused build files, specifically:
    • Local packages
    • Unused packages
    • Outdated packages
    • Packages with outdated features
    • Anything which depends on the above
  • Filtering based on the target platform
  • Setting which features are enabled

Still to do:

  • Allow multiple feature combinations. Currently only one is allowed.
  • For workspaces, allow per package features. Currently limited by what can be set on cargo metadata.
  • A better way to detect changes to enabled features. Currently done by hashing Cargo.toml, but this is a little over zealous.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.