Source: .github/actions/rust-setup/action.yml · composite action
Start a compiling job: the Rust toolchain, clang and lld matching its LLVM, and the Cargo registry and target caches.
Intended for: Every compiling job in rustGlobalBuild and libGlobalBuild.
Release behavior#
Toolchain and cache setup only. The target cache is named per job (lint, test, msrv, crates, docs, benchmarks) and keyed by runner OS and architecture, a partition (the runner image, such as macos26, and a checksum of the CARGO_PROFILE_/CARGO_BUILD_/CARGO_TARGET_ settings and RUSTFLAGS from cache-partition.sh), toolchain and lockfile; Corprus Crucible partitions its release cache the same way.
Artifacts and effects#
- Compiler, linker and cache state for later Cargo commands
Assumptions and permissions#
- llvm: false only for jobs that compile nothing.
- An MSRV check passes its toolchain, which installs the LLVM that toolchain uses.
Failure modes#
- Stream clang or lld differs from rustc's LLVM: setup-llvm.sh fails loudly; inspect package availability.
Example#
uses: DreamWeave-MP/StroggForge/.github/actions/rust-setup@
Inputs#
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
cache | — | false | Name of this job's target cache, such as test or lint. Empty caches only the registry. | |
components | — | false | Comma-separated rustup components, such as clippy,rustfmt. | |
llvm | — | false | true | Install clang and lld matching the toolchain's LLVM, as l3i's toolchain policy requires. 'false' for jobs that compile nothing. |
target-dir | — | false | target | The Cargo target directory to cache. |
targets | — | false | Comma-separated extra Rust targets. | |
toolchain | — | false | stable | Rust toolchain to install. |
Outputs#
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
cachekey | — | — | ${{ steps.rust.outputs.cachekey }} | The toolchain's cache key, from dtolnay/rust-toolchain. |
Permissions#
Top-level: —. Undeclared means inherited from the caller, not "none needed".
Steps#
Composite action#
| Step | Action / command | Condition |
|---|---|---|
| Install Rust ${{ inputs.toolchain }} | dtolnay/rust-toolchain@master | — |
| Install clang and lld matching rustc's LLVM | bash "${{ github.action_path }}/../../../scripts/shared/setup-llvm.sh" "${{ inputs.toolchain }}" "" | inputs.llvm == 'true' |
| Name the target cache's partition | bash "${{ github.action_path }}/../../../scripts/shared/cache-partition.sh" | inputs.cache != '' |
| Cache the downloaded crates | actions/cache@v5.0.5 | github.event_name != 'pull_request' |
| Restore the downloaded crates | actions/cache/restore@v5.0.5 | github.event_name == 'pull_request' |
| Cache the ${{ inputs.cache }} target directory | actions/cache@v5.0.5 | inputs.cache != '' && github.event_name != 'pull_request' |
| Restore the ${{ inputs.cache }} target directory | actions/cache/restore@v5.0.5 | inputs.cache != '' && github.event_name == 'pull_request' |