{"id":13503326,"url":"https://github.com/actions-rs/toolchain","last_synced_at":"2025-10-18T08:31:00.724Z","repository":{"id":35479147,"uuid":"208060770","full_name":"actions-rs/toolchain","owner":"actions-rs","description":"🛠️ GitHub Action for `rustup` commands","archived":true,"fork":false,"pushed_at":"2023-06-18T05:26:38.000Z","size":2565,"stargazers_count":592,"open_issues_count":57,"forks_count":94,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-01-28T13:01:44.651Z","etag":null,"topics":["cargo","github","github-actions","rust","rust-lang","rustup","setup-rust","toolchain"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/rust-toolchain","language":"TypeScript","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-rs.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}},"created_at":"2019-09-12T13:43:05.000Z","updated_at":"2025-01-24T09:42:09.000Z","dependencies_parsed_at":"2024-06-18T10:43:47.440Z","dependency_job_id":"0d5697ca-1a6b-4e1b-ad79-19c72cacb256","html_url":"https://github.com/actions-rs/toolchain","commit_stats":{"total_commits":54,"total_committers":11,"mean_commits":4.909090909090909,"dds":0.5740740740740741,"last_synced_commit":"88dc2356392166efad76775c878094f4e83ff746"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions-rs%2Ftoolchain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions-rs%2Ftoolchain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions-rs%2Ftoolchain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions-rs%2Ftoolchain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/actions-rs","download_url":"https://codeload.github.com/actions-rs/toolchain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236920283,"owners_count":19225710,"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":["cargo","github","github-actions","rust","rust-lang","rustup","setup-rust","toolchain"],"created_at":"2024-07-31T22:02:46.562Z","updated_at":"2025-10-18T08:30:55.689Z","avatar_url":"https://github.com/actions-rs.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","六、编程语言与工具专属Action"],"sub_categories":["8. 环境配置"],"readme":"# `rust-toolchain` Action\n\n[![Sponsoring](https://img.shields.io/badge/Support%20it-Say%20%22Thank%20you!%22-blue)](https://actions-rs.github.io/#sponsoring)\n![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)\n[![Gitter](https://badges.gitter.im/actions-rs/community.svg)](https://gitter.im/actions-rs/community)\n![Continuous integration](https://github.com/actions-rs/toolchain/workflows/Continuous%20integration/badge.svg)\n![Dependabot enabled](https://api.dependabot.com/badges/status?host=github\u0026repo=actions-rs/toolchain)\n\nThis GitHub Action installs [Rust toolchain](https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification)\nwith [rustup](https://github.com/rust-lang/rustup) help.\n\nIt supports additional targets, components and profiles and handles all\nthese small papercuts for you.\n\n**Table of Contents**\n\n* [Example workflow](#example-workflow)\n* [Inputs](#inputs)\n* [Outputs](#outputs)\n* [Profiles](#profiles)\n* [Components](#components)\n* [The toolchain file](#the-toolchain-file)\n* [License](#license)\n* [Contribute and support](#contribute-and-support)\n\n## Example workflow\n\n```yaml\non: [push]\n\nname: build\n\njobs:\n  check:\n    name: Rust project\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - name: Install latest nightly\n        uses: actions-rs/toolchain@v1\n        with:\n            toolchain: nightly\n            override: true\n            components: rustfmt, clippy\n\n      # `cargo check` command here will use installed `nightly`\n      # as it is set as an \"override\" for current directory\n\n      - name: Run cargo check\n        uses: actions-rs/cargo@v1\n        with:\n          command: check\n```\n\nSee [additional recipes here](https://github.com/actions-rs/meta).\n\n## Inputs\n\n| Name         | Required | Description                                                                                                                                         | Type   | Default |\n| ------------ | :------: | ----------------------------------------------------------------------------------------------------------------------------------------------------| ------ | --------|\n| `toolchain`  |          | [Toolchain](https://github.com/rust-lang/rustup.rs#toolchain-specification) name to use, ex. `stable`, `nightly`, `nightly-2019-04-20`, or `1.32.0` | string | stable  |\n| `target`     |          | Additionally install specified target for this toolchain, ex. `x86_64-apple-darwin`                                                                 | string |         |\n| `default`    |          | Set installed toolchain as a default toolchain                                                                                                      | bool   | false   |\n| `override`   |          | Set installed toolchain as an override for the current directory                                                                                    | bool   | false   |\n| `profile`    |          | Execute `rustup set profile {value}` before installing the toolchain, ex. `minimal`                                                                 | string | default |\n| `components` |          | Comma-separated list of the additional components to install, ex. `clippy, rustfmt`                                                                 | string |         |\n\nNote: since `v1.0.4` version, `toolchain` input is not marked as required\nin order to support toolchain files. See the details [below](#the-toolchain-file).\n\n## Outputs\n\nInstalled `rustc`, `cargo` and `rustup` versions can be fetched from the Action outputs:\n\n| Name         | Description           | Example                         |\n| ------------ | --------------------- | ------------------------------- |\n| `rustc`      | Rustc version         | `1.40.0 (73528e339 2019-12-16)` |\n| `rustc_hash` | Rustc version hash    | `73528e339`                     |\n| `cargo`      | Cargo version         | `1.40.0 (bc8e4c8be 2019-11-22)` |\n| `rustup`     | rustup version        | `1.21.1 (7832b2ebe 2019-12-20)` |\n\nNote: `rustc_hash` output value can be used with [actions/cache](https://github.com/actions/cache) Action\nto store cache for different Rust versions, as it is unique across different Rust versions and builds (including `nightly`).\n\n## Profiles\n\nThis Action supports rustup [profiles](https://blog.rust-lang.org/2019/10/15/Rustup-1.20.0.html#profiles),\nwhich are can be used to speed up the workflow execution by installing the\nminimally required set of components, for example:\n\n```yaml\n- name: Install minimal nightly\n  uses: actions-rs/toolchain@v1\n  with:\n    profile: minimal\n    toolchain: nightly\n```\n\nThis Action will automatically run `rustup self update` if `profile` input is set\nand the installed `rustup` version does not supports them.\n\nIn order to provide backwards compatibility for `v1` version,\nthere is no value for `profile` input set by default,\nwhich means that the `default` profile is used by `rustup`\n(and that includes `rust-docs`, `clippy` and `rustfmt`).\\\nYou may want to consider using `profile: minimal` to speed up toolchain installation.\n\n## Components\n\nThis Action supports rustup [components](https://blog.rust-lang.org/2019/10/15/Rustup-1.20.0.html#installing-the-latest-compatible-nightly) too,\nand in combination with the [profiles](#profiles) input it allows to install only the needed components:\n\n```yaml\n- name: Install minimal stable with clippy and rustfmt\n  uses: actions-rs/toolchain@v1\n  with:\n    profile: minimal\n    toolchain: stable\n    components: rustfmt, clippy\n```\n\nAs an extra perk, `rustup \u003e= 1.20.0` is able to find the most recent `nightly` toolchain\nwith the requested components available; next example is utilizing this feature\nto install the minimal set of `nightly` toolchain components with the `rustfmt` and `clippy` extras:\n\n```yaml\n- name: Install minimal nightly with clippy and rustfmt\n  uses: actions-rs/toolchain@v1\n  with:\n    profile: minimal\n    toolchain: nightly\n    components: rustfmt, clippy\n```\n\nIn case if `nightly` toolchain is requested and one of the components is missing in\nlatest `nightly` release, this Action will attempt the downgrade till it find\nthe most recent `nightly` with all components needed.\\\nNote that this behavior will work only if the following two conditions apply:\n\n 1. `toolchain` input is `nightly` exactly.\n 2. At least one component is provided in `components` input.\n\nSame to the `profile` input, if installed `rustup` does not supports \"components\",\nit will be automatically upgraded by this Action.\n\n## The toolchain file\n\nThis Action supports [toolchain files](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file),\nso it is not necessary to use `toolchain` input anymore.\n\nInput has higher priority, so if you are want to use toolchain file,\nyou need to remove the input from the workflow file.\n\nIf neither `toolchain` input or `rust-toolchain` file are provided,\nAction execution will fail.\n\n## License\n\nThis Action is distributed under the terms of the MIT license, see [LICENSE](https://github.com/actions-rs/toolchain/blob/master/LICENSE) for details.\n\n## Contribute and support\n\nAny contributions are welcomed!\n\nIf you want to report a bug or have a feature request,\ncheck the [Contributing guide](https://github.com/actions-rs/.github/blob/master/CONTRIBUTING.md).\n\nYou can also support author by funding the ongoing project work,\nsee [Sponsoring](https://actions-rs.github.io/#sponsoring).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factions-rs%2Ftoolchain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factions-rs%2Ftoolchain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factions-rs%2Ftoolchain/lists"}