From d377f7abff5409cdad5ea29919310fe403de9bc1 Mon Sep 17 00:00:00 2001 From: Fabrice de Gans Date: Sat, 4 May 2024 11:17:56 -0700 Subject: [PATCH] [CI] Install only one MSVC toolchain A change in GitHub Actions broke our MSVC build flow due to different toolchains being used at different steps of the build process. While the upstream issue will eventually be fixed, we need to explicitly specify the toolchain version for now. Bug: #1297 --- .github/workflows/visual-studio-build.yml | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/.github/workflows/visual-studio-build.yml b/.github/workflows/visual-studio-build.yml index 5e3220e1..3df781a4 100644 --- a/.github/workflows/visual-studio-build.yml +++ b/.github/workflows/visual-studio-build.yml @@ -37,6 +37,54 @@ jobs: msvc_arch: amd64_arm64 runs-on: windows-latest steps: + # TODO: Remove these 2 steps after May 13, 2024. + # See https://github.com/actions/runner-images/issues/9701 for details. + - name: Delete components + run: | + Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" + $InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" + $componentsToRemove= @( + "Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM.Spectre" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM64" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.ARM64.Spectre" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64.Spectre" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.Spectre" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM.Spectre" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM64" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL.ARM64.Spectre" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.Spectre" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM.Spectre" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM64" + "Microsoft.VisualStudio.Component.VC.14.38.17.8.MFC.ARM64.Spectre" + ) + [string]$workloadArgs = $componentsToRemove | ForEach-Object {" --remove " + $_} + $Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache') + # should be run twice + $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden + $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden + + - name: Install components + run: | + Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" + $InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" + $componentsToAdd= @( + "Microsoft.VisualStudio.Component.VC.14.39.17.9.ARM64" + "Microsoft.VisualStudio.Component.VC.14.39.17.9.ARM64.Spectre" + "Microsoft.VisualStudio.Component.VC.14.39.17.9.x86.x64" + "Microsoft.VisualStudio.Component.VC.14.39.17.9.x86.x64.Spectre" + ) + [string]$workloadArgs = $componentsToAdd | ForEach-Object {" --add " + $_} + $Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache') + # should be run twice + $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden + $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden + - name: Checkout the code uses: actions/checkout@v4 with: