ci: pin the toolchain in rust-toolchain.toml

The file is the one source: the jobs install what it names through
craft-common-actions' rust-channel action, and the nightly run opens a pull
request that changes only the file when a newer stable exists.

Part of #15711
This commit is contained in:
aiongg
2026-11-20 04:14:10 +00:00
parent 629c0ffb75
commit 5612b2dfd4
7 changed files with 201 additions and 58 deletions
+93 -21
View File
@@ -57,12 +57,6 @@ permissions:
env:
CARGO_TERM_COLOR: always
# The Rust release every job builds with. A release that came out overnight must not start a cold
# build in every cache key (the key holds `rustc -vV`); a change to this value is the one cold
# day, reviewed as any change. The gate calls below carry the same value (their `env` is not this
# one), and scripts/test-ci-toolchain-pin.py checks that they agree. The name stays outside the
# prefixes rust-cache hashes into its keys.
TOOLCHAIN_PIN: "1.100.0"
RUST_BACKTRACE: 1
PHOTOCRAFT_FULL_SWEEP: ${{ inputs.full_sweep && '1' || '0' }}
# No test or fuzz run may print a page: the engine refuses to spool, and if something ever
@@ -173,8 +167,6 @@ jobs:
# Tracks @main so suite-wide CI fixes reach every app without a PR in each repository.
uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
with:
# TOOLCHAIN_PIN (the called workflow does not see this file's `env`).
toolchain: "1.100.0"
# egui/winit/rfd.
packages: >-
libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev
@@ -199,7 +191,7 @@ jobs:
# fmt, egui-fork, clippy, layers, panel-commands, scorecard, the wasm32 check and the
# missing-translations report (`cargo xtask ci lint`, xtask/src/main.rs), and the CI scripts'
# own tests.
lint-command: python3 scripts/test-ci-gpu-lavapipe.py && python3 scripts/test-ci-windows-gpu-tests.py && python3 scripts/test-ci-test-times.py && python3 scripts/test-ci-toolchain-pin.py && cargo xtask ci lint
lint-command: python3 scripts/test-ci-gpu-lavapipe.py && python3 scripts/test-ci-windows-gpu-tests.py && python3 scripts/test-ci-test-times.py && python3 scripts/test-ci-toolchain-bump.py && cargo xtask ci lint
archive-command: cargo xtask ci archive --gpu-shard
after-archive-command: cargo xtask ci doctest
test-shards: 4
@@ -224,8 +216,6 @@ jobs:
uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
with:
os: '["windows-latest"]'
# TOOLCHAIN_PIN.
toolchain: "1.100.0"
lint-cache: false
# The all-language UI tests shape real Japanese, Chinese, Korean and Devanagari labels with
# kittest's strict `MissingGlyphPolicy::Panic`, and a hosted Windows image has no guaranteed
@@ -333,9 +323,13 @@ jobs:
libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev
libgtk-3-dev
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@main
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ env.TOOLCHAIN_PIN }}
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
# The gate's own key (the shared action computes it), restore only. The toolchain action
# exports CARGO_HOME, which the gate's legs do not have; align-environment leaves it out of
@@ -378,9 +372,13 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@main
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ env.TOOLCHAIN_PIN }}
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
prefix-key: v1-rust
@@ -421,10 +419,13 @@ jobs:
- name: Check out craft-i18n
uses: storytold/craft-common-actions/actions/checkout-craft-i18n@main
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@main
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ env.TOOLCHAIN_PIN }}
targets: wasm32-unknown-unknown
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
prefix-key: v1-rust
@@ -469,6 +470,9 @@ jobs:
# Placeholder: manual trigger only until a nightly schedule is enabled.
if: github.event_name == 'workflow_dispatch' && inputs.fuzz
runs-on: ubuntu-latest
env:
# cargo-fuzz needs nightly; the checkout's rust-toolchain.toml would pick the pinned release.
RUSTUP_TOOLCHAIN: nightly
strategy:
fail-fast: false
matrix:
@@ -540,9 +544,13 @@ jobs:
packages: >-
libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev
libgtk-3-dev
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@main
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ env.TOOLCHAIN_PIN }}
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- name: Compare exact outputs and release timings on 24 MP
run: |
set -o pipefail
@@ -573,9 +581,13 @@ jobs:
packages: >-
libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev
libgtk-3-dev
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@main
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ env.TOOLCHAIN_PIN }}
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- name: Compare exact outputs and release timings on 36 MP
run: |
set -o pipefail
@@ -605,9 +617,13 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@main
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ env.TOOLCHAIN_PIN }}
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
# perf-nightly.yml's entry (same key and runner); only that job saves it.
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
@@ -638,9 +654,13 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@main
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ env.TOOLCHAIN_PIN }}
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- name: Compare exact outputs and release timings on 36 MP
run: |
set -o pipefail
@@ -671,9 +691,13 @@ jobs:
persist-credentials: false
ref: ${{ inputs.brush_tip_base }}
path: before
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@main
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ env.TOOLCHAIN_PIN }}
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- name: Build the same benchmark against both versions
run: |
cp after/crates/paint/examples/big_dab_bench.rs before/crates/paint/examples/big_dab_bench.rs
@@ -722,9 +746,13 @@ jobs:
git worktree add --detach "$RUNNER_TEMP/photocraft-baseline" "$base"
mkdir -p "$RUNNER_TEMP/photocraft-baseline/crates/engine/examples"
cp crates/engine/examples/bench_dry_mixer.rs "$RUNNER_TEMP/photocraft-baseline/crates/engine/examples/bench_dry_mixer.rs"
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@main
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ env.TOOLCHAIN_PIN }}
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- name: Install Linux build dependencies
uses: storytold/craft-common-actions/actions/install-apt-packages@main
with:
@@ -757,3 +785,47 @@ jobs:
with:
name: dry-mixer-performance
path: dry-mixer-perf.txt
# After the nightly cold run passes, a newer stable Rust release gets a pull request that changes
# only rust-toolchain.toml (a file the workflow token may change; it may not change workflow
# files). Pull requests the token opens start no checks, so the branch also gets a dispatched run
# of this workflow, which runs the whole gate on it. A failed step warns: tomorrow's run tries again.
toolchain-bump:
name: toolchain bump
needs: gate
if: github.event_name == 'schedule' && needs.gate.result == 'success'
runs-on: ubuntu-24.04
timeout-minutes: 10
continue-on-error: true
permissions:
contents: write
pull-requests: write
actions: write
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Open the bump pull request
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
version=$(python3 scripts/ci-toolchain-bump.py)
if [ -z "$version" ]; then
echo "rust-toolchain.toml is current"
exit 0
fi
branch="toolchain-$version"
if [ -n "$(gh pr list --head "$branch" --state all --json number --jq '.[].number')" ]; then
echo "$branch already has a pull request"
exit 0
fi
python3 scripts/ci-toolchain-bump.py --write "$version"
git -c user.name=github-actions -c user.email=41898282+github-actions[bot]@users.noreply.github.com \
commit -q -m "Build with Rust $version" rust-toolchain.toml
git push origin "HEAD:refs/heads/$branch"
gh pr create --head "$branch" --base main --title "Build with Rust $version" \
--body "Moves rust-toolchain.toml to Rust $version, the newest stable release. A pull request opened with the workflow token starts no checks; the run dispatched on this branch is its check. The first main run after the merge builds cold once."
gh workflow run ci.yml --ref "$branch"
+5 -4
View File
@@ -35,9 +35,6 @@ concurrency:
env:
CARGO_TERM_COLOR: always
# ci.yml's TOOLCHAIN_PIN: the quick performance suite there restores this workflow's cache entry, whose key
# holds the Rust release.
TOOLCHAIN_PIN: "1.100.0"
jobs:
perf:
@@ -54,9 +51,13 @@ jobs:
with:
persist-credentials: false
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@main
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ env.TOOLCHAIN_PIN }}
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with: