Commit Graph

52 Commits

Author SHA1 Message Date
Oleksii Lozovskyi 674ff850cb Have "Release" job test release/v1 branch (#61)
Instead of the v1 tag, that is. This makes it possible to push changes
to release/v1 branch and get CI test them without actually moving the
release tag which effectively publishes the updates to users.
2022-10-15 04:10:36 +03:00
Alexei Lozovsky f57be51dee Bump to 1.13.0-dev
Syncing the version because it ticked me off.
2022-10-15 10:03:44 +09:00
Mathias LANG 4734b1a57b Update the action to node 16 (#60)
Node 12 is deprecated and gives off a warning:
https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/
2022-10-15 03:42:27 +03:00
Oleksii Lozovskyi f6f64f2dd6 Remove "node_modules" (#57)
It's needed only on the release branch. No need to pollute development
branches with that. CI is able to "npm install" it back.
2022-08-29 13:50:25 +03:00
Oleksii Lozovskyi fe44a129df Bump @actions/core to 1.9.1 (#56)
Fixes CVE-2022-35954. Does not look like anything terriblity important
to me, but hey, audit is happy.
2022-08-28 10:38:29 +03:00
Amin Yahyaabadi 357f053bad Support specifying the visual studio version (#52)
* feat: support specifying the visual studio version

* fix: add upper bound for vswhere -version
2022-08-28 10:21:09 +03:00
Alexei Lozovsky 9f8ae839b0 Make npm audit happy (#50)
* Upgrade "ansi-regex" 5.0.0 => 5.0.1

And various other stuff because npm can't just upgrade one thing in the
lockfile, it need to upgrade everything it can. Move along, nothing
interesting to see here.

* Upgrade "eslint" 6 => 7

And also unpin the minor version. This resolves a bunch of "critical"
audit advisories from transitive dependencies.
2021-10-07 18:02:35 +03:00
Darrell Wright bb050e7771 Add support for VS2022 (#48)
Check $ProgramFiles too since that's where new stuff goes.
2021-10-07 17:45:10 +03:00
Amin Yahyaabadi f456b805b3 Export setupMSVCDevCmd to allow library usage (#47) 2021-09-16 03:11:51 +03:00
Alexei Lozovsky 74a501b087 Resolve audit warnings (#45)
* Update glob-parent to resolve CVE-2020-28469

* Run audit tasks on Ubuntu runners (they are cheaper)

* Audit only production dependencies

That is, something that can actually affect users of this action.
I don't really want to be bothered with yet another "prototype pollution"
or "denial of service" in transitive dependencies of eslint.

* Audit dev-dependencies for critical vulnerabilities

That said, still audit development dependencies for critical
vulnerabilities if they come along. Hopefully, this should be rare.
2021-06-09 12:25:52 +03:00
Alexei Lozovsky af5661e514 Add "x86-64" to the list of aliases too 2021-05-29 16:55:35 +03:00
Alexei Lozovsky e78ece9a2a Add "x86_64" and "x86-64" aliases for "x64" (#44)
By a popular request...
2021-05-29 16:43:24 +03:00
Mozi 985d494a0f Print the error message from conf scripts at once (#41)
Printing them line by line will generate a bunch of error messages on
the summary page of GitHub Actions workflow. I think it's a bit
annoying.

Note that this change will also affect the format of the final output
error message, but no information will be lost.
2021-05-26 16:32:04 +03:00
Mozi c5426bf30a Separate output content from CMD with form feed (#40)
The command "cls" will produce a '\f' (0x0c, page break or form feed)
character.
2021-05-26 14:53:04 +03:00
Mozi 100402d805 Make eslint work in CI (#42) 2021-05-26 14:51:43 +03:00
Alexei Lozovsky 08b850b4d0 Allow repeated invocation (#37)
* Workaround for repeated invocations

As noted in the comment, repeated invocations of this action might have
caused environment variables to overflow. This cute hack avoid this,
allowing to reconfigure environment.

* Note caveats in README

While this approach mostly works, I still have reservations so let's
leave some cautionary notes.

* Test repeated reconfiguration on CI

Well, let's build our "Hello, world!" four times, for four different
architectures, because why not.
2021-05-08 11:54:58 +03:00
Alexei Lozovsky ff72ae9ce3 Update usage examples (#36)
* Use newer actions/checkout@v2 in examples

That's the current version. Even our own build scripts use it.

* Correct actions syntax

By the way, it's been ages since steps get their own section...

* Provide an example with matrix

Finally, have some example to showcase input usage.

* Move inputs after examples

Since they are more useful, put copy-pastable examples first. Then you
can look at all available inputs, now that you know how to use them.
2021-05-08 11:14:35 +03:00
Alexei Lozovsky f5e8657374 Update npm format and resolve advisories (#35)
Just another day in JavaScriptLand: some "HIGH PRIORITY" vulnerability
has been fixed (CVE-2021-23337). Update our package-lock.json version
too because npm wants that.
2021-05-08 10:51:14 +03:00
Alexei Lozovsky dd5e2fa0a7 Autodetect variables to export (#32)
Instead of using a hardcoded list of variables to export, use a more
smart approach: first inspect the original environment, then look what
variables have changed as a result of "vcvarsall.bat" invocation, and
export all those new values.

Also, log the variables we export to be more debugging-friendly.
2021-03-20 10:49:55 +02:00
Alexei Lozovsky 2962e34b14 Describe conflicts with "shell: bash" (#31) 2021-03-19 14:26:39 +02:00
Frederik Seiffert 38903dd110 Export UCRTVersion and UniversalCRTSdkDir (#30)
These are required to build some components from the Swift toolchain.
2021-03-17 15:27:49 +02:00
Alexei Lozovsky 6f493f9a67 Architecture aliases: Win32 & Win64 (#29)
By a public request, let's support aliases for architecture parameters.
Treat "arch: Win32" as "x86" and "Win64" as "x64".

Test this on CI just in case x86 breaks or something.
2021-03-07 08:23:48 +02:00
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
Ewout ter Hoeven aa2e60900e CI: Cleanup, checkout v2 (#24)
- Remove the fail-fast: tag, it's non-functional since a matrix isn't used anymore
- Update to the faster checkout v2
2021-02-01 14:01:31 +02:00
Alexei Lozovsky 87f7e3e8ba Async cleanup and improved logging (#21)
* Avoid unnecessary async-await

Since this is basically a linear script, we don't *really* need all this
async fluff, despite Node.js having a predisposition for async calls.
For one, it does not make much sense to immediately await an async call.
There is a synchronous version of exec -- execSync -- for that.

Suggested-by: Amin Yahyaabadi <aminyahyaabadi74@gmail.com>

* Make logging more verbose

Provide more insight in what paths are tried and where we have found
Visual Studio. Use info level so that it's visible without Actions
debugging being enabled. That way the users get to see a bit more
of the decision making process.
2020-12-13 08:03:03 +02:00
Alexei Lozovsky d9df5e2567 Add default vswhere location to PATH (#20)
Instead of checking "vswhere" in PATH and then in the default location
explicitly, just add the default locatio to PATH. That makes a single
attempt sufficient.
2020-12-13 07:49:04 +02:00
Alexei Lozovsky ccb28adcc4 Add node_modules on master with up-to-date deps
GitHub Actions tutorials suggest that you should not commit Node.js crap
onto your master branch, but it's not like this action has a lot of
dependencies, and not being able to test "ilammy/msvc-dev-cmd@master" is
so annoying... Therefore, do

    npm install --only production

and commit the results.
2020-12-11 20:05:07 +09:00
Serge Camille 3c1ec87255 Add VCINSTALLDIR to list of exported variables (#23)
This should allow windeployqt to pick up the exported environment variable.
2020-12-11 14:27:22 +09:00
Nicolas Jarnoux 75fbadd7d3 Check default vswhere location too (#19)
On some self-hosted runners "vswhere" is not available in the PATH.
Add another check in the findWithVswhere() function. It checks the
default installation of vswhere as stated by Microsoft, just in case
it is there but just not in the PATH.

Furthermore, the check refers to non-existent method core.warn()
instead of core.warning(). Use the correct method for reporting.
2020-10-18 13:38:45 +03:00
Alexei Lozovsky 840499b504 Avoid slow "vswhere" calls (#14)
Recently added Visual Studio location with "vswhere" seems to be very
slow when using "-find" with path patterns. As in, 5 minutes slow.

vswhere does not provide much insight into why this happens, but I guess
that's because filesystem operations (and search in particular) are not
very fast on Windows.

Improve the search performance by combining vswhere with probing. Use
vswhere to locate the installation root, and then probe around for the
batch script we need.

Also, don't use vswhere for Visual Studio 2015 as it does not seem to
work. Rely only on probing here.

And also, add some debug logs so that it's possible to track which path
has been used, if you're interested in it.
2020-10-03 17:51:55 +03:00
dependabot[bot] ecded17017 Bump @actions/core from 1.2.2 to 1.2.6 (#13)
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.2 to 1.2.6.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-01 22:32:34 +03:00
Amin Yahyaabadi 4b3ec49c71 Use vswhere to find vcvarsall.bat (#11)
The Windows images provided by GitHub have a native program called
"vswhere", which can be used to find vcvarsall.bat.

* use vswhere to find vcvarsall
* don't require child_process twice
* use vswhere to find the 2015 bat file
* refactor findWithVswhere
* move finding vcbuildtools using vswhere upward
* print error of vswhere
2020-09-23 13:20:24 +03:00
dependabot[bot] 8a8bb270fb Bump lodash from 4.17.15 to 4.17.19 (#10)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-18 16:03:34 +03:00
Alexei Lozovsky be0a358ece Look for vcbuildtools.bat of VS 2015 as well (#9)
"Visual C++" has its build tool batch files in a different place.
Let's look there as well if we have not found 2017 or 2019 stuff.

Thanks to ReactOS project for figuring this out.

Co-authored-by: Victor Perevertkin <victor.perevertkin@reactos.org>
2020-06-14 20:55:01 +03:00
Oleh Prypin 5a6b51d5ac Refactor to not use the helper script (#6)
Choose vcvarsall.bat within JS code, call CMD directly with a command instead of writing a temporary file.
2020-05-09 21:24:12 +03:00
ilammy 9269bb4baf Bump transitive dependency versions
Resolve CVE-2020-7598 in minimis -- one of our transitive dependencies.
2020-04-30 21:23:23 +03:00
Nicolas Jarnoux ef0a58bd96 Enable other editions of msvc (#4)
I'll probably use self hosted runners in a project and the Community
version of Visual Studio will be installed on those. This enables the
script to check for Community and Professional editions in addition
to the Entreprise one offered by GitHub.

The modification generates a kinda search map ordered by version then
by edition. It generates the batch script that runs vcvarsall.bat
on the fly given that search map.
2020-04-26 23:54:04 +03:00
ilammy 52e66840de Prepare for next release 2020-03-19 09:03:19 +02:00
ilammy ddf4cb029f Fail audit on moderate and above vulnerabilities
Set the threshold to "moderate" and above. Currently msvc-dev-cmd has
an issue in transitive dev-dependency "minimist" [1] via somewhat long
chain of dependencies:

  - eslint > file-entry-cache > flat-cache > write > mkdirp > minimist
  - eslint > mkdirp > minimist

In order for this to be resolved all these packages need to do something
about their pinned versions. I don't want to sit there with a red build
because of some possible low-severity prototype pollution in dev
dependency. Anything higher -- okay, I'll look at at, and apply a fix
if necessary. (Maybe we should not audit dev dependencies at all...)

This particular vulnerability can be exploited by an attacker who can
submit a pull request and do "something bad"™ to Actions runners
executing jobs for this repository. However, since it's a dev
dependency, nothing will happen to our users. So we can safely ignore
this advisory.

[1]: https://npmjs.com/advisories/1179
2020-03-19 08:41:04 +02:00
ilammy 26cb400781 Run "npm audit" for release branch too
I'd like to be notified about weird vulnerabilities in JavaScript
libraries for the release branch as well. It's double important
since the release branch ships particular pinned version of *all*
dependencies.
2020-03-19 08:34:02 +02:00
Sean Kelly 075328686b Add VisualStudioVersion variable to exports (#3)
This variable seems to be necessary for some build tools like colcon:

https://colcon.readthedocs.io/en/released/
2020-03-19 08:24:49 +02:00
ilammy e6cca73138 Refresh dependencies
"npm audit" started whining about moderate denial of service
vulnerability in a dependency of dependency of dependency
(eslint > espree > acorn). This is not really serious because
we use "eslint" only for development. However, red builds are not good
so bump the pinned version in package.lock. (Released versions are not
affected because they do not include eslint.)
2020-03-12 12:54:03 +02:00
ilammy aa189b6b13 Refresh dependencies
It's not like we need any new features, but let's bump the versions
because we are in JavaScript land.

Also, run "npm audit" regularly, just in case a serious vulnerability
is discovered.
2020-02-12 00:19:19 +02:00
ilammy 164e882247 Integration test for release version
Make sure that the released version is also fine. Run this test every
time a push is made into the release branch as well as on schedule.
2020-02-12 00:00:24 +02:00
ilammy a71277ef87 Use cmd.exe as shell
It works well and we don't need PowerShell which has weird notion of
default executable search path.
2020-02-12 00:00:24 +02:00
ilammy 987899132c Run test job at 06:00 every day
Well, it seems the environment is changing so we'd better run the tests
reguarly to see whether something breaks in a timely manner.

GitHub Actions also don't offer other Windows environments now, only
windows-latest is available. Reduce test matrix to only that.
2020-02-11 23:27:51 +02:00
ilammy 89d8017608 Fix eslint warnings 2019-10-02 01:09:14 +03:00
ilammy 5e81beaeab Correct badge in README 2019-10-02 00:59:07 +03:00
ilammy d33b04e19c Verify configured environment
Try compiling some C code, If it works then we're probably fine.
I don't even try to verify cross-compilation because I don't need it.
It should work, but that's not my problem right now.
2019-10-02 00:53:54 +03:00
ilammy cc105e3302 Initial batch file hack
Again, this is a squashed commit with around three hours of attempts
to write something working. See comments in the file for more details.
I'm too lazy to document this stuff properly.
2019-10-02 00:52:30 +03:00