A GitHub Action that implements smart caching for rust/cargo projects
Go to file
2020-10-03 18:10:54 +02:00
.github initial commit 2020-09-26 23:48:29 +02:00
dist merge the registry caches together 2020-10-03 18:10:54 +02:00
src merge the registry caches together 2020-10-03 18:10:54 +02:00
.gitignore initial commit 2020-09-26 23:48:29 +02:00
action.yml initial commit 2020-09-26 23:48:29 +02:00
CHANGELOG.md Improve target pruning 2020-09-29 12:30:19 +02:00
package-lock.json 1.0.2 2020-09-29 12:30:45 +02:00
package.json 1.0.2 2020-09-29 12:30:45 +02:00
README.md merge the registry caches together 2020-10-03 18:10:54 +02:00
tsconfig.json initial commit 2020-09-26 23:48:29 +02:00

Rust Cache Action

A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults.

Example usage

- uses: Swatinem/rust-cache@v1

Registry Cache

  • ~/.cargo/registry/index
  • ~/.cargo/registry/cache

This cache is automatically keyed by hashing the Cargo.lock / Cargo.toml files. Before persisting, the cache is cleaned of intermediate artifacts and unneeded dependencies.

TODO: The ~/.cargo/git/db database is not yet persisted, support will be added at a later point.

Target Cache

  • ./target

This cache is automatically keyed by:

  • the github job,
  • the rustc release / host / hash, and
  • a hash of the Cargo.lock / Cargo.toml files.

Before persisting, the cache is cleaned of anything that is not a needed dependency. In particular, no caching of workspace crates will be done. For this reason, this action will automatically set CARGO_INCREMENTAL=0 to disable incremental compilation.