Compare commits

..

4 Commits

Author SHA1 Message Date
Alexei Lozovsky 5c9e3ff532 wat 2021-03-09 23:22:30 +09:00
Alexei Lozovsky 78b8d0d58b extra path 2021-03-09 23:18:16 +09:00
Alexei Lozovsky 34741d07c4 look at env 2021-03-09 22:43:32 +09:00
Alexei Lozovsky dd06567c9a prep 2021-03-09 22:42:36 +09:00
5 changed files with 37 additions and 86 deletions
-19
View File
@@ -1,19 +0,0 @@
name: z5-build-env
channels:
- conda-forge
dependencies:
- cmake
- compilers
- bzip2
- lz4-c
- xz
- zlib
- boost-cpp>=1.63
- xtensor>=0.21,<0.22
- xtensor-python>=0.24,<0.25
- xsimd
- blosc
- imageio
- nlohmann_json
- zarr
- h5py
+13 -18
View File
@@ -6,33 +6,17 @@ on:
branches:
- master
- release/*
- new-windows
- wip/bash
schedule:
- cron: '0 6 * * *'
jobs:
test:
name: default
runs-on: ${{ matrix.windows }}
strategy:
matrix:
windows: [windows-2016, windows-2019]
runs-on: windows-latest
steps:
- name: Check out source code
uses: actions/checkout@v2
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: z5-build-env
auto-update-conda: true
channels: conda-forge
environment-file: .github/workflows/environment.yaml
python-version: 3.7
auto-activate-base: false
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Download Internet
run: npm install
- name: Enable Developer Command Prompt
@@ -42,8 +26,18 @@ jobs:
run: |
cl.exe hello.c
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:
name: npm audit
if: false
runs-on: windows-latest
steps:
- name: Check out source code
@@ -52,6 +46,7 @@ jobs:
- run: npm audit --audit-level=moderate
alias-arch:
name: arch aliases
if: false
runs-on: windows-latest
steps:
- name: Check out source code
+1 -4
View File
@@ -10,10 +10,7 @@ on:
jobs:
test:
name: release
runs-on: ${{ matrix.windows }}
strategy:
matrix:
windows: [windows-2016, windows-2019]
runs-on: windows-latest
steps:
- name: Setup Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
-16
View File
@@ -42,22 +42,6 @@ jobs:
# ...
```
## Caveats
### Name conflicts with `shell: bash`
Using `shell: bash` in Actions may shadow some of the paths added by MSVC.
In particular, `link.exe` (Microsoft C linker) is prone to be shadowed by `/usr/bin/link` (GNU filesystem link tool).
Unfortunately, this happens because GitHub Actions unconditionally *prepend* GNU paths when `shell: bash` is used,
on top of any paths set by `msvc-dev-cmd`, every time at the start of each new step.
Hence, there aren't many non-destructive options here.
If you experience compilation errors where `link` complains about unreasonable command-line arguments,
“extra operand *something-something* that's probably it.
Recommended workaround is to remove `/usr/bin/link` if that interferes with your builds.
If this is not acceptable, please file an issue, then we'll figure out something better.
## License
MIT, see [LICENSE](LICENSE).
+23 -29
View File
@@ -11,6 +11,19 @@ const VERSIONS = ['2019', '2017']
const VSWHERE_PATH = `${PROGRAM_FILES_X86}\\Microsoft Visual Studio\\Installer`
const InterestingVariables = [
'INCLUDE',
'LIB',
'LIBPATH',
'VCINSTALLDIR',
'Path',
'Platform',
'VisualStudioVersion',
/^VCTools/,
/^VSCMD_/,
/^WindowsSDK/i,
]
function findWithVswhere(pattern) {
try {
let installationPath = child_process.execSync(`vswhere -products * -latest -prerelease -property installationPath`).toString().trim()
@@ -98,17 +111,15 @@ function main() {
args.push('-vcvars_spectre_libs=spectre')
}
const vcvars = `"${findVcvarsall()}" ${args.join(' ')}`
core.debug(`vcvars command-line: ${vcvars}`)
const old_environment = child_process.execSync(`set`, {shell: "cmd"}).toString().split('\r\n')
const new_environment = child_process.execSync(`${vcvars} && set`, {shell: "cmd"}).toString().split('\r\n')
const command = `"${findVcvarsall()}" ${args.join(' ')} && set`
core.debug(`Running: ${command}`)
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 new_environment) {
for (let line of environment) {
if (line.match(/^\[ERROR.*\]/)) {
failed = true
// Don't print this particular line which will be confusing in output.
@@ -122,32 +133,15 @@ function main() {
throw new Error('invalid parameters')
}
// Convert old environment lines into a dictionary for easier lookup.
let old_env_vars = {}
for (let string of old_environment) {
for (let string of environment) {
const [name, value] = string.split('=')
old_env_vars[name] = value
}
// Now look at the new environment and export everything that changed.
// These are the variables set by vsvars.bat. Also export everything
// that was not there during the first sweep: those are new variables.
core.startGroup('Environment variables')
for (let string of new_environment) {
// vsvars.bat likes to print some fluff at the beginning.
// Skip lines that don't look like environment variables.
if (!string.includes('=')) {
continue;
}
const [name, new_value] = string.split('=')
const old_value = old_env_vars[name]
// For new variables "old_value === undefined".
if (new_value !== old_value) {
core.info(`Setting ${name}`)
core.exportVariable(name, new_value)
for (let pattern of InterestingVariables) {
if (name.match(pattern)) {
core.exportVariable(name, value)
break
}
}
}
core.endGroup()
core.info(`Configured Developer Command Prompt`)
}