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

Repository files navigation

Set up Rust

Install a Rust toolchain specification and optional rustup components and targets in a GitHub Actions workflow.

Requirements

GitHub-hosted Linux, Windows, and macOS runners include Bash and rustup. Self-hosted runners must provide both.

Inputs

Input Required Default Description
toolchain Yes Rustup toolchain specification.
components No "" Space-separated rustup component names.
targets No "" Space-separated rustup target names.

toolchain accepts a standard rustup toolchain specification, including explicit releases such as 1.97.1, the stable, beta, and nightly channels, and dated nightlies such as nightly-2025-06-26. Reproducible CI should generally prefer an explicit release or dated nightly because the channel names move as new toolchains are published.

Usage

Use an explicit Rust release:

steps:
  - uses: seapagan/setup-rust@v1
    with:
      toolchain: "1.97.1"

Channel names and other rustup toolchain specifications work through the same input. For example, use the current stable channel:

steps:
  - uses: seapagan/setup-rust@v1
    with:
      toolchain: stable

Install optional components for the selected toolchain:

steps:
  - uses: seapagan/setup-rust@v1
    with:
      toolchain: "1.97.1"
      components: rustfmt clippy

Install optional Rust target support, including more than one target when needed:

steps:
  - uses: seapagan/setup-rust@v1
    with:
      toolchain: nightly-2025-06-26
      targets: wasm32-unknown-unknown thumbv7em-none-eabihf

Pinning

@v1 is the convenient stable major-version reference and may intentionally move to compatible future v1.x.x releases. Use @v1.0.0 to select this exact immutable release. Consumers requiring the strongest reproducibility and supply-chain protection should pin the action to a full commit SHA and retain a human-readable version comment where practical:

- uses: seapagan/setup-rust@<full-sha> # v1.0.0

Behavior

The action runs rustup toolchain install with --profile minimal, selects that toolchain for subsequent steps in the job through RUSTUP_TOOLCHAIN, and installs requested components and targets explicitly for that toolchain. It does not change rustup's persistent default toolchain.

Installing a target adds Rust's standard library for that target. Cross-compiling may also require a suitable linker, platform SDK, or other external tools; this action does not install them.

Development

Development requires Task, Bash, ShellCheck, shfmt, actionlint, zizmor, and Git. Follow each project's authoritative installation guidance for your platform.

Run the complete mandatory local validation suite from the repository root:

task validate

Maintainers can generate or update CHANGELOG.md with:

task changelog

This uses github-changelog-md which must be installed and available on your PATH. To pass any other CLI options to the task, place them after --:

task changelog -- -n v1.1.0

Run task --list to discover the individual checks. Local validation covers static checks only. The hosted Integration workflow remains authoritative for the action's behavior across GitHub-hosted Linux, Windows, and macOS runners.

About

Install an exact Rust toolchain and optional components

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages