File tree Expand file tree Collapse file tree 2 files changed +69
-3
lines changed Expand file tree Collapse file tree 2 files changed +69
-3
lines changed Original file line number Diff line number Diff line change @@ -137,10 +137,32 @@ jobs:
137137 - uses : actions/checkout@v4
138138 with :
139139 fetch-depth : 5
140- - name : Install missing VC tools
140+
141+ - name : Install VSSetup
142+ run : Install-Module VSSetup -Scope CurrentUser
143+ shell : powershell
144+
145+ - name : Show installed toolsets
141146 run : |
142- "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" modify --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" --add Microsoft.VisualStudio.Component.VC.140 --quiet --norestart --nocache
143- shell : cmd
147+ echo "--- All:"
148+ Get-VSSetupInstance -All
149+ echo "--- VC140:"
150+ Get-VSSetupInstance -All | Select-VSSetupInstance -Latest -Require Microsoft.VisualStudio.Component.VC.140
151+ shell : powershell
152+
153+ - if : matrix.toolset == 'v140'
154+ name : Install missing Visual Studio components
155+ run : python .github/workflows/install-vs-components.py
156+
157+ - if : matrix.toolset == 'v140'
158+ name : Show installed toolsets
159+ run : |
160+ echo "--- All:"
161+ Get-VSSetupInstance -All
162+ echo "--- VC140:"
163+ Get-VSSetupInstance -All | Select-VSSetupInstance -Latest -Require Microsoft.VisualStudio.Component.VC.140
164+ shell : powershell
165+
144166 - name : Download optional 3rdparty extras
145167 run : |
146168 curl https://renderdoc.org/qrenderdoc_3rdparty.zip -O
Original file line number Diff line number Diff line change 1+ # Taken from https://github.com/mhammond/pywin32/blob/main/.github/workflows/install-vs-components.py
2+
3+ # See https://github.com/actions/runner-images/issues/9701
4+ # Adapted from https://github.com/actions/runner-images/issues/9873#issuecomment-2139288682
5+
6+ import os
7+ import platform
8+ from itertools import chain
9+ from subprocess import check_call , check_output
10+
11+ os .chdir ("C:/Program Files (x86)/Microsoft Visual Studio/Installer" )
12+ vs_install_path = check_output (
13+ (
14+ "vswhere.exe" ,
15+ "-latest" ,
16+ "-products" ,
17+ "*" ,
18+ "-requires" ,
19+ "Microsoft.Component.MSBuild" ,
20+ "-property" ,
21+ "installationPath" ,
22+ ),
23+ text = True ,
24+ shell = True ,
25+ ).strip ()
26+ components_to_add = (
27+ ["Microsoft.VisualStudio.Component.VC.140" ]
28+ )
29+ args = (
30+ "vs_installer.exe" ,
31+ "modify" ,
32+ "--installPath" ,
33+ vs_install_path ,
34+ * chain .from_iterable ([("--add" , component ) for component in components_to_add ]),
35+ "--quiet" ,
36+ "--norestart" ,
37+ )
38+ print (* args )
39+
40+ # Should be run twice for some reason
41+ print ("First run..." )
42+ check_call (args )
43+ print ("Second run..." )
44+ check_call (args )
You can’t perform that action at this time.
0 commit comments