Skip to content

Commit 935bca2

Browse files
committed
fix(ci): improve vswhere MSVC x86 setup to update current process env + better verification
- Use single activation + parse to set both Process env (for current step verification) and GITHUB_ENV (for next steps). - Verification (where cl + version) now runs in the pwsh process *after* env is applied, so logs show what the step actually sees. - Added comments referencing the standard vswhere pattern for GitHub + VS2026. - Kept amd64_x86 (correct for 64-host to 32-target). This should ensure the 32-bit compiler is visible to the subsequent uv sync step. Only the x86 CI fix.
1 parent 0b827ec commit 935bca2

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

.github/workflows/build_app.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
if (-not (Test-Path $vswhere)) {
5454
throw "vswhere.exe not found at $vswhere"
5555
}
56+
# Use vswhere (the official/recommended way for GitHub runners, handles VS 2022 and 2026+)
5657
$installPath = & $vswhere -latest -products * -property installationPath 2>$null | Select-Object -First 1
5758
if (-not $installPath) {
5859
throw "vswhere did not return an installation path"
@@ -63,16 +64,23 @@ jobs:
6364
}
6465
Write-Host "Using vcvarsall: $vcvarsall"
6566
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
67+
# Activate, update *current process* env + export to GITHUB_ENV for next steps.
68+
# This is the robust pattern used by many CI setups for 32-bit builds.
7069
cmd /c "`"$vcvarsall`" amd64_x86 && set" | ForEach-Object {
7170
if ($_ -match '^(.*?)=(.*)$') {
72-
Add-Content -Path $env:GITHUB_ENV -Value "$($matches[1])=$($matches[2])" -Encoding utf8
71+
$n = $matches[1]
72+
$v = $matches[2]
73+
[Environment]::SetEnvironmentVariable($n, $v, 'Process')
74+
Add-Content -Path $env:GITHUB_ENV -Value "$n=$v" -Encoding utf8
7375
}
7476
}
75-
Write-Host "MSVC x86 environment exported to GITHUB_ENV"
77+
78+
# Now verify in the *current* pwsh context (will show in this step's logs)
79+
Write-Host "=== Verifying 32-bit MSVC (for uv sdist win32 builds) ==="
80+
where.exe cl
81+
cl 2>&1 | findstr /C:Version || Write-Host "(cl version not shown)"
82+
Write-Host "========================================================"
83+
Write-Host "MSVC x86 environment applied to current process and exported to GITHUB_ENV"
7684
- name: Install dependencies
7785
working-directory: ${{ github.workspace }}/repo
7886
run: uv sync --frozen --compile --group build --group test

0 commit comments

Comments
 (0)