|
| 1 | +# Install Rust Toolchain |
| 2 | + |
| 3 | +This GitHub Action installs a Rust toolchain using rustup. |
| 4 | +It further integrates into the ecosystem. |
| 5 | +Caching for Rust tools and build artifacts is enabled. |
| 6 | +Environment variables are set to optimize the cache hits. |
| 7 | +[Problem Matchers] are provided for build messages (cargo, clippy) and formatting (rustfmt). |
| 8 | + |
| 9 | +The action is heavily inspired by *dtolnay*'s <https://github.com/dtolnay/rust-toolchain> and extends it with further features. |
| 10 | + |
| 11 | +## Example workflow |
| 12 | + |
| 13 | +```yaml |
| 14 | +name: "Test Suite" |
| 15 | +on: |
| 16 | + push: |
| 17 | + pull_request: |
| 18 | + |
| 19 | +jobs: |
| 20 | + test: |
| 21 | + name: cargo test |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v3 |
| 25 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 26 | + - run: cargo test --all-features |
| 27 | +``` |
| 28 | +
|
| 29 | +## Inputs |
| 30 | +
|
| 31 | +All inputs are optional. |
| 32 | +
|
| 33 | +| Name | Description | Default | |
| 34 | +| ------------ | --------------------------------------------------------------------------------- | ------- | |
| 35 | +| `toolchain` | Rustup toolchain specifier e.g. `stable`, `nightly`, `1.42.0`. | stable | |
| 36 | +| `target` | Additional target support to install e.g. `wasm32-unknown-unknown` | | |
| 37 | +| `components` | Comma-separated string of additional components to install e.g. `clippy, rustfmt` | | |
| 38 | + |
| 39 | +## Outputs |
| 40 | + |
| 41 | +| Name | Description | |
| 42 | +| ---------------- | ----------------------------------------- | |
| 43 | +| `rustc-version` | Version as reported by `rustc --version` | |
| 44 | +| `cargo-version` | Version as reported by `cargo --version` | |
| 45 | +| `rustup-version` | Version as reported by `rustup --version` | |
| 46 | + |
| 47 | +## License |
| 48 | + |
| 49 | +The scripts and documentation in this project are released under the [MIT |
| 50 | +License]. |
| 51 | + |
| 52 | +[MIT License]: LICENSE |
| 53 | +[Problem Matchers]: https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md |
0 commit comments