@@ -13,59 +13,33 @@ permissions:
1313
1414jobs :
1515 build-windows :
16- runs-on : windows-latest
16+ runs-on : windows-2022
1717 steps :
1818 - name : Checkout
1919 uses : actions/checkout@v4
2020 with :
2121 ref : ${{ inputs.ref }}
2222
23- - name : Ensure Windows SDK
23+ - name : Verify Windows SDK
2424 shell : pwsh
2525 run : |
2626 $ErrorActionPreference = 'Stop'
27- $kits = "${env:ProgramFiles(x86)}\ Windows Kits\10\Include"
28- if (Test- Path $kits) {
29- Write-Host "Windows SDK already present at: $kits"
30- exit 0
27+ $rootsKey = 'HKLM:\SOFTWARE\Microsoft\ Windows Kits\Installed Roots'
28+ $kitsRoot10 = (Get-ItemProperty - Path $rootsKey -Name KitsRoot10 -ErrorAction SilentlyContinue).KitsRoot10
29+ if (!$kitsRoot10 -or !(Test-Path $kitsRoot10)) {
30+ throw "Windows SDK not detected (KitsRoot10)."
3131 }
3232
33- $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
34- if (!(Test-Path $vswhere)) {
35- throw "vswhere.exe not found at $vswhere"
33+ Write-Host "KitsRoot10: $kitsRoot10"
34+ $includeDir = Join-Path $kitsRoot10 'Include'
35+ if (!(Test-Path $includeDir)) {
36+ throw "Windows SDK Include directory missing: $includeDir"
3637 }
3738
38- $installPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
39- if (!$installPath) {
40- throw "Visual Studio installation not found"
39+ Get-ChildItem $includeDir -Directory | Select-Object -First 5 | ForEach-Object {
40+ Write-Host "SDK include version: $($_.Name)"
4141 }
4242
43- $installer = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vs_installer.exe"
44- if (!(Test-Path $installer)) {
45- throw "vs_installer.exe not found at $installer"
46- }
47-
48- $components = @(
49- "Microsoft.VisualStudio.Component.Windows11SDK.22621",
50- "Microsoft.VisualStudio.Component.Windows11SDK.22000",
51- "Microsoft.VisualStudio.Component.Windows10SDK.22621",
52- "Microsoft.VisualStudio.Component.Windows10SDK.20348",
53- "Microsoft.VisualStudio.Component.Windows10SDK.19041",
54- "Microsoft.VisualStudio.Component.Windows10SDK.18362",
55- "Microsoft.VisualStudio.Component.Windows10SDK.17763"
56- )
57-
58- foreach ($c in $components) {
59- Write-Host "Attempting to add SDK component: $c"
60- & $installer modify --installPath "$installPath" --add $c --quiet --norestart --nocache | Out-Host
61- if (Test-Path $kits) { break }
62- }
63-
64- if (!(Test-Path $kits)) {
65- throw "Windows SDK not found after attempting install. Expected: $kits"
66- }
67- Write-Host "Windows SDK installed at: $kits"
68-
6943 - name : Setup pnpm
7044 uses : pnpm/action-setup@v4
7145 with :
0 commit comments