actions-rust-lang/Setup Rust Toolchain for GitHub CI
Setup specific Rust versions with caching pre-configured. It provides problem matchers for cargo and rustfmt issues.
View on GitHubTrust Signals
- Scorecard Score
- not yet scored
- Maintenance Recency
- Activelast commit Jun 25, 2026
- License
- MIT
Pinned Snippet
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0tags can be moved; commit SHAs can't. why a SHA?
Inputs
| name | description | required | default |
|---|---|---|---|
| toolchain | Comma-separated list of Rust toolchain specifications. Last version becomes the default. -- see https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification | no | — |
| target | Target triple to install for this toolchain | no | — |
| components | Comma-separated list of components to be additionally installed | no | — |
| cache | Automatically configure Rust cache | no | true |
| cache-workspaces | Paths to multiple Cargo workspaces and their target directories, separated by newlines. | no | — |
| cache-directories | Additional non workspace directories to be cached, separated by newlines. | no | — |
| cache-on-failure | Cache even if the build fails. | no | true |
| cache-key | An additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs. | no | — |
| cache-shared-key | A cache key that is used instead of the automatic `job`-based key, and is stable over multiple jobs. | no | — |
| cache-bin | Determines whether to cache ${CARGO_HOME}/bin. | no | true |
| cache-provider | Determines which provider to use for caching. Options are github, buildjet, or warpbuild. Defaults to github. | no | github |
| cache-all-crates | Determines which crates are cached. If `true` all crates will be cached, otherwise only dependent crates will be cached. | no | false |
| cache-workspace-crates | Determines which crates are cached. If `true` all crates will be cached, otherwise only dependent crates will be cached. | no | false |
| cache-save-if | Determines whether the cache should be saved. If `false`, the cache is only restored. | no | true |
| cache-targets | Determines whether workspace targets are cached. If `false`, only the cargo registry will be cached. | no | true |
| matcher | Enable the Rust problem matcher | no | true |
| rustflags | set RUSTFLAGS environment variable, set to empty string to avoid overwriting build.rustflags | no | -D warnings |
| override | Setup the last installed toolchain as the default via `rustup override` | no | true |
| rust-src-dir | Specify path from root directory to the Rust source directory. By default root directory will be used. | no | — |
Outputs
| name | description |
|---|---|
| rustc-version | Version as reported by `rustc --version` |
| cargo-version | Version as reported by `cargo --version` |
| rustup-version | Version as reported by `rustup --version` |
| cachekey | A short hash of the rustc version, appropriate for use as a cache key. "20220627a831" |