CI: build Windows under pwsh so MSVC's linker is used

Git for Windows puts its usr\bin on PATH ahead of the MSVC tools, so under
Git Bash rustc picked up coreutils link.exe instead of MSVC link.exe and
every link (even host build scripts like proc-macro2/serde) failed with
"/usr/bin/link: extra operand".

Split the build step: non-Windows keeps the bash script (needs --target
handling); Windows builds under pwsh, where the MSVC environment from
msvc-dev-cmd stays at the front of PATH.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Skyler Lehmkuhl 2026-06-21 17:03:43 -04:00
parent 8223593649
commit 1cb821f05b
1 changed files with 14 additions and 0 deletions

View File

@ -170,6 +170,7 @@ jobs:
echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> "$GITHUB_ENV" echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> "$GITHUB_ENV"
- name: Build release binary - name: Build release binary
if: matrix.platform != 'windows-latest'
shell: bash shell: bash
env: env:
FFMPEG_STATIC: "1" FFMPEG_STATIC: "1"
@ -181,6 +182,19 @@ jobs:
fi fi
cargo build --release --bin lightningbeam-editor $TARGET_FLAG cargo build --release --bin lightningbeam-editor $TARGET_FLAG
# Windows must build under pwsh, not Git Bash: Git for Windows puts its
# usr\bin on PATH ahead of the MSVC tools, so its coreutils `link.exe`
# shadows MSVC's linker and rustc fails with "extra operand". pwsh keeps
# the MSVC environment (set by msvc-dev-cmd) at the front of PATH.
- name: Build release binary (Windows)
if: matrix.platform == 'windows-latest'
shell: pwsh
env:
FFMPEG_STATIC: "1"
run: |
cd lightningbeam-ui
cargo build --release --bin lightningbeam-editor
- name: Copy cross-compiled binary to release dir - name: Copy cross-compiled binary to release dir
if: matrix.target != '' if: matrix.target != ''
shell: bash shell: bash