Skip to content

Commit c524351

Browse files
authored
ci: force rustup proxy on PATH for macos-14 x86_64 builds (#1151)
* 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 * 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.
1 parent dd3b1fe commit c524351

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

.github/workflows/build-native.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ jobs:
6767
with:
6868
targets: ${{ matrix.target }}
6969

70+
- name: Verify cargo resolves to rustup proxy (macOS shim workaround)
71+
if: runner.os == 'macOS'
72+
shell: bash
73+
run: |
74+
# macOS runners (most often `macos-14` ARM, but also observed on
75+
# `macos-latest`/aarch64 builds — see #1136) intermittently expose
76+
# a stale `cargo` on PATH that resolves to `rustup-init`, breaking
77+
# `cargo metadata` invocations from napi-rs. Force the rustup
78+
# proxy bin dir to the front of PATH and fail fast if cargo is
79+
# unhealthy. Applied to all macOS matrix entries as a safety net.
80+
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
81+
"$HOME/.cargo/bin/cargo" --version
82+
"$HOME/.cargo/bin/rustc" --version
83+
7084
- name: Rust cache
7185
uses: Swatinem/rust-cache@v2
7286
with:

.github/workflows/publish.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,20 @@ jobs:
176176
with:
177177
targets: ${{ matrix.target }}
178178

179+
- name: Verify cargo resolves to rustup proxy (macOS shim workaround)
180+
if: runner.os == 'macOS'
181+
shell: bash
182+
run: |
183+
# macOS runners (most often `macos-14` ARM, but also observed on
184+
# `macos-latest`/aarch64 builds — see #1136) intermittently expose
185+
# a stale `cargo` on PATH that resolves to `rustup-init`, breaking
186+
# `cargo metadata` invocations from napi-rs. Force the rustup
187+
# proxy bin dir to the front of PATH and fail fast if cargo is
188+
# unhealthy. Applied to all macOS matrix entries as a safety net.
189+
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
190+
"$HOME/.cargo/bin/cargo" --version
191+
"$HOME/.cargo/bin/rustc" --version
192+
179193
- name: Rust cache
180194
uses: Swatinem/rust-cache@v2
181195
with:

0 commit comments

Comments
 (0)