From d2e071a0278c8e10df8e73582e26dfad3e209709 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 20:00:08 +0800 Subject: [PATCH] ci: separate Rust toolchain and cache ownership Use explicit toolchain and rust-cache steps, bound cache writers to main, and keep Cargo dependency commands locked. Refs #3 --- .github/workflows/ci.yml | 99 +++++++++++++++++++++---------- .github/workflows/release-tag.yml | 4 +- .github/workflows/release.yml | 10 +--- 3 files changed, 71 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96cbf62..bb00b17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,23 +30,29 @@ jobs: uses: actions/checkout@v7 - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 + uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.toolchain }} components: clippy, rustfmt - rustflags: "" - cache-shared-key: linux-quality - cache-save-if: ${{ github.ref == 'refs/heads/main' }} + - name: Restore Rust cache + uses: Swatinem/rust-cache@v2 + with: + shared-key: linux-quality + cache-targets: true + cache-all-crates: false + cache-workspace-crates: false + cache-bin: false + save-if: ${{ github.ref == 'refs/heads/main' }} cache-on-failure: false - name: Check formatting run: cargo fmt --all -- --check - name: Run Clippy - run: cargo clippy --workspace --all-targets --all-features -- -D warnings + run: cargo clippy --locked --workspace --all-targets --all-features -- -D warnings - name: Run tests - run: cargo test --workspace --all-targets --all-features + run: cargo test --locked --workspace --all-targets --all-features lpp-client-integration: name: LPP client integration (#142, #139) @@ -56,12 +62,18 @@ jobs: uses: actions/checkout@v7 - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 + uses: dtolnay/rust-toolchain@master with: toolchain: stable - rustflags: "" - cache-shared-key: linux-quality - cache-save-if: false + - name: Restore Rust cache + uses: Swatinem/rust-cache@v2 + with: + shared-key: linux-quality + cache-targets: true + cache-all-crates: false + cache-workspace-crates: false + cache-bin: false + save-if: false cache-on-failure: false # The mock provider is built from the pinned language-provider-protocol @@ -75,7 +87,7 @@ jobs: path: language-provider-protocol - name: Build the pinned LPP mock provider - run: cargo build -p lpp-mock-provider + run: cargo build --locked -p lpp-mock-provider working-directory: language-provider-protocol # REQUIRED: these suites self-skip when LPP_MOCK_PROVIDER is absent, @@ -84,9 +96,9 @@ jobs: env: LPP_MOCK_PROVIDER: ${{ github.workspace }}/language-provider-protocol/target/debug/lpp-mock-provider run: | - cargo test -p wright-lpp --test mock_provider - cargo test -p wright-driver --test lpp - cargo test -p wright-driver --test provider_edit + cargo test --locked -p wright-lpp --test mock_provider + cargo test --locked -p wright-driver --test lpp + cargo test --locked -p wright-driver --test provider_edit v1-gates: name: v1 release gates (N-level, scenarios, benchmarks) @@ -96,12 +108,18 @@ jobs: uses: actions/checkout@v7 - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 + uses: dtolnay/rust-toolchain@master with: toolchain: stable - rustflags: "" - cache-shared-key: linux-quality - cache-save-if: false + - name: Restore Rust cache + uses: Swatinem/rust-cache@v2 + with: + shared-key: linux-quality + cache-targets: true + cache-all-crates: false + cache-workspace-crates: false + cache-bin: false + save-if: false cache-on-failure: false - name: Build wright (debug) @@ -175,16 +193,22 @@ jobs: uses: actions/checkout@v7 - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 + uses: dtolnay/rust-toolchain@master with: toolchain: stable - rustflags: "" - cache-shared-key: linux-quality - cache-save-if: false + - name: Restore Rust cache + uses: Swatinem/rust-cache@v2 + with: + shared-key: linux-quality + cache-targets: true + cache-all-crates: false + cache-workspace-crates: false + cache-bin: false + save-if: false cache-on-failure: false - name: Run OSTW forward-compilation differential suite - run: cargo test -p wright-ostw --test differential + run: cargo test --locked -p wright-ostw --test differential - name: Upload differential report if: always() @@ -228,16 +252,22 @@ jobs: uses: actions/checkout@v7 - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 + uses: dtolnay/rust-toolchain@master with: toolchain: stable - rustflags: "" - cache-shared-key: linux-quality - cache-save-if: false + - name: Restore Rust cache + uses: Swatinem/rust-cache@v2 + with: + shared-key: linux-quality + cache-targets: true + cache-all-crates: false + cache-workspace-crates: false + cache-bin: false + save-if: false cache-on-failure: false - name: Run native-vs-reference differential suite - run: cargo test -p wright-opy --test differential + run: cargo test --locked -p wright-opy --test differential - name: Upload differential report if: always() @@ -266,13 +296,18 @@ jobs: python-version: "3.12" - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 + uses: dtolnay/rust-toolchain@master with: toolchain: stable - rustflags: "" + - name: Restore Rust cache + uses: Swatinem/rust-cache@v2 + with: + shared-key: dist-validation-${{ runner.os }} cache-targets: false + cache-all-crates: false + cache-workspace-crates: false cache-bin: false - cache-save-if: ${{ github.ref == 'refs/heads/main' }} + save-if: ${{ github.ref == 'refs/heads/main' }} cache-on-failure: false - name: Set up Node.js @@ -281,7 +316,7 @@ jobs: node-version: 22 - name: Build wright CLI and LSP - run: cargo build -p wright-cli -p wright-lsp + run: cargo build --locked -p wright-cli -p wright-lsp - name: Validate package-manager metadata and install script run: python scripts/verify-dist.py diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 286ed62..2db50e7 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -26,11 +26,9 @@ jobs: fetch-depth: 0 - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 + uses: dtolnay/rust-toolchain@master with: toolchain: stable - rustflags: "" - cache: false - name: Update version, commit, and push the tag id: tag diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e753c16..e124397 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,12 +30,10 @@ jobs: ref: ${{ env.RELEASE_TAG }} - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 + uses: dtolnay/rust-toolchain@master with: toolchain: stable components: clippy, rustfmt - rustflags: "" - cache: false - name: Verify tag version matches the workspace implementation version run: | @@ -96,17 +94,15 @@ jobs: ref: ${{ env.RELEASE_TAG }} - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@v1 + uses: dtolnay/rust-toolchain@master with: toolchain: stable - rustflags: "" - cache: false - name: Add cross-compile target run: rustup target add "$TARGET" - name: Build release binaries - run: cargo build --release -p wright-cli -p wright-lsp --target "$TARGET" + run: cargo build --locked --release -p wright-cli -p wright-lsp --target "$TARGET" - name: Package archive with version stamp run: |