Rust setup

.github/actions/rust-setup/action.yml

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@ with a cache name.

Inputs#

NameTypeRequiredDefaultDescription
cache—falseName of this job's target cache, such as test or lint. Empty caches only the registry.
components—falseComma-separated rustup components, such as clippy,rustfmt.
llvm—falsetrueInstall clang and lld matching the toolchain's LLVM, as l3i's toolchain policy requires. 'false' for jobs that compile nothing.
target-dir—falsetargetThe Cargo target directory to cache.
targets—falseComma-separated extra Rust targets.
toolchain—falsestableRust toolchain to install.

Outputs#

NameTypeRequiredDefaultDescription
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#

StepAction / commandCondition
Install Rust ${{ inputs.toolchain }}dtolnay/rust-toolchain@master—
Install clang and lld matching rustc's LLVMbash "${{ github.action_path }}/../../../scripts/shared/setup-llvm.sh" "${{ inputs.toolchain }}" ""inputs.llvm == 'true'
Name the target cache's partitionbash "${{ github.action_path }}/../../../scripts/shared/cache-partition.sh"inputs.cache != ''
Cache the downloaded cratesactions/cache@v5.0.5github.event_name != 'pull_request'
Restore the downloaded cratesactions/cache/restore@v5.0.5github.event_name == 'pull_request'
Cache the ${{ inputs.cache }} target directoryactions/cache@v5.0.5inputs.cache != '' && github.event_name != 'pull_request'
Restore the ${{ inputs.cache }} target directoryactions/cache/restore@v5.0.5inputs.cache != '' && github.event_name == 'pull_request'