Skip to content

Commit 91abffb

Browse files
projectgusdpgeorge
authored andcommitted
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 <angus@redyak.com.au>
1 parent 0d9aafd commit 91abffb

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

.github/workflows/ports_windows.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ jobs:
2929
include:
3030
- visualstudio: '2017'
3131
vs_version: '[15, 16)'
32+
custom_vs_install: true
3233
- visualstudio: '2019'
3334
vs_version: '[16, 17)'
35+
custom_vs_install: true
3436
- visualstudio: '2022'
3537
vs_version: '[17, 18)'
3638
# trim down the number of jobs in the matrix
@@ -43,18 +45,17 @@ jobs:
4345
env:
4446
CI_BUILD_CONFIGURATION: ${{ matrix.configuration }}
4547
steps:
46-
- name: Install Visual Studio 2017
47-
if: matrix.visualstudio == '2017'
48+
- name: Install Visual Studio ${{ matrix.visualstudio }}
49+
if: matrix.custom_vs_install
50+
shell: bash
51+
# Shell functions in this block are to retry intermittent corrupt
52+
# downloads (with a clean download dir) before failing the job outright
4853
run: |
49-
choco install visualstudio2017buildtools
50-
choco install visualstudio2017-workload-vctools
51-
choco install windows-sdk-8.1
52-
- name: Install Visual Studio 2019
53-
if: matrix.visualstudio == '2019'
54-
run: |
55-
choco install visualstudio2019buildtools
56-
choco install visualstudio2019-workload-vctools
57-
choco install windows-sdk-8.1
54+
try () { ($@) || ($@) || ($@) || ($@) }
55+
clean_install () ( rm -rf $TEMP/chocolatey; choco install $1 )
56+
try clean_install visualstudio${{ matrix.visualstudio }}buildtools
57+
try clean_install visualstudio${{ matrix.visualstudio }}-workload-vctools
58+
try clean_install windows-sdk-8.1
5859
- uses: microsoft/setup-msbuild@v2
5960
with:
6061
vs-version: ${{ matrix.vs_version }}

0 commit comments

Comments
 (0)