diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index c7b6b68e..5005b4b0 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -11,6 +11,9 @@ env: # For setup-rust, see https://github.com/moonrepo/setup-rust/issues/22 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CARGO_GPU_COMMITSH: 31153a8edd3bc626d4b9fb0cd7bdb7a8b30797d3 + # Nightly toolchain used for rustfmt in CI and in renderling-build's codegen. + # Bump deliberately: reformat + regenerate shaders in the same PR. + RUST_NIGHTLY_TOOLCHAIN: nightly-2026-07-31 jobs: # Installs cargo deps and sets the cache directory for subsequent jobs @@ -84,8 +87,8 @@ jobs: ${{ needs.install-cargo-gpu.outputs.cachepath-Linux }} ${{ needs.install-cargo-gpu.outputs.cachepath-Windows }} key: rust-gpu-cache-1-${{ matrix.os }} - - run: rustup install nightly - - run: rustup component add --toolchain nightly rustfmt + - run: rustup install $RUST_NIGHTLY_TOOLCHAIN + - run: rustup component add --toolchain $RUST_NIGHTLY_TOOLCHAIN rustfmt - run: cargo gpu show commitsh - run: rm -rf crates/renderling/src/linkage/* crates/renderling/shaders - run: cargo shaders @@ -105,9 +108,9 @@ jobs: key: renderling-fmt-${{ env.CARGO_GPU_COMMITSH }}-ubuntu-24.04 - run: mkdir -p $HOME/.cargo/bin - uses: moonrepo/setup-rust@v1 - - run: rustup install nightly - - run: rustup component add --toolchain nightly rustfmt - - run: cargo +nightly fmt -- --check + - run: rustup install $RUST_NIGHTLY_TOOLCHAIN + - run: rustup component add --toolchain $RUST_NIGHTLY_TOOLCHAIN rustfmt + - run: cargo +$RUST_NIGHTLY_TOOLCHAIN fmt -- --check # BAU clippy lints renderling-clippy: diff --git a/AGENTS.md b/AGENTS.md index 29432c7c..94854df1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -17,5 +17,7 @@ Always format with `cargo +nightly fmt`. +The fmt toolchain is pinned to `nightly-2026-07-31` via `RUST_NIGHTLY_TOOLCHAIN` in `.github/workflows/push.yaml`. Use that toolchain locally too; bump it deliberately (reformat + regenerate shaders in the same PR). + ## Disallowed Methods (clippy.toml) Avoid: `Vec{2,3,4}::normalize_or_zero`, `Mat4::to_scale_rotation_translation`, `f32::signum` diff --git a/crates/renderling-build/src/lib.rs b/crates/renderling-build/src/lib.rs index 13ca07a5..47bc2965 100644 --- a/crates/renderling-build/src/lib.rs +++ b/crates/renderling-build/src/lib.rs @@ -283,8 +283,11 @@ impl RenderlingPaths { // Just format the whole project. I know this is less than ideal, // but people should be running with a formatter in their editor, and all of // this is temporary given the wgsl-rs re-stacking happening this year (2026) + let fmt_toolchain = + std::env::var("RUST_NIGHTLY_TOOLCHAIN").unwrap_or_else(|_| "nightly".into()); std::process::Command::new("cargo") - .args(["+nightly", "fmt"]) + .arg(format!("+{fmt_toolchain}")) + .arg("fmt") .output() .expect("could not format generated code"); log::info!("...done!")