From da4fe0472f8a87b8d620d0e297be62826f64506b Mon Sep 17 00:00:00 2001 From: Caelan Sayler Date: Thu, 16 May 2024 23:04:36 +0100 Subject: [PATCH] ci: try explicitly installing x86 build tools --- .github/workflows/build.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d47edc3..8e726d06 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,6 +23,20 @@ jobs: run: | rustup update rustc --version + # https://github.com/actions/runner-images/issues/9701 + - name: Install missing MSVC components + if: ${{ matrix.os == 'windows-latest' }} + 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.Tools.x86.x64" + ) + [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 - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -62,6 +76,20 @@ jobs: run: | rustup update rustc --version + # https://github.com/actions/runner-images/issues/9701 + - name: Install missing MSVC components + if: ${{ matrix.os == 'windows-latest' }} + 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.Tools.x86.x64" + ) + [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 - uses: actions/checkout@v4 with: fetch-depth: 0