2019-08-15 23:43:28 +00:00
# setup-rust-action
2019-08-15 17:16:59 +00:00
2019-08-16 00:16:04 +00:00
[![Integration status ](https://github.com/hecrj/setup-rust-action/workflows/Integration/badge.svg )](https://github.com/hecrj/setup-rust-action/actions)
2019-08-15 17:16:59 +00:00
2019-08-15 23:43:28 +00:00
Sets up a specific Rust toolchain for use in your GitHub Actions workflows.
2019-08-15 17:16:59 +00:00
2019-08-15 23:43:28 +00:00
# Usage
2019-08-15 17:16:59 +00:00
2019-08-15 23:43:28 +00:00
Provide a `rust-version` with the desired toolchain version to install.
2020-01-06 03:33:59 +00:00
You can combine it with `matrix` to test different Rust toolchains in different platforms!
2019-08-15 23:49:38 +00:00
2019-08-15 23:43:28 +00:00
```yml
2019-08-16 00:16:04 +00:00
name: Test Rust project
2019-08-15 23:43:28 +00:00
on: [push]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [stable, nightly]
steps:
2023-09-04 12:16:29 +00:00
- uses: hecrj/setup-rust-action@v2
2019-08-15 23:43:28 +00:00
with:
rust-version: ${{ matrix.rust }}
- uses: actions/checkout@master
- name: Run tests
run: cargo test --verbose
```
2019-10-27 23:16:53 +00:00
## Inputs
2019-10-27 23:03:46 +00:00
The following inputs can be provided with the `jobs.<job_id>.steps.with` yaml key.
2020-10-06 12:37:41 +00:00
| Name | Optional | Description | Type | Default |
|--------------|:-------------------------:|--------------------------------------------------------|-------------------------|---------|
| rust-version | :heavy_check_mark: | The toolchain name, such as stable, nightly, or 1.8.0 | String | stable |
| components | :heavy_check_mark: | The toolchain components to install | String, comma-separated | |
| targets | :heavy_check_mark: | The toolchain targets to add | String, comma-separated | |
2019-10-27 23:03:46 +00:00
2019-08-15 23:43:28 +00:00
For more details, check out [`action.yml`].
[`action.yml`]: https://github.com/hecrj/setup-rust-action/blob/master/action.yml
2020-01-06 01:34:10 +00:00
## Problem Matchers
2020-01-06 03:33:59 +00:00
This action registers the following [problem matchers ](https://github.com/actions/toolkit/blob/master/docs/problem-matchers.md ) to surface relevant information inline with changeset diffs.
2020-01-06 01:34:10 +00:00
* `cargo-common` matches common cases of errors and warnings
* `cargo-test` matches cargo test errors
* `cargo-fmt` matches rust format errors
2020-01-06 03:33:59 +00:00
To disable any or all of these you can use the `remove-matcher` directive documented [here ](https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers ).
2020-01-06 01:34:10 +00:00
2019-08-15 23:43:28 +00:00
# Contributing / Feedback
2020-01-06 03:33:59 +00:00
Contributions and feedback are welcome! Feel free to open any issues or pull requests.