mirror of
https://github.com/Swatinem/rust-cache
synced 2026-06-26 02:00:35 +00:00
Add source-keyed target cache
This commit is contained in:
parent
c106961fee
commit
c020f6afef
12 changed files with 420 additions and 141 deletions
16
README.md
16
README.md
|
|
@ -76,6 +76,14 @@ sensible defaults.
|
|||
# default: "false"
|
||||
cache-workspace-crates: ""
|
||||
|
||||
# An additional key for source-keyed target caching.
|
||||
# When set together with `cache-targets` and `cache-workspace-crates`,
|
||||
# workspace target directories are cached separately from CARGO_HOME using
|
||||
# this key. This allows rebuilt workspace artifacts to be saved under a new
|
||||
# source key while preserving the normal dependency cache behavior.
|
||||
# default: empty
|
||||
target-key: ""
|
||||
|
||||
# Determines whether the cache should be saved.
|
||||
# If `false`, the cache is only restored.
|
||||
# Useful for jobs where the matrix is additive e.g. additional Cargo features,
|
||||
|
|
@ -173,6 +181,14 @@ to recreate it from the compressed crate archives in `~/.cargo/registry/cache`.
|
|||
The action will try to restore from a previous `Cargo.lock` version as well, so
|
||||
lockfile updates should only re-build changed dependencies.
|
||||
|
||||
When `target-key` is set together with `cache-targets` and
|
||||
`cache-workspace-crates`, workspace target directories are restored after the
|
||||
normal CARGO_HOME cache and saved as a separate source-keyed cache. This is useful
|
||||
for workflows that deliberately cache workspace crates and can provide a stable
|
||||
source fingerprint, for example `${{ hashFiles('src/**', 'Cargo.toml') }}`.
|
||||
The target cache still restores from older target caches via restore prefixes,
|
||||
but exact source matches can become Cargo no-ops across repeated runs.
|
||||
|
||||
The action invokes `cargo metadata` to determine the current set of dependencies.
|
||||
|
||||
Additionally, the action automatically works around
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue