Compare commits

..

8 Commits

Author SHA1 Message Date
Alexei Lozovsky 25affc65a9 [debug] add missing file 2021-04-29 22:49:54 +09:00
Alexei Lozovsky ed700f61b8 [debug] add this thing that should fail 2021-04-29 22:49:01 +09:00
Alexei Lozovsky 529b6c1c09 [debug] disable release workflow for now 2021-04-29 22:48:20 +09:00
Alexei Lozovsky a7c03318e1 [debug] trigger build 2021-04-29 22:38:05 +09:00
Alexei Lozovsky 73375e968b Run tests on all Windows versions
Some time ago GitHub has introduced an alternative version of Windows
virtual environment. One of those is possibly untested in this repo.
Let's test both of them.

Audit tasks and side tracks are still using "windows-latest" because we
don't particularly care about them. However, main tests should be run
against both versions.

You can find currently supported environments here:
https://github.com/actions/virtual-environments/
2021-04-29 22:35:59 +09: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
5 changed files with 86 additions and 37 deletions
+19
View File
@@ -0,0 +1,19 @@
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
+18 -13
View File
@@ -6,17 +6,33 @@ on:
branches:
- master
- release/*
- wip/bash
- new-windows
schedule:
- cron: '0 6 * * *'
jobs:
test:
name: default
runs-on: windows-latest
runs-on: ${{ matrix.windows }}
strategy:
matrix:
windows: [windows-2016, windows-2019]
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
@@ -26,18 +42,8 @@ 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
@@ -46,7 +52,6 @@ jobs:
- run: npm audit --audit-level=moderate
alias-arch:
name: arch aliases
if: false
runs-on: windows-latest
steps:
- name: Check out source code
+4 -1
View File
@@ -10,7 +10,10 @@ on:
jobs:
test:
name: release
runs-on: windows-latest
runs-on: ${{ matrix.windows }}
strategy:
matrix:
windows: [windows-2016, windows-2019]
steps:
- name: Setup Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
+16
View File
@@ -42,6 +42,22 @@ 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).
+29 -23
View File
@@ -11,19 +11,6 @@ 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()
@@ -111,15 +98,17 @@ function main() {
args.push('-vcvars_spectre_libs=spectre')
}
const command = `"${findVcvarsall()}" ${args.join(' ')} && set`
core.debug(`Running: ${command}`)
const environment = child_process.execSync(command, {shell: "cmd"}).toString().split('\r\n')
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')
// 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) {
for (let line of new_environment) {
if (line.match(/^\[ERROR.*\]/)) {
failed = true
// Don't print this particular line which will be confusing in output.
@@ -133,15 +122,32 @@ function main() {
throw new Error('invalid parameters')
}
for (let string of environment) {
// Convert old environment lines into a dictionary for easier lookup.
let old_env_vars = {}
for (let string of old_environment) {
const [name, value] = string.split('=')
for (let pattern of InterestingVariables) {
if (name.match(pattern)) {
core.exportVariable(name, value)
break
}
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)
}
}
core.endGroup()
core.info(`Configured Developer Command Prompt`)
}