Files
pnpm/.github/actions/rustup/action.yml
Zoltan Kochanandgithub-actions[bot] 901f2438e0 chore: update dependencies, Node.js, pnpm, and GitHub Actions (#17217)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-10-23 10:35:07 +02:00

98 lines
2.8 KiB
YAML

name: Rustup
description: Install Rust with minimal profile and additional components
inputs:
# See https://rust-lang.github.io/rustup/concepts/components.html
clippy:
default: false
required: false
fmt:
default: false
required: false
docs:
default: false
required: false
restore-cache:
default: true
required: false
save-cache:
default: false
required: false
shared-key:
default: 'warm'
required: false
runs:
using: composite
steps:
- name: Print Inputs
shell: bash
env:
CLIPPY: ${{ inputs.clippy }}
FMT: ${{ inputs.fmt }}
DOCS: ${{ inputs.docs }}
RESTORE_CACHE: ${{ inputs.restore-cache }}
SAVE_CACHE: ${{ inputs.save-cache }}
run: |
echo "clippy: $CLIPPY"
echo "fmt: $FMT"
echo "docs: $DOCS"
echo "restore-cache: $RESTORE_CACHE"
echo "save-cache: $SAVE_CACHE"
- name: Remove `profile` line on MacOS
shell: bash
if: runner.os == 'macOS'
run: sed -i '' '/profile/d' rust-toolchain.toml
- name: Remove `profile` line on non-MacOS
shell: bash
if: runner.os != 'macOS'
run: sed -i '/profile/d' rust-toolchain.toml
- name: Set minimal
shell: bash
run: rustup set profile minimal
- name: Add Clippy
shell: bash
if: ${{ inputs.clippy == 'true' }}
run: rustup component add clippy
- name: Add Rustfmt
shell: bash
if: ${{ inputs.fmt == 'true' }}
run: rustup component add rustfmt
- name: Add docs
shell: bash
if: ${{ inputs.docs == 'true' }}
run: rustup component add rust-docs
- name: Install
shell: bash
run: |
rustup show
git restore .
- name: Cache on ${{ github.ref_name }}
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
if: ${{ inputs.restore-cache == 'true' }}
with:
# rust-cache hashes the Cargo.lock at each workspace root, and there is
# none under the roots below. The shared key is the only key input it
# reads when set, so the lockfile hash goes into it.
shared-key: ${{ inputs.shared-key }}-${{ hashFiles('Cargo.lock') }}
save-if: ${{ inputs.save-cache == 'true' }}
# rust-cache keeps only the build artifacts of packages whose manifest
# lies outside the workspace root, and pnpm vendors every crates.io
# dependency under .pnpm/crates inside it, so with the repository root
# it dropped all of them and each job compiled ~950 crates. With pnpm/
# and pnpr/ as the roots, the two cleanups of the shared target drop
# the crates under each, which a fresh checkout rebuilds anyway, and
# keep the vendored ones.
workspaces: |
pnpm -> ../target
pnpr -> ../target