Skip to content
activity

GitHub Action

rust-toolchain.toml install

v1 Latest version

rust-toolchain.toml install

activity

rust-toolchain.toml install

Install the Rust toolchain via a rust-toolchain.toml file

Installation

Copy and paste the following snippet into your .yml file.

              

- name: rust-toolchain.toml install

uses: dsherret/rust-toolchain-file@v1

Learn more about this action in dsherret/rust-toolchain-file

Choose a version

Install Rust Toolchain via rust-toolchain.toml

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.

Example workflow

  1. Create a rust-toolchain.toml file in the root directory of your repository:

    [toolchain]
    channel = "1.68"
    components = [ "rustfmt", "clippy" ]
  2. 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.

Inputs

You must define everything in the rust-toolchain.toml file.

Outputs

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}}.

License

The scripts and documentation in this project are released under the MIT License.