From 4d11bb94aa7c442898482d7a33e08aad50908af8 Mon Sep 17 00:00:00 2001 From: wan9chi Date: Mon, 5 Oct 2026 09:27:40 +0800 Subject: [PATCH 1/2] ci: run macOS x64 and musl tests on PRs only with the `ci: full` label The macOS x64 job (Rosetta) and the musl job (uncached build in an Alpine container) are the slowest CI jobs and set the pull request wall time. Pull requests now skip both unless they carry the `ci: full` label; pushes to main and manual dispatches still run them. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 46 +++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dffb42706..024981f95 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,9 @@ permissions: on: workflow_dispatch: pull_request: - types: [opened, synchronize] + # `labeled` reruns CI when a pull request gets the `ci: full` label, which + # adds the jobs that pull requests otherwise skip. + types: [opened, synchronize, labeled] push: branches: - main @@ -69,10 +71,6 @@ jobs: needs: detect-changes if: needs.detect-changes.outputs.code-changed == 'true' name: Test (${{ matrix.shard }}) - env: - # Playwright detects the physical Apple Silicon CPU under Rosetta. Force - # its x64 browser for the x86_64 shard so fspy can inject its x64 preload. - PLAYWRIGHT_HOST_PLATFORM_OVERRIDE: ${{ matrix.target == 'x86_64-apple-darwin' && 'mac15' || '' }} strategy: fail-fast: false matrix: @@ -87,13 +85,8 @@ jobs: cargo_cmd: cargo build_target: aarch64-apple-darwin shard: macos-arm64 - - os: namespace-profile-mac-default - target: x86_64-apple-darwin - cargo_cmd: cargo - build_target: x86_64-apple-darwin - shard: macos-x64 runs-on: ${{ matrix.os }} - steps: + steps: &test-steps - uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2 - name: Update submodules @@ -152,6 +145,30 @@ jobs: pnpm --filter vite-task-tools test ${{ matrix.cargo_cmd }} test --target ${{ matrix.build_target }} -- --ignored + # Running x64 binaries under Rosetta makes this the slowest job, so pull + # requests run it only with the `ci: full` label. + test-macos-x64: + needs: detect-changes + if: >- + needs.detect-changes.outputs.code-changed == 'true' && + (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci: full')) + name: Test (${{ matrix.shard }}) + env: + # Playwright detects the physical Apple Silicon CPU under Rosetta. Force + # its x64 browser so fspy can inject its x64 preload. + PLAYWRIGHT_HOST_PLATFORM_OVERRIDE: mac15 + strategy: + # A single-entry matrix provides the `matrix` values the shared steps read. + matrix: + include: + - os: namespace-profile-mac-default + target: x86_64-apple-darwin + cargo_cmd: cargo + build_target: x86_64-apple-darwin + shard: macos-x64 + runs-on: ${{ matrix.os }} + steps: *test-steps + # Windows tests are cross-compiled on a fast Linux runner with cargo-xwin # (clang-cl + lld-link against the xwin-downloaded MSVC CRT/Windows SDK) # and packed into a portable nextest archive. The Windows runners then only @@ -287,9 +304,13 @@ jobs: pnpm --filter vite-task-tools test cargo-nextest nextest run --archive-file windows-tests.tar.zst --workspace-remap . --run-ignored ignored-only + # Building without a Rust cache inside the Alpine container makes this one of + # the slowest jobs, so pull requests run it only with the `ci: full` label. test-musl: needs: detect-changes - if: needs.detect-changes.outputs.code-changed == 'true' + if: >- + needs.detect-changes.outputs.code-changed == 'true' && + (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci: full')) name: Test (musl) runs-on: namespace-profile-linux-x64-default container: @@ -389,6 +410,7 @@ jobs: needs: - clippy - test + - test-macos-x64 - test-musl - build-windows-tests - test-windows From ad387827b082f8fcbae76439c67b72f445f19802 Mon Sep 17 00:00:00 2001 From: wan9chi Date: Mon, 5 Oct 2026 09:33:35 +0800 Subject: [PATCH 2/2] ci: show the skipped macOS x64 job under its real name GitHub lists a skipped matrix job under its unexpanded name, so the single-entry matrix showed up as `Test (${{ matrix.shard }})` on pull requests. Drop the matrix and have the shared steps read job-level env vars instead. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 42 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 024981f95..0c7de7220 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,6 +71,11 @@ jobs: needs: detect-changes if: needs.detect-changes.outputs.code-changed == 'true' name: Test (${{ matrix.shard }}) + env: + # The steps, shared with `test-macos-x64`, read these instead of `matrix`. + TEST_TARGET: ${{ matrix.target }} + TEST_CARGO_CMD: ${{ matrix.cargo_cmd }} + TEST_BUILD_TARGET: ${{ matrix.build_target }} strategy: fail-fast: false matrix: @@ -97,37 +102,37 @@ jobs: save-cache: ${{ github.ref_name == 'main' }} cache-key: test - - run: rustup target add ${{ matrix.target }} + - run: rustup target add $TEST_TARGET - run: rustup target add x86_64-unknown-linux-musl - if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} + if: env.TEST_TARGET == 'x86_64-unknown-linux-gnu' - run: pipx install cargo-zigbuild - if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} + if: env.TEST_TARGET == 'x86_64-unknown-linux-gnu' # pipx isolates cargo-zigbuild in its own venv, so its ziglang dependency # (which bundles zig) isn't on PATH. Install zig separately. - uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1 - if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} + if: env.TEST_TARGET == 'x86_64-unknown-linux-gnu' - name: Build tests - run: ${{ matrix.cargo_cmd }} test --no-run --target ${{ matrix.build_target }} + run: $TEST_CARGO_CMD test --no-run --target $TEST_BUILD_TARGET # Default `cargo test` runs only tests that need nothing beyond the # Rust toolchain; this step verifies that contract before Node.js # and pnpm enter the picture. - name: Run tests - run: ${{ matrix.cargo_cmd }} test --target ${{ matrix.build_target }} + run: $TEST_CARGO_CMD test --target $TEST_BUILD_TARGET # x86_64-apple-darwin runs on arm64 runner under Rosetta; install x64 Node # so fspy's x86_64 preload dylib can be injected into spawned node procs. - uses: oxc-project/setup-node@f46a72f95efdc55273fcd042d61c84e723b2892c # v1.4.1 with: - architecture: ${{ matrix.target == 'x86_64-apple-darwin' && 'x64' || '' }} + architecture: ${{ env.TEST_TARGET == 'x86_64-apple-darwin' && 'x64' || '' }} - name: Install runtime binaries run: | - if [[ '${{ matrix.target }}' == 'x86_64-apple-darwin' ]]; then + if [[ "$TEST_TARGET" == 'x86_64-apple-darwin' ]]; then # Bun normally prefers the native arm64 binary under Rosetta, but # this job needs x64 Bun so the x64 preload dylib can be injected. PATH="$(dirname "$(command -v node)"):$PNPM_HOME:/usr/bin:/bin" \ @@ -137,13 +142,13 @@ jobs: fi - name: Install Chromium system dependencies - if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }} + if: env.TEST_TARGET == 'x86_64-unknown-linux-gnu' run: pnpm --filter vite-task-tools exec playwright install-deps chromium - name: Run ignored tests run: | pnpm --filter vite-task-tools test - ${{ matrix.cargo_cmd }} test --target ${{ matrix.build_target }} -- --ignored + $TEST_CARGO_CMD test --target $TEST_BUILD_TARGET -- --ignored # Running x64 binaries under Rosetta makes this the slowest job, so pull # requests run it only with the `ci: full` label. @@ -152,21 +157,16 @@ jobs: if: >- needs.detect-changes.outputs.code-changed == 'true' && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci: full')) - name: Test (${{ matrix.shard }}) + # No matrix: a skipped matrix job is listed under its unexpanded name. + name: Test (macos-x64) + runs-on: namespace-profile-mac-default env: + TEST_TARGET: x86_64-apple-darwin + TEST_CARGO_CMD: cargo + TEST_BUILD_TARGET: x86_64-apple-darwin # Playwright detects the physical Apple Silicon CPU under Rosetta. Force # its x64 browser so fspy can inject its x64 preload. PLAYWRIGHT_HOST_PLATFORM_OVERRIDE: mac15 - strategy: - # A single-entry matrix provides the `matrix` values the shared steps read. - matrix: - include: - - os: namespace-profile-mac-default - target: x86_64-apple-darwin - cargo_cmd: cargo - build_target: x86_64-apple-darwin - shard: macos-x64 - runs-on: ${{ matrix.os }} steps: *test-steps # Windows tests are cross-compiled on a fast Linux runner with cargo-xwin