Skip to content

Commit d980cb4

Browse files
committed
8306658: GHA: MSVC installation could be optional since it might already be pre-installed
Reviewed-by: shade, goetz
1 parent 62acc88 commit d980cb4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

.github/workflows/build-windows.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,26 @@ jobs:
9898
id: gtest
9999
uses: ./.github/actions/get-gtest
100100

101+
- name: 'Check toolchain installed'
102+
id: toolchain-check
103+
run: |
104+
set +e
105+
'/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/vc/auxiliary/build/vcvars64.bat' -vcvars_ver=${{ inputs.msvc-toolset-version }}
106+
if [ $? -eq 0 ]; then
107+
echo "Toolchain is already installed"
108+
echo "toolchain-installed=true" >> $GITHUB_OUTPUT
109+
else
110+
echo "Toolchain is not yet installed"
111+
echo "toolchain-installed=false" >> $GITHUB_OUTPUT
112+
fi
113+
101114
- name: 'Install toolchain and dependencies'
102115
run: |
103116
# Run Visual Studio Installer
104117
'/c/Program Files (x86)/Microsoft Visual Studio/Installer/vs_installer.exe' \
105118
modify --quiet --installPath 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise' \
106119
--add Microsoft.VisualStudio.Component.VC.${{ inputs.msvc-toolset-version }}.${{ inputs.msvc-toolset-architecture }}
120+
if: steps.toolchain-check.outputs.toolchain-installed != 'true'
107121

108122
- name: 'Configure'
109123
run: >

0 commit comments

Comments
 (0)