CI: install MSVC build tools on Windows runners that lack them
Build App / compute-version (pull_request) Successful in 4s
Build Container / build-container (pull_request) Successful in 30s
Build App / build-linux (pull_request) Successful in 5m24s
Build App / build-windows (pull_request) Failing after 15m29s
Build App / build-macos (pull_request) Successful in 2m24s
Build App / create-tag (pull_request) Skipped
Build App / sync-to-github (pull_request) Skipped
Build App / compute-version (pull_request) Successful in 4s
Build Container / build-container (pull_request) Successful in 30s
Build App / build-linux (pull_request) Successful in 5m24s
Build App / build-windows (pull_request) Failing after 15m29s
Build App / build-macos (pull_request) Successful in 2m24s
Build App / create-tag (pull_request) Skipped
Build App / sync-to-github (pull_request) Skipped
build-windows failed on this PR with "linker `link.exe` not found", while build-linux and build-container passed — the code was fine, the runner environment was not. The job installs Rust and Node conditionally but assumed the MSVC C++ toolchain was hand-provisioned. A runner without it registers normally, advertises windows-latest, accepts the job, downloads the entire crate graph and only then fails at link time. That also means a bare runner coming online turns a job that would have queued for a capable machine into a failed build. Installs the VC++ workload when vswhere cannot find it, matching the existing conditional Rust and Node steps. rustc locates MSVC through vswhere and the registry rather than PATH, so no dev-shell activation is needed. Installer exit 3010 (success, reboot pending) is treated as success. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -357,6 +357,38 @@ jobs:
|
||||
(Get-Content app/src-tauri/Cargo.toml) -replace '^version = ".*?"', "version = `"$version`"" | Set-Content app/src-tauri/Cargo.toml
|
||||
Write-Host "Patched version to $version"
|
||||
|
||||
- name: Install MSVC C++ build tools
|
||||
shell: cmd
|
||||
run: |
|
||||
rem Tauri links with MSVC, so rustc needs link.exe and the Windows SDK.
|
||||
rem This job previously assumed a hand-provisioned runner; a runner
|
||||
rem without them registers fine, accepts windows-latest jobs, and then
|
||||
rem fails at link time with "linker `link.exe` not found" after having
|
||||
rem already downloaded the whole crate graph.
|
||||
rem
|
||||
rem rustc locates MSVC through vswhere/the registry rather than PATH,
|
||||
rem so installing is sufficient — no dev-shell activation needed here.
|
||||
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
if exist "%VSWHERE%" (
|
||||
"%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath > "%TEMP%\vcpath.txt" 2>nul
|
||||
for /f "usebackq delims=" %%i in ("%TEMP%\vcpath.txt") do set "VCPATH=%%i"
|
||||
)
|
||||
if defined VCPATH (
|
||||
echo MSVC build tools already present at %VCPATH%
|
||||
) else (
|
||||
echo MSVC build tools not found - installing Visual Studio Build Tools
|
||||
curl -fSL -o "%TEMP%\vs_BuildTools.exe" https://aka.ms/vs/17/release/vs_BuildTools.exe || exit /b 1
|
||||
rem 3010 means "installed, reboot pending" and is a success for our purposes.
|
||||
"%TEMP%\vs_BuildTools.exe" --quiet --wait --norestart --nocache ^
|
||||
--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended
|
||||
set "VSEXIT=%ERRORLEVEL%"
|
||||
del "%TEMP%\vs_BuildTools.exe" 2>nul
|
||||
if not "%VSEXIT%"=="0" if not "%VSEXIT%"=="3010" (
|
||||
echo Visual Studio Build Tools installer failed with %VSEXIT%
|
||||
exit /b %VSEXIT%
|
||||
)
|
||||
echo Visual Studio Build Tools installed
|
||||
)
|
||||
- name: Install Rust stable
|
||||
run: |
|
||||
where rustup >nul 2>&1 && (
|
||||
|
||||
Reference in New Issue
Block a user