Compare commits

..

2 Commits

Author SHA1 Message Date
Alexei Lozovsky ac2ceb2811 show me the env 2021-03-07 13:51:48 +09:00
Alexei Lozovsky cdfca13739 test only this branch 2021-03-07 13:51:40 +09:00
3 changed files with 9 additions and 61 deletions
+7 -28
View File
@@ -6,7 +6,7 @@ on:
branches: branches:
- master - master
- release/* - release/*
- wip/bash - wip/path-test
schedule: schedule:
- cron: '0 6 * * *' - cron: '0 6 * * *'
@@ -19,22 +19,19 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Download Internet - name: Download Internet
run: npm install run: npm install
- name: What's in the env?
shell: cmd
run: set
- name: Enable Developer Command Prompt - name: Enable Developer Command Prompt
uses: ./ uses: ./
- name: What's in the env now?
shell: cmd
run: set
- name: Compile and run some C code - name: Compile and run some C code
shell: cmd shell: cmd
run: | run: |
cl.exe hello.c cl.exe hello.c
hello.exe hello.exe
- name: Extra path
shell: bash
run: echo "C:\\foo" >> $GITHUB_PATH
- name: Check out bash env
shell: bash
run: |
env
which link || :
which cl || :
audit: audit:
name: npm audit name: npm audit
if: false if: false
@@ -44,21 +41,3 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- run: npm install - run: npm install
- run: npm audit --audit-level=moderate - run: npm audit --audit-level=moderate
alias-arch:
name: arch aliases
if: false
runs-on: windows-latest
steps:
- name: Check out source code
uses: actions/checkout@v2
- name: Download Internet
run: npm install
- name: Enable Developer Command Prompt
uses: ./
with:
arch: Win32
- name: Compile and run some C code
shell: cmd
run: |
cl.exe hello.c
hello.exe
+1 -3
View File
@@ -11,9 +11,7 @@ Supports Windows. Does nothing on Linux and macOS.
## Inputs ## Inputs
- `arch` target architecture - `arch` target architecture
- native compilation: - native compilation: `x86`, `x64` (default), `amd64` (synonym for x64)
- `x64` (default) or its synonyms: `amd64`, `win64`
- `x86` or its synonyms: `win32`
- cross-compilation: `x86_amd64`, `x86_arm`, `x86_arm64`, - cross-compilation: `x86_amd64`, `x86_arm`, `x86_arm64`,
`amd64_x86`, `amd64_arm`, `amd64_arm64` `amd64_x86`, `amd64_arm`, `amd64_arm64`
- `sdk` Windows SDK to use - `sdk` Windows SDK to use
+1 -30
View File
@@ -77,23 +77,12 @@ function main() {
// Add standard location of "vswhere" to PATH, in case it's not there. // Add standard location of "vswhere" to PATH, in case it's not there.
process.env.PATH += path.delimiter + VSWHERE_PATH process.env.PATH += path.delimiter + VSWHERE_PATH
var arch = core.getInput('arch') const arch = core.getInput('arch')
const sdk = core.getInput('sdk') const sdk = core.getInput('sdk')
const toolset = core.getInput('toolset') const toolset = core.getInput('toolset')
const uwp = core.getInput('uwp') const uwp = core.getInput('uwp')
const spectre = core.getInput('spectre') const spectre = core.getInput('spectre')
// There are all sorts of way the architectures are called. In addition to
// values supported by Microsoft Visual C++, recognize some common aliases.
let arch_aliases = {
"win32": "x86",
"win64": "x64",
}
// Ignore case when matching as that's what humans expect.
if (arch.toLowerCase() in arch_aliases) {
arch = arch_aliases[arch.toLowerCase()]
}
// Due to the way Microsoft Visual C++ is configured, we have to resort to the following hack: // Due to the way Microsoft Visual C++ is configured, we have to resort to the following hack:
// Call the configuration batch file and then output *all* the environment variables. // Call the configuration batch file and then output *all* the environment variables.
@@ -115,24 +104,6 @@ function main() {
core.debug(`Running: ${command}`) core.debug(`Running: ${command}`)
const environment = child_process.execSync(command, {shell: "cmd"}).toString().split('\r\n') const environment = child_process.execSync(command, {shell: "cmd"}).toString().split('\r\n')
// If vsvars.bat is given an incorrect command line, it will print out
// an error and *still* exit successfully. Parse out errors from output
// which don't look like environment variables, and fail if appropriate.
var failed = false
for (let line of environment) {
if (line.match(/^\[ERROR.*\]/)) {
failed = true
// Don't print this particular line which will be confusing in output.
if (line.match(/Error in script usage. The correct usage is:$/)) {
continue
}
core.error(line)
}
}
if (failed) {
throw new Error('invalid parameters')
}
for (let string of environment) { for (let string of environment) {
const [name, value] = string.split('=') const [name, value] = string.split('=')
for (let pattern of InterestingVariables) { for (let pattern of InterestingVariables) {