GitHub Action to install Rust's toolchain via the
rust-toolchain.toml
file in your repository.
Fork of https://github.com/dtolnay/rust-toolchain that supports and makes it
mandatory to use a rust-toolchain.toml file. Unfortunately rust-toolchain
did
not want to support installing from a rust-toolchain.toml file, so this project
exists. If you do not want to use a rust-toolchain.toml file, then please use
that project as this action does not support other inputs.
Note: GitHub actions now
automatically sets up
the Rust version based on the rust-toolchain.toml, but it won't setup the other
defaults from dtolnay/rust-toolchain
for you like enabling colours on the CI
as this action will.
-
Create a
rust-toolchain.toml
file in the root directory of your repository:[toolchain] channel = "1.68" components = [ "rustfmt", "clippy" ]
-
Add an entry to this action in your GitHub Actions workflow file (ensure the repo is checked out first):
name: test suite on: [push, pull_request] jobs: test: name: cargo test runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: dsherret/rust-toolchain-file@v1 - run: cargo test --all-features
The selection of Rust toolchain on the CI will then be made based on the rust-toolchain.toml file enabling you to easily keep it in sync with your local development versions and have a single source of truth for what version to use.
You must define everything in the rust-toolchain.toml file.
Name | Description |
---|---|
cachekey |
A short hash of the installed rustc version, appropriate for use as a cache key. "20220627a831" |
name |
Rustup's name for the selected version of the toolchain, like "1.62.0" . Suitable for use with cargo +${{steps.toolchain.outputs.name}} . |
The scripts and documentation in this project are released under the MIT License.