humbletim / vsdevenv-shell

Provides a custom shell for invoking individual job steps within a Visual Studio vsdevcmd.bat developer environment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vsdevenv-shell v1

test vsdevenv-shell

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, or arm64 (see Microsoft vsdevcmd.bat documentation)
  • subshell can be bash, cmd, pwsh, powershell

A more detailed example

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.

See also:

About

Provides a custom shell for invoking individual job steps within a Visual Studio vsdevcmd.bat developer environment.

License:MIT License


Languages

Language:Batchfile 77.1%Language:Shell 13.1%Language:C++ 5.5%Language:CMake 4.3%