Skip to content

Commit 3c728fa

Browse files
author
Nie Zhihe
committed
fix: avoid installing through DSC configuration
1 parent a25535e commit 3c728fa

File tree

1 file changed

+72
-11
lines changed

1 file changed

+72
-11
lines changed

.github/workflows/build_node_shared.yml

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,24 +105,85 @@ 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+
# Using direct winget install commands instead of DSC configuration due to compatibility issues in CI environment
108109
- name: Setup Node.js prerequisites with WinGet (Windows)
109110
if: matrix.platform == 'win'
110111
shell: powershell
111112
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
113+
# Avoid installing through DSC configuration due to compatibility issues in CI environment
114+
Write-Host "Installing Node.js build prerequisites with WinGet..."
116115
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"
116+
# Install Python 3.12
117+
Write-Host "`n[1/4] Installing Python 3.12..."
118+
winget install --id Python.Python.3.12 --source winget --silent --accept-package-agreements --accept-source-agreements
120119
121-
Write-Host "Downloading WinGet configuration file..."
122-
Invoke-WebRequest -Uri $configUrl -OutFile $configFile
120+
# Install Git
121+
Write-Host "`n[2/4] Installing Git..."
122+
winget install --id Git.Git --source winget --silent --accept-package-agreements --accept-source-agreements
123123
124-
Write-Host "Installing Node.js prerequisites with WinGet..."
125-
winget configure $configFile --accept-configuration-agreements
124+
# Install NASM (NetWide Assembler) for OpenSSL
125+
Write-Host "`n[3/4] Installing NASM..."
126+
winget install --id Nasm.Nasm --source winget --silent --accept-package-agreements --accept-source-agreements
127+
128+
# Install Visual Studio 2022 Build Tools with required components
129+
# Note: Installing full VS 2022 Community to match the configuration file
130+
Write-Host "`n[4/4] Installing Visual Studio 2022 Community..."
131+
winget install --id Microsoft.VisualStudio.2022.Community --source winget --silent --accept-package-agreements --accept-source-agreements
132+
133+
Write-Host "`nAll WinGet packages installed!"
134+
135+
- name: Install Visual Studio Components (Windows)
136+
if: matrix.platform == 'win'
137+
shell: cmd
138+
run: |
139+
echo Installing required Visual Studio components...
140+
echo This includes: C++ Desktop Development, Clang, and ClangToolset
141+
142+
REM Find VS installer path
143+
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
144+
145+
for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
146+
set "VS_PATH=%%i"
147+
)
148+
149+
echo Visual Studio installation path: %VS_PATH%
150+
151+
REM Use VS installer to add required components
152+
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vs_installer.exe" modify ^
153+
--installPath "%VS_PATH%" ^
154+
--add Microsoft.VisualStudio.Workload.NativeDesktop ^
155+
--add Microsoft.VisualStudio.Component.VC.Llvm.Clang ^
156+
--add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset ^
157+
--includeRecommended ^
158+
--quiet --norestart --wait
159+
160+
echo Visual Studio components installed successfully!
161+
162+
- name: Verify installations (Windows)
163+
if: matrix.platform == 'win'
164+
shell: powershell
165+
run: |
166+
Write-Host "Verifying installed tools:"
167+
Write-Host "=========================="
168+
169+
# Refresh PATH
170+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
171+
172+
Write-Host "`nPython:"
173+
python --version
174+
175+
Write-Host "`nGit:"
176+
git --version
177+
178+
Write-Host "`nNASM:"
179+
nasm -v
180+
181+
Write-Host "`nVisual Studio:"
182+
vswhere -latest -property displayName
183+
vswhere -latest -property installationVersion
184+
185+
Write-Host "`n=========================="
186+
Write-Host "All prerequisites verified!"
126187
127188
- name: Setup MSVC (Windows)
128189
if: matrix.platform == 'win'

0 commit comments

Comments
 (0)