@@ -105,24 +105,86 @@ jobs:
105105 python-version : ' 3.11'
106106
107107 # Reference: https://github.com/nodejs/node/blob/v22.12.0/BUILDING.md#option-2-automated-install-with-winget
108+ # https://raw.githubusercontent.com/nodejs/node/main/.configurations/configuration.dsc.yaml
109+ # Using direct winget install commands instead of DSC configuration due to compatibility issues in CI environment
108110 - name : Setup Node.js prerequisites with WinGet (Windows)
109111 if : matrix.platform == 'win'
110112 shell : powershell
111113 run : |
112- # Install required PowerShell modules for WinGet DSC
113- Write-Host "Installing PowerShell DSC modules required by WinGet configure..."
114- Install-Module -Name Microsoft.WinGet.DSC -Force -AllowClobber -Scope CurrentUser -Repository PSGallery
115- Install-Module -Name Microsoft.VisualStudio.DSC -Force -AllowClobber -Scope CurrentUser -Repository PSGallery
114+ # Avoid installing through DSC configuration due to compatibility issues in CI environment
115+ Write-Host "Installing Node.js build prerequisites with WinGet..."
116116
117- # Download the WinGet configuration file from Node.js repository
118- $configUrl = "https://raw.githubusercontent.com/nodejs/node/main/.configurations/configuration.dsc.yaml "
119- $configFile = "configuration.dsc.yaml"
117+ # Install Python 3.12
118+ Write-Host "`n[1/4] Installing Python 3.12... "
119+ winget install --id Python.Python.3.12 --source winget --silent --accept-package-agreements --accept-source-agreements
120120
121- Write-Host "Downloading WinGet configuration file..."
122- Invoke-WebRequest -Uri $configUrl -OutFile $configFile
121+ # Install Git
122+ Write-Host "`n[2/4] Installing Git..."
123+ winget install --id Git.Git --source winget --silent --accept-package-agreements --accept-source-agreements
123124
124- Write-Host "Installing Node.js prerequisites with WinGet..."
125- winget configure $configFile --accept-configuration-agreements
125+ # Install NASM (NetWide Assembler) for OpenSSL
126+ Write-Host "`n[3/4] Installing NASM..."
127+ winget install --id Nasm.Nasm --source winget --silent --accept-package-agreements --accept-source-agreements
128+
129+ # Install Visual Studio 2022 Build Tools with required components
130+ # Note: Installing full VS 2022 Community to match the configuration file
131+ Write-Host "`n[4/4] Installing Visual Studio 2022 Community..."
132+ winget install --id Microsoft.VisualStudio.2022.Community --source winget --silent --accept-package-agreements --accept-source-agreements
133+
134+ Write-Host "`nAll WinGet packages installed!"
135+
136+ - name : Install Visual Studio Components (Windows)
137+ if : matrix.platform == 'win'
138+ shell : cmd
139+ run : |
140+ echo Installing required Visual Studio components...
141+ echo This includes: C++ Desktop Development, Clang, and ClangToolset
142+
143+ REM Find VS installer path
144+ set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
145+
146+ for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
147+ set "VS_PATH=%%i"
148+ )
149+
150+ echo Visual Studio installation path: %VS_PATH%
151+
152+ REM Use VS installer to add required components
153+ "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vs_installer.exe" modify ^
154+ --installPath "%VS_PATH%" ^
155+ --add Microsoft.VisualStudio.Workload.NativeDesktop ^
156+ --add Microsoft.VisualStudio.Component.VC.Llvm.Clang ^
157+ --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset ^
158+ --includeRecommended ^
159+ --quiet --norestart --wait
160+
161+ echo Visual Studio components installed successfully!
162+
163+ - name : Verify installations (Windows)
164+ if : matrix.platform == 'win'
165+ shell : powershell
166+ run : |
167+ Write-Host "Verifying installed tools:"
168+ Write-Host "=========================="
169+
170+ # Refresh PATH
171+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
172+
173+ Write-Host "`nPython:"
174+ python --version
175+
176+ Write-Host "`nGit:"
177+ git --version
178+
179+ Write-Host "`nNASM:"
180+ nasm -v
181+
182+ Write-Host "`nVisual Studio:"
183+ vswhere -latest -property displayName
184+ vswhere -latest -property installationVersion
185+
186+ Write-Host "`n=========================="
187+ Write-Host "All prerequisites verified!"
126188
127189 - name : Setup MSVC (Windows)
128190 if : matrix.platform == 'win'
0 commit comments