This action enables individual job steps to be executed from within a Visual Studio Developer Command Prompt environment.
Similar to other available Visual Studio actions, it is referenced into a workflow via uses
. However, by design it does not modify the global CI/CD environment, so instead it can and must be selectively applied to individual build steps as a custom shell
:
Conceptual example:
- name: my build step
- - shell: bash
+ - shell: vsdevenv x64 bash {0}
run: |
- echo "stock environment"
+ echo "stock environment + visual studio dev tools"
The shell integration pattern is: shell: vsdevenv <arch> <subshell> {0}
(and the trailing "{0}" is required -- it's part of how GitHub Actions detects use of Custom Shells in general).
- arch can be
x64
(amd64
),x86
,arm
, orarm64
(see Microsoft vsdevcmd.bat documentation) - subshell can be
bash
,cmd
,pwsh
,powershell
note: if new to GitHub Actions please see GitHub Help Documentation Quickstart or Creating a workflow file.
name: test vsdevenv-shell integration
jobs:
main:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: humbletim/vsdevenv-shell@v1
- name: regular build step
shell: bash
run: |
echo "clean job environment (no dev tools)"
echo "$(env | wc -l) environment variables defined"
- name: build step executed within x64 Native Developer Tools env
shell: vsdevenv x64 bash {0}
run: |
echo "$(env | wc -l) environment variables defined"
cl.exe # <-- (as specified) cl.exe is only available to this step
- name: regular build step
shell: bash
run: |
echo "clean job environment (no dev tools)"
echo "$(env | wc -l) environment variables defined"
For additional examples please see this action's .github/workflows/ci.yml integration tests.