Skip to content

GitHub Action to install Rust's toolchain via rust-toolchain.toml

License

Notifications You must be signed in to change notification settings

dsherret/rust-toolchain-file

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

GitHub Action to install Rust's toolchain via rust-toolchain.toml

Resources

License

Stars

Watchers

Forks

Packages

No packages published