name: Set up Rust
description: >-
Pulls the latest stable toolchain and enables incremental build caching
shared across CI runs.
inputs:
components:
description: Space-separated list of extra rustup components to install (e.g. "clippy rustfmt").
required: false
default: ""
cache-key:
description: Extra suffix to keep this job's build cache separate from other jobs.
required: false
default: ""
runs:
using: composite
steps:
- name: Activate pinned toolchain
shell: bash
run: |
rustup update stable --no-self-update
if [ -n "${{ inputs.components }}" ]; then
rustup component add ${{ inputs.components }}
fi
rustc --version
- name: Cache cargo registry and build artifacts
uses: Swatinem/rust-cache@v2
with:
key: ${{ inputs.cache-key }}