Skip to content

Commit 0b827ec

Browse files
committed
fix(ci): use vswhere to locate and activate MSVC for x86 on windows-2025
The x86 (32-bit) build fails at Install dependencies because packages such as pyyaml and greenlet have no cp314-win32 wheels and must be built from sdist, requiring a 32-bit MSVC toolchain. Root cause on current runners: - windows-2025 now ships Visual Studio 2026 (paths under Microsoft Visual Studio\18\Enterprise, not 2022). - Previous hardcoded "2022" discovery failed to locate vcvarsall.bat. - ilammy/msvc-dev-cmd is Node-20 based and deprecated on Node 24. Proper solution (standard in GitHub Actions + VS 2022/2026 CI): - Use vswhere.exe (official locator) to dynamically find the current installationPath (handles any VS version/edition). - Activate with amd64_x86 (64-bit host tools for 32-bit target). - Verify in logs (where cl + version output). - Export env (PATH/INCLUDE/LIB) via GITHUB_ENV for uv sync --compile. Implemented with pwsh + child cmd for vcvars (no external action). Only this CI x86 fix; no dep changes.
1 parent 2b8fbfa commit 0b827ec

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

.github/workflows/build_app.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,35 @@ jobs:
4444
with:
4545
python-version: 'cpython-3.14-windows-${{ matrix.arch }}-none'
4646
working-directory: ${{ github.workspace }}/repo
47+
- name: Setup MSVC for x86
48+
if: matrix.arch == 'x86'
49+
shell: pwsh
50+
run: |
51+
$ErrorActionPreference = 'Stop'
52+
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
53+
if (-not (Test-Path $vswhere)) {
54+
throw "vswhere.exe not found at $vswhere"
55+
}
56+
$installPath = & $vswhere -latest -products * -property installationPath 2>$null | Select-Object -First 1
57+
if (-not $installPath) {
58+
throw "vswhere did not return an installation path"
59+
}
60+
$vcvarsall = Join-Path $installPath 'VC\Auxiliary\Build\vcvarsall.bat'
61+
if (-not (Test-Path $vcvarsall)) {
62+
throw "vcvarsall.bat not found at $vcvarsall (installPath=$installPath)"
63+
}
64+
Write-Host "Using vcvarsall: $vcvarsall"
65+
66+
# Activate and verify in a child cmd (prints to logs)
67+
cmd /c "`"$vcvarsall`" amd64_x86 && echo === Verifying 32-bit MSVC (for uv sdist win32 builds) === && where cl && cl 2>&1 | findstr /C:Version && echo ============================================"
68+
69+
# Export environment for subsequent steps
70+
cmd /c "`"$vcvarsall`" amd64_x86 && set" | ForEach-Object {
71+
if ($_ -match '^(.*?)=(.*)$') {
72+
Add-Content -Path $env:GITHUB_ENV -Value "$($matches[1])=$($matches[2])" -Encoding utf8
73+
}
74+
}
75+
Write-Host "MSVC x86 environment exported to GITHUB_ENV"
4776
- name: Install dependencies
4877
working-directory: ${{ github.workspace }}/repo
4978
run: uv sync --frozen --compile --group build --group test

0 commit comments

Comments
 (0)