Skip to content

Commit 83ff8ac

Browse files
authored
QPID-8610: replace forbidden ilammy/msvc-dev-cmd action with calling vswhere.exe directly
1 parent 751fdf0 commit 83ff8ac

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,26 @@ jobs:
3535
python-version: 2.7
3636
architecture: x64
3737

38-
- name: Setup Developer Command Prompt (on Windows)
39-
uses: ilammy/msvc-dev-cmd@v1
38+
# Cannot use https://github.com/ilammy/msvc-dev-cmd/blob/a742a854f54111d83b78e97091b5d85ccdaa3e89/index.js#L163
39+
# as (unapproved) 3rd party GitHub Actions are forbidden on Apache org projects
40+
41+
# https://github.com/microsoft/vswhere
42+
# https://github.com/microsoft/vswhere/blob/c7a417bfb46cd6a1c3e31a91ba51193d7659b6f8/src/vswhere.lib/vswhere.lib.rc#L77
43+
# https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt#using-powershell
44+
# https://renenyffenegger.ch/notes/Windows/dirs/Program-Files-x86/Microsoft-Visual-Studio/version/edition/Common7/Tools/VsDevCmd_bat
45+
# https://renenyffenegger.ch/notes/Windows/dirs/Program-Files-x86/Microsoft-Visual-Studio/version/edition/VC/Auxiliary/Build/vcvarsall_bat
46+
- name: Setup Developer Command Prompt environment (on Windows)
4047
if: runner.os == 'Windows'
41-
with:
42-
arch: x64
48+
run: |
49+
$installationPath = vswhere.exe -prerelease -latest -property installationPath
50+
if ($installationPath -and (test-path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
51+
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -no_logo -arch=x64 && set" | foreach-object {
52+
$name, $value = $_ -split '=', 2
53+
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
54+
Add-Content ${env:GITHUB_ENV} "${name}=${value}"
55+
}
56+
}
57+
shell: pwsh
4358

4459
# it's weird that it needs qpid-python for tests; one would guess this is built in this repo, but it is not
4560
- name: Install python dependencies

0 commit comments

Comments
 (0)