From 91abffb4d66abd22ba4cb29beb3cde4ba7a7eda6 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 9 Sep 2025 12:34:30 +1000 Subject: [PATCH] github/workflows: Retry Windows VC2017 & 2019 install steps. The Windows 8.1 sdksetup.exe in particular seems seems to fail intermittently pretty often, so retry each step up to four times before failing outright. Delete the Chocolatey temp directory between each run, as it seems like the root cause is a corrupt download. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton --- .github/workflows/ports_windows.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ports_windows.yml b/.github/workflows/ports_windows.yml index 84a93a5043..16396f0fdd 100644 --- a/.github/workflows/ports_windows.yml +++ b/.github/workflows/ports_windows.yml @@ -29,8 +29,10 @@ jobs: include: - visualstudio: '2017' vs_version: '[15, 16)' + custom_vs_install: true - visualstudio: '2019' vs_version: '[16, 17)' + custom_vs_install: true - visualstudio: '2022' vs_version: '[17, 18)' # trim down the number of jobs in the matrix @@ -43,18 +45,17 @@ jobs: env: CI_BUILD_CONFIGURATION: ${{ matrix.configuration }} steps: - - name: Install Visual Studio 2017 - if: matrix.visualstudio == '2017' + - name: Install Visual Studio ${{ matrix.visualstudio }} + if: matrix.custom_vs_install + shell: bash + # Shell functions in this block are to retry intermittent corrupt + # downloads (with a clean download dir) before failing the job outright run: | - choco install visualstudio2017buildtools - choco install visualstudio2017-workload-vctools - choco install windows-sdk-8.1 - - name: Install Visual Studio 2019 - if: matrix.visualstudio == '2019' - run: | - choco install visualstudio2019buildtools - choco install visualstudio2019-workload-vctools - choco install windows-sdk-8.1 + try () { ($@) || ($@) || ($@) || ($@) } + clean_install () ( rm -rf $TEMP/chocolatey; choco install $1 ) + try clean_install visualstudio${{ matrix.visualstudio }}buildtools + try clean_install visualstudio${{ matrix.visualstudio }}-workload-vctools + try clean_install windows-sdk-8.1 - uses: microsoft/setup-msbuild@v2 with: vs-version: ${{ matrix.vs_version }}