💸Save up to $132K/month in CI costs!👉 Try Free
Skip to main content
← Back to workflows

How to Use the Install Rust Toolchain GitHub Action

dtolnay-rust-toolchain -
GitHub Action
v1
1,112
Contributors
Contributor - dtolnayContributor - thomccContributor - alex
Categories

Optimize Your CI/CD Pipeline

Get instant insights into your CI/CD performance and costs. Reduce build times by up to 45% and save on infrastructure costs.

45% Faster Builds
60% Cost Reduction
Usage
name: 'Usage of rust-toolchain GitHub Action'
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo test --all-features

rust-toolchain logo

Rust Toolchain

Concise GitHub Action for installing a Rust toolchain


What is Rust Toolchain?

Incorporating Rust into our projects requires a reliable and efficient setup for the Rust toolchain. The Install Rust Toolchain GitHub Action simplifies the installation of the Rust environment using rustup. It is optimized for simplicity and effectiveness, ensuring our workflows are streamlined and maintainable.

Configuration Options

toolchain

Specifies the Rustup toolchain, such as stable, nightly, 1.42.0, or nightly-2022-01-01. If you pass an explicit toolchain as an input instead of using @rev, you should use "dtolnay/rust-toolchain@master" as the revision of the action.

- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly

targets

A comma-separated string of additional targets to install, e.g., wasm32-unknown-unknown.

- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

components

A comma-separated string of additional components to install, e.g., clippy, rustfmt.

- uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt