From f7b796e55d6a23d45ea92fea14a80cf20e52b17f Mon Sep 17 00:00:00 2001 From: carlos-alm Date: Sun, 17 May 2026 18:41:35 -0600 Subject: [PATCH 1/2] ci: force rustup proxy on PATH for macos-14 x86_64 builds macos-14 ARM runners intermittently expose a stale cargo binary that resolves to rustup-init, breaking napi-rs `cargo metadata` calls during the x86_64-apple-darwin build. Add a verification step after dtolnay/rust-toolchain that re-prepends $HOME/.cargo/bin and runs `cargo --version` so the failure surfaces immediately rather than deep inside napi build. Fixes #1136 --- .github/workflows/build-native.yml | 12 ++++++++++++ .github/workflows/publish.yml | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/.github/workflows/build-native.yml b/.github/workflows/build-native.yml index c0239de8..cd542d69 100644 --- a/.github/workflows/build-native.yml +++ b/.github/workflows/build-native.yml @@ -67,6 +67,18 @@ jobs: with: targets: ${{ matrix.target }} + - name: Verify cargo resolves to rustup proxy (macos-14 shim workaround) + if: runner.os == 'macOS' + shell: bash + run: | + # macos-14 ARM runners intermittently expose a stale `cargo` on + # PATH that resolves to `rustup-init`, breaking `cargo metadata` + # invocations from napi-rs (#1136). Force the rustup proxy bin + # dir to the front of PATH and fail fast if cargo is unhealthy. + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" + "$HOME/.cargo/bin/cargo" --version + "$HOME/.cargo/bin/rustc" --version + - name: Rust cache uses: Swatinem/rust-cache@v2 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fa50ce50..cd9f1863 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -176,6 +176,18 @@ jobs: with: targets: ${{ matrix.target }} + - name: Verify cargo resolves to rustup proxy (macos-14 shim workaround) + if: runner.os == 'macOS' + shell: bash + run: | + # macos-14 ARM runners intermittently expose a stale `cargo` on + # PATH that resolves to `rustup-init`, breaking `cargo metadata` + # invocations from napi-rs (#1136). Force the rustup proxy bin + # dir to the front of PATH and fail fast if cargo is unhealthy. + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" + "$HOME/.cargo/bin/cargo" --version + "$HOME/.cargo/bin/rustc" --version + - name: Rust cache uses: Swatinem/rust-cache@v2 with: From 4103161d56379676ccd6155ecbe0d81bd0ed0b08 Mon Sep 17 00:00:00 2001 From: carlos-alm Date: Mon, 18 May 2026 00:31:39 -0600 Subject: [PATCH 2/2] ci: clarify macOS rustup shim workaround scope (#1151) Greptile noted that the step name ("macos-14 shim workaround") and PR description suggested the fix only targets macos-14, while runner.os == 'macOS' also covers macos-latest/aarch64-native. Issue #1136 also recorded an aarch64-apple-darwin failure, so keeping the broader guard is correct. Update the step name and comment to reflect that the workaround intentionally applies to all macOS matrix entries as a safety net. --- .github/workflows/build-native.yml | 12 +++++++----- .github/workflows/publish.yml | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-native.yml b/.github/workflows/build-native.yml index cd542d69..4645c2b1 100644 --- a/.github/workflows/build-native.yml +++ b/.github/workflows/build-native.yml @@ -67,14 +67,16 @@ jobs: with: targets: ${{ matrix.target }} - - name: Verify cargo resolves to rustup proxy (macos-14 shim workaround) + - name: Verify cargo resolves to rustup proxy (macOS shim workaround) if: runner.os == 'macOS' shell: bash run: | - # macos-14 ARM runners intermittently expose a stale `cargo` on - # PATH that resolves to `rustup-init`, breaking `cargo metadata` - # invocations from napi-rs (#1136). Force the rustup proxy bin - # dir to the front of PATH and fail fast if cargo is unhealthy. + # macOS runners (most often `macos-14` ARM, but also observed on + # `macos-latest`/aarch64 builds — see #1136) intermittently expose + # a stale `cargo` on PATH that resolves to `rustup-init`, breaking + # `cargo metadata` invocations from napi-rs. Force the rustup + # proxy bin dir to the front of PATH and fail fast if cargo is + # unhealthy. Applied to all macOS matrix entries as a safety net. echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" "$HOME/.cargo/bin/cargo" --version "$HOME/.cargo/bin/rustc" --version diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cd9f1863..7437c3b2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -176,14 +176,16 @@ jobs: with: targets: ${{ matrix.target }} - - name: Verify cargo resolves to rustup proxy (macos-14 shim workaround) + - name: Verify cargo resolves to rustup proxy (macOS shim workaround) if: runner.os == 'macOS' shell: bash run: | - # macos-14 ARM runners intermittently expose a stale `cargo` on - # PATH that resolves to `rustup-init`, breaking `cargo metadata` - # invocations from napi-rs (#1136). Force the rustup proxy bin - # dir to the front of PATH and fail fast if cargo is unhealthy. + # macOS runners (most often `macos-14` ARM, but also observed on + # `macos-latest`/aarch64 builds — see #1136) intermittently expose + # a stale `cargo` on PATH that resolves to `rustup-init`, breaking + # `cargo metadata` invocations from napi-rs. Force the rustup + # proxy bin dir to the front of PATH and fail fast if cargo is + # unhealthy. Applied to all macOS matrix entries as a safety net. echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" "$HOME/.cargo/bin/cargo" --version "$HOME/.cargo/bin/rustc" --version