2020-09-25 22:42:39 +08:00
|
|
|
# Rust Cache Action
|
|
|
|
|
2020-10-04 00:10:54 +08:00
|
|
|
A GitHub Action that implements smart caching for rust/cargo projects with
|
|
|
|
sensible defaults.
|
2020-09-25 22:42:39 +08:00
|
|
|
|
|
|
|
## Example usage
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
- uses: Swatinem/rust-cache@v1
|
|
|
|
```
|
|
|
|
|
2020-10-04 00:39:38 +08:00
|
|
|
### Cache Details
|
|
|
|
|
|
|
|
The cache currently caches the following directories:
|
2020-09-25 22:42:39 +08:00
|
|
|
|
2020-10-04 00:10:54 +08:00
|
|
|
- `~/.cargo/registry/index`
|
|
|
|
- `~/.cargo/registry/cache`
|
|
|
|
- `./target`
|
2020-09-25 22:42:39 +08:00
|
|
|
|
2020-10-04 00:10:54 +08:00
|
|
|
This cache is automatically keyed by:
|
2020-09-25 22:42:39 +08:00
|
|
|
|
2020-10-04 00:10:54 +08:00
|
|
|
- the github `job`,
|
|
|
|
- the rustc release / host / hash, and
|
|
|
|
- a hash of the `Cargo.lock` / `Cargo.toml` files.
|
2020-09-25 22:42:39 +08:00
|
|
|
|
2020-10-04 00:39:38 +08:00
|
|
|
An additional input `key` can be provided if the builtin keys are not sufficient.
|
|
|
|
|
|
|
|
Before persisting, the cache is cleaned of intermediate artifacts and
|
|
|
|
anything that is not a workspace dependency.
|
|
|
|
In particular, no caching of workspace crates will be done. For
|
2020-10-04 00:10:54 +08:00
|
|
|
this reason, this action will automatically set `CARGO_INCREMENTAL=0` to
|
|
|
|
disable incremental compilation.
|
2020-10-04 00:39:38 +08:00
|
|
|
|
|
|
|
**TODO**: The `~/.cargo/git/db` database is not yet persisted, support will be
|
|
|
|
added at a later point.
|