{"id":21167722,"url":"https://github.com/actions-rust-lang/setup-rust-toolchain","last_synced_at":"2025-05-15T12:02:34.262Z","repository":{"id":48090996,"uuid":"482610590","full_name":"actions-rust-lang/setup-rust-toolchain","owner":"actions-rust-lang","description":"Setup a specific Rust toolchain with extra features like problem matchers","archived":false,"fork":false,"pushed_at":"2025-04-23T20:48:11.000Z","size":108,"stargazers_count":263,"open_issues_count":2,"forks_count":39,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-15T12:02:28.224Z","etag":null,"topics":["ci","github-actions","hacktoberfest","problem-matcher","rust","rust-lang","rustup","toolchain"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/actions-rust-lang.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-04-17T19:06:50.000Z","updated_at":"2025-05-14T23:16:24.000Z","dependencies_parsed_at":"2023-02-12T11:35:15.940Z","dependency_job_id":"bc49fd8c-d18f-4501-8575-107dae554d95","html_url":"https://github.com/actions-rust-lang/setup-rust-toolchain","commit_stats":{"total_commits":85,"total_committers":14,"mean_commits":6.071428571428571,"dds":0.3058823529411765,"last_synced_commit":"97db979bf844c838b06022f305ca480d01b4d5fe"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions-rust-lang%2Fsetup-rust-toolchain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions-rust-lang%2Fsetup-rust-toolchain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions-rust-lang%2Fsetup-rust-toolchain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions-rust-lang%2Fsetup-rust-toolchain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/actions-rust-lang","download_url":"https://codeload.github.com/actions-rust-lang/setup-rust-toolchain/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337612,"owners_count":22054253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci","github-actions","hacktoberfest","problem-matcher","rust","rust-lang","rustup","toolchain"],"created_at":"2024-11-20T15:01:12.266Z","updated_at":"2025-05-15T12:02:34.245Z","avatar_url":"https://github.com/actions-rust-lang.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Install Rust Toolchain\n\nThis GitHub Action installs a Rust toolchain using rustup.\nIt further integrates into the ecosystem.\nCaching for Rust tools and build artifacts is enabled.\nEnvironment variables are set to optimize the cache hits.\n[Problem Matchers] are provided for build messages (cargo, clippy) and formatting (rustfmt).\n\nThe action is heavily inspired by *dtolnay*'s \u003chttps://github.com/dtolnay/rust-toolchain\u003e and extends it with further features.\n\n## Example workflow\n\n```yaml\nname: \"Test Suite\"\non:\n  push:\n  pull_request:\n\njobs:\n  test:\n    name: cargo test\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions-rust-lang/setup-rust-toolchain@v1\n      - run: cargo test --all-features\n\n  # Check formatting with rustfmt\n  formatting:\n    name: cargo fmt\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      # Ensure rustfmt is installed and setup problem matcher\n      - uses: actions-rust-lang/setup-rust-toolchain@v1\n        with:\n          components: rustfmt\n      - name: Rustfmt Check\n        uses: actions-rust-lang/rustfmt@v1\n```\n\n## Inputs\n\nAll inputs are optional.\nIf a [toolchain file](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file) (i.e., `rust-toolchain` or `rust-toolchain.toml`) is found in the root of the repository and no `toolchain` value is provided, all items specified in the toolchain file will be installed.\nIf a `toolchain` value is provided, the toolchain file will be ignored.\nIf no `toolchain` value or toolchain file is present, it will default to `stable`.\nFirst, all items specified in the toolchain file are installed.\nAfterward, the `components` and `target` specified via inputs are installed in addition to the items from the toolchain file.\n\n| Name                | Description                                                                                                              | Default       |\n| ------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------- |\n| `toolchain`         | Comma-separated list of Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`.  The last version is the default. | stable        |\n| `target`            | Additional target support to install e.g. `wasm32-unknown-unknown`                                                       |               |\n| `components`        | Comma-separated string of additional components to install e.g. `clippy, rustfmt`                                        |               |\n| `cache`             | Automatically configure Rust cache (using [`Swatinem/rust-cache`])                                                       | true          |\n| `cache-directories` | Propagates the value to [`Swatinem/rust-cache`]                                                                          |               |\n| `cache-workspaces`  | Propagates the value to [`Swatinem/rust-cache`]                                                                          |               |\n| `cache-on-failure`  | Propagates the value to [`Swatinem/rust-cache`]                                                                          | true          |\n| `cache-key`         | Propagates the value to [`Swatinem/rust-cache`] as `key`                                                                 |               |\n| `cache-shared-key`  | Propagates the value to [`Swatinem/rust-cache`] as `shared-key`                                                          |               |\n| `cache-bin`         | Propagates the value to [`Swatinem/rust-cache`] as `cache-bin`                                                           | true          |\n| `matcher`           | Enable problem matcher to surface build messages and formatting issues                                                   | true          |\n| `rustflags`         | Set the value of `RUSTFLAGS` (set to empty string to avoid overwriting existing flags)                                   | \"-D warnings\" |\n| `override`          | Setup the last installed toolchain as the default via `rustup override`                                                  | true          |\n\n[`Swatinem/rust-cache`]: https://github.com/Swatinem/rust-cache\n\n### RUSTFLAGS\n\nBy default, this action sets the `RUSTFLAGS` environment variable to `-D warnings`.\nHowever, rustflags sources are mutually exclusive, so setting this environment variable omits any configuration through `target.*.rustflags` or `build.rustflags`.\n\n* If `RUSTFLAGS` is already set, no modifications of the variable are made and the original value remains.\n* If `RUSTFLAGS` is unset and the `rustflags` input is empty (i.e., the empty string), then it will remain unset.\n    Use this, if you want to prevent the value from being set because you make use of `target.*.rustflags` or `build.rustflags`.\n* Otherwise, the environment variable `RUSTFLAGS` is set to the content of `rustflags`.\n\nTo prevent this from happening, set the `rustflags` input to an empty string, which will\nprevent the action from setting `RUSTFLAGS` at all, keeping any existing preferences.\n\nYou can read more rustflags, and their load order, in the [Cargo reference].\n\n## Outputs\n\n| Name             | Description                                 |\n| ---------------- | ------------------------------------------- |\n| `rustc-version`  | Version as reported by `rustc --version`    |\n| `cargo-version`  | Version as reported by `cargo --version`    |\n| `rustup-version` | Version as reported by `rustup --version`   |\n| `cachekey`       | A short hash of the installed rustc version |\n\n## Dependencies\n\nThe action works best on the GitHub-hosted runners, but can work on self-hosted ones too, provided the necessary dependencies are available.\nPRs to add support for more environments are welcome.\n\n* bash 5\n* brew (macOS only)\n* rustup or curl\n* using other node actions\n\n## License\n\nThe scripts and documentation in this project are released under the [MIT\nLicense].\n\n[MIT License]: LICENSE\n[Problem Matchers]: https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md\n[Cargo reference]: https://doc.rust-lang.org/cargo/reference/config.html?highlight=unknown#buildrustflags\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factions-rust-lang%2Fsetup-rust-toolchain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factions-rust-lang%2Fsetup-rust-toolchain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factions-rust-lang%2Fsetup-rust-toolchain/lists"}