History

Install Spectre MSVC libs for Windows release builds

- Fix Windows release artifact builds by adding the Spectre-mitigated MSVC components - Verify the libraries are installed before continuing - Co-authored-by: codex <codex@users.noreply.github.com>

Julius Marminge committed 7 months ago

Commit 3631d0a1 parent 505db9f1 file · +54 −0Browse files

Showing the changes to .github (1 of 1 file). Show all

Unified · Split

.github/workflows/release.yml+54−0
@@ -188,6 +188,60 @@ jobs: · 187 unmodified lines
188188 - name: Align package versions to release version
189189 run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
190190
191+ - name: Install VS 2022 Spectre-mitigated MSVC libraries
192+ if: runner.os == 'Windows'
193+ shell: pwsh
194+ run: |
195+ $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
196+ $setup = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe"
197+ $spectreComponent = "Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre"
198+
199+ if (-not (Test-Path $vswhere)) {
200+ throw "vswhere.exe not found at $vswhere"
201+ }
202+
203+ if (-not (Test-Path $setup)) {
204+ throw "Visual Studio installer setup.exe not found at $setup"
205+ }
206+
207+ $existingSpectreInstall = & $vswhere -products * -requires $spectreComponent -property installationPath
208+ if ($LASTEXITCODE -ne 0) {
209+ throw "vswhere failed while checking for $spectreComponent"
210+ }
211+
212+ if ($existingSpectreInstall) {
213+ Write-Host "Spectre-mitigated MSVC libraries already installed at $existingSpectreInstall"
214+ exit 0
215+ }
216+
217+ $installPath = & $vswhere -products * -requires Microsoft.Component.MSBuild -property installationPath
218+ if ($LASTEXITCODE -ne 0) {
219+ throw "vswhere failed while locating the Visual Studio Build Tools installation"
220+ }
221+
222+ if (-not $installPath) {
223+ throw "Could not find a Visual Studio Build Tools installation to modify"
224+ }
225+
226+ Write-Host "Installing $spectreComponent into $installPath"
227+ & $setup modify `
228+ --installPath $installPath `
229+ --add $spectreComponent `
230+ --quiet `
231+ --wait `
232+ --norestart
233+
234+ if ($LASTEXITCODE -ne 0) {
235+ throw "Visual Studio installer failed with exit code $LASTEXITCODE"
236+ }
237+
238+ $verifiedInstall = & $vswhere -products * -requires $spectreComponent -property installationPath
239+ if (-not $verifiedInstall) {
240+ throw "$spectreComponent was not detected after installation"
241+ }
242+
243+ Write-Host "Installed Spectre-mitigated MSVC libraries at $verifiedInstall"
244+
191245 - name: Build desktop artifact
192246 shell: bash
193247 env: