2020-09-25 16:42:39 +02:00
name : "Rust Cache"
2020-10-03 18:39:38 +02:00
description : "A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults."
2022-07-09 15:19:29 +02:00
author : "Arpad Borsos <swatinem@swatinem.de>"
2020-09-25 16:42:39 +02:00
inputs :
2022-10-18 16:05:42 -05:00
prefix-key :
2022-11-06 09:37:23 +01:00
description : "The prefix cache key, this can be changed to start a new cache manually."
2022-10-18 16:05:42 -05:00
required : false
default : "v0-rust"
2022-07-16 12:38:38 +02:00
shared-key :
2022-11-06 09:37:23 +01:00
description : "A cache key that is used instead of the automatic `job`-based key, and is stable over multiple jobs."
2022-07-16 12:38:38 +02:00
required : false
2020-09-25 16:42:39 +02:00
key :
2022-11-06 09:37:23 +01:00
description : "An additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs."
2020-09-25 16:42:39 +02:00
required : false
2025-11-03 21:24:00 +08:00
add-job-id-key :
description : "If the automatic `job`-based cache key should include the job id. Defaults to true."
required : false
default : "true"
add-rust-environment-hash-key :
description : "Weather the a hash of the rust environment should be included in the cache key. This includes a hash of all Cargo.toml/Cargo.lock files, rust-toolchain files, and .cargo/config.toml files (if present), as well as the specified 'env-vars'. Defaults to true."
required : false
default : "true"
2022-07-16 12:38:38 +02:00
env-vars :
2022-11-06 09:37:23 +01:00
description : "Additional environment variables to include in the cache key, separated by spaces."
2021-10-07 11:35:31 +09:00
required : false
2022-07-09 15:19:29 +02:00
workspaces :
2022-11-06 09:37:23 +01:00
description : "Paths to multiple Cargo workspaces and their target directories, separated by newlines."
2021-07-16 16:58:46 -04:00
required : false
2022-10-18 16:05:42 -05:00
cache-directories :
2022-11-06 09:37:23 +01:00
description : "Additional non workspace directories to be cached, separated by newlines."
2022-10-18 16:05:42 -05:00
required : false
cache-targets :
2022-11-06 09:37:23 +01:00
description : "Determines whether workspace targets are cached. If `false`, only the cargo registry will be cached."
2022-10-18 16:05:42 -05:00
required : false
default : "true"
2021-06-28 22:18:07 +01:00
cache-on-failure :
2022-11-06 09:37:23 +01:00
description : "Cache even if the build fails. Defaults to false."
2021-06-28 22:18:07 +01:00
required : false
2023-05-11 22:15:09 +01:00
cache-all-crates :
description : "Determines which crates are cached. If `true` all crates will be cached, otherwise only dependent crates will be cached."
required : false
default : "false"
2025-06-22 10:43:50 +02:00
cache-workspace-crates :
description : "Similar to cache-all-crates. If `true` the workspace crates will be cached."
required : false
default : "false"
2022-11-06 15:15:00 -03:00
save-if :
description : "Determiners whether the cache should be saved. If `false`, the cache is only restored."
required : false
default : "true"
2023-08-01 00:01:11 -07:00
cache-provider :
2026-06-06 13:55:47 +02:00
description : "Determines which provider to use for caching. Options are github, or warpbuild. Defaults to github."
2023-08-01 00:01:11 -07:00
required : false
default : "github"
2024-12-09 23:47:51 -08:00
cache-bin :
description : "Determines whether to cache ${CARGO_HOME}/bin."
required : false
default : "true"
2024-11-08 11:36:34 -08:00
lookup-only :
description : "Check if a cache entry exists without downloading the cache"
required : false
default : "false"
2025-12-01 19:56:12 +01:00
cmd-format :
description : "A format string used to format commands to be run, i.e. `rustc` and `cargo`."
required : false
default : "{0}"
2020-12-21 21:56:41 -05:00
outputs :
cache-hit :
2022-11-06 09:37:23 +01:00
description : "A boolean value that indicates an exact match was found."
2020-09-25 16:42:39 +02:00
runs :
2026-03-11 16:02:38 +09:00
using : "node24"
2026-06-06 13:55:47 +02:00
main : "dist/restore.js"
post : "dist/save.js"
2021-06-28 22:18:07 +01:00
post-if : "success() || env.CACHE_ON_FAILURE == 'true'"
2020-09-25 16:42:39 +02:00
branding :
icon : "archive"
color : "gray-dark"