Alexei Lozovsky 754fb4dc40 Detect and report vcvarsall.bat errors (#28)
If the parameters passed to the script are incorrect -- for example,
architecture is set to something the script does not understand --
then the script will print an error message *and* exit successfully
without doing anything useful.

Detect the error messages, forward them to the user, and fail the
action. Hopefully, the information from the script will be enough
to pinpoint the source of the issue.

For example, if the action is run

    with:
      arch: Win32

then the output will be

    Found with vswhere: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat
    Error: [ERROR:vcvarsall.bat] Invalid argument found : Win32
    Error: Could not setup Developer Command Prompt: invalid parameters

which is close enough.
2021-03-07 08:16:28 +02:00
2019-10-01 22:15:47 +03:00
2019-10-01 22:15:47 +03:00
2019-10-01 22:15:47 +03:00
2019-10-02 00:53:54 +03:00
2019-10-01 22:15:47 +03:00
2020-03-19 09:03:19 +02:00
2019-10-02 00:59:07 +03:00

GitHub Actions status

msvc-dev-cmd

GitHub Action for configuring Developer Command Prompt for Microsoft Visual C++.

This sets up the environment for compiling C/C++ code from command line.

Supports Windows. Does nothing on Linux and macOS.

Inputs

  • arch target architecture
    • native compilation: x86, x64 (default), amd64 (synonym for x64)
    • cross-compilation: x86_amd64, x86_arm, x86_arm64, amd64_x86, amd64_arm, amd64_arm64
  • sdk Windows SDK to use
    • do not specify to use the default SDK
    • or specify full Windows 10 SDK number (e.g, 10.0.10240.0)
    • or write 8.1 to use Windows 8.1 SDK
  • toolset select VC++ compiler toolset version
    • do not specify to use the default toolset
    • 14.0 for VC++ 2015 Compiler Toolset
    • 14.XX for the latest 14.XX toolset installed (e.g, 14.11)
    • 14.XX.YYYYY for a specific full version number (e.g, 14.11.25503)
  • uwp set true to build for Universal Windows Platform (i.e., for Windows Store)
  • spectre set true to use Visual Studio libraries with Spectre mitigations

Example usage

jobs:
  test:
    - uses: actions/checkout@v1
    - uses: ilammy/msvc-dev-cmd@v1
    - name: Build something requiring CL.EXE
      run: |
        cmake -G "NMake Makefiles" .
        nmake
    # ...

License

MIT, see LICENSE.

S
Description
Languages
JavaScript 98.9%
C 1.1%