Skip to content

Commit

Permalink
Merge 5cdf02e into 515957a
Browse files Browse the repository at this point in the history
  • Loading branch information
manuth committed Jun 1, 2020
2 parents 515957a + 5cdf02e commit 0d44467
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 96 deletions.
201 changes: 105 additions & 96 deletions appveyor.yml
Expand Up @@ -5,10 +5,10 @@ configuration:
# Test against this version of Node.js
environment:
matrix:
- nodejs_version: "14"
- nodejs_version: "12"
- nodejs_version: "10"
- nodejs_version: "8"
- nodejs_version: "14"
- nodejs_version: "12"
- nodejs_version: "10"
- nodejs_version: "8"
# - nodejs_version: "6"
# - nodejs_version: "4"

Expand All @@ -26,99 +26,108 @@ matrix:
# - x86
# - x64

for:
-
matrix:
only:
- configuration: Native
# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version

# install modules
- ps: >-
if ($env:nodejs_version -eq "4") {
npm install -g npm@3;
init:
# Add a Cmdlet for either running source or wsl depending on the configuration
- ps: mkdir InvokeCI > $null
- ps: >-
echo '
function Invoke-CICommand {
$arguments = [System.Collections.ArrayList]$args
if ($env:CONFIGURATION -eq "WSL") {
$arguments.Insert(0, "wsl");
} else {
if ($arguments[0] -eq "sudo") {
$arguments.RemoveAt(0)
}
}
& $arguments[0] $arguments[1..$($arguments.Count - 1)] 2`>`&1;
}' > InvokeCI/InvokeCI.psm1
- ps: Import-Module ./InvokeCI/InvokeCI.psm1

# Clean up the workspace for git clone
- ps: rm -r InvokeCI

# Install scripts. (runs after repo cloning)
before_build:
# install modules
- ps: >-
if ($env:nodejs_version -eq "4") {
$env:NPM_VERSION="3"
Invoke-CICommand sudo npm install -g npm@3;
}
if ($env:nodejs_version -in @("8", "10", "12")) {
$env:NPM_VERSION="6.10.3"
Invoke-CICommand sudo npm install -g npm@6.10.3;
}
- ci sudo npm install -g npm@%NPM_VERSION%
- ci npm install

# fix symlinks
- git config core.symlinks true
- git reset --hard
- ci git reset --hard

- ps: >-
$resolverDir = "./resolvers";
$env:RESOLVERS=""
Get-ChildItem -Directory $resolverDir |
ForEach {
$env:RESOLVERS += ";$(Resolve-Path $(Join-Path $resolverDir $_))";
}
if ($env:nodejs_version -in @("8", "10", "12")) {
npm install -g npm@6.10.3;
- cmd: >-
FOR %%Path in (%RESOLVERS:;=";"%) do (
pushd %~Path
ci npm install
popd
)
build_script:
- ps: $true

# Post-install test scripts.
test_script:
# Output useful info for debugging.
- ci node --version
- ci npm --version

# core tests
- ci npm run pretest
- ci npm run tests-only

# resolver tests
- ps: >-
$resolverDir = "./resolvers";
$env:RESOLVERS=""
Get-ChildItem -Directory $resolverDir |
ForEach {
$env:RESOLVERS += ";$(Resolve-Path $(Join-Path $resolverDir $_))";
}
- npm install

# fix symlinks
- git config core.symlinks true
- git reset --hard

# todo: learn how to do this for all .\resolvers\* on Windows
- cd .\resolvers\webpack && npm install && cd ..\..
- cd .\resolvers\node && npm install && cd ..\..

# Post-install test scripts.
test_script:
- cmd: >-
FOR %%Path in (%RESOLVERS:;=";"%) do (
pushd %~Path
ci npm test
popd
)
# Output useful info for debugging.
- node --version
- npm --version
on_success:
- ci npm run coveralls

# core tests
- npm run pretest
- npm run tests-only

# resolver tests
- cd .\resolvers\webpack && npm test && cd ..\..
- cd .\resolvers\node && npm test && cd ..\..

on_success:
- npm run coveralls
-
matrix:
only:
- configuration: WSL
# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: $env:WSLENV += ":nodejs_version"
- ps: wsl curl -sL 'https://deb.nodesource.com/setup_${nodejs_version}.x' `| sudo APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 -E bash -
- wsl sudo DEBIAN_FRONTEND=noninteractive apt install -y nodejs

# install modules
- ps: >-
if ($env:nodejs_version -eq "4") {
wsl sudo npm install -g npm@3;
}
if ($env:nodejs_version -in @("8", "10", "12")) {
wsl sudo npm install -g npm@6.10.3;
}
- wsl npm install

# fix symlinks
- git config core.symlinks true
- git reset --hard
# reset new-line characters
- wsl git reset --hard

# todo: learn how to do this for all .\resolvers\* on Windows
- cd .\resolvers\webpack && wsl npm install && cd ..\..
- cd .\resolvers\node && wsl npm install && cd ..\..

# Post-install test scripts.
test_script:

# Output useful info for debugging.
- wsl node --version
- wsl npm --version

# core tests
- wsl npm run pretest
- wsl npm run tests-only

# resolver tests
- cd .\resolvers\webpack && wsl npm test && cd ..\..
- cd .\resolvers\node && wsl npm test && cd ..\..

on_success:
- wsl npm run coveralls

# Don't actually build.
build: off
# Configuration-specific steps
for:
- matrix:
except:
- configuration: WSL
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
- matrix:
only:
- configuration: WSL
# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js
- ps: $env:WSLENV += ":nodejs_version"
- ps: wsl curl -sL 'https://deb.nodesource.com/setup_${nodejs_version}.x' `| sudo APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 -E bash -
- wsl sudo DEBIAN_FRONTEND=noninteractive apt install -y nodejs

build: on
12 changes: 12 additions & 0 deletions scripts/GetCI/GetCI.psm1
@@ -0,0 +1,12 @@
function Get-CICommand {
$arguments = [System.Collections.ArrayList]$args
if ($env:CONFIGURATION -eq "WSL") {
$arguments.Insert(0, "wsl");
} else {
if ($arguments[0] -eq "sudo") {
$arguments.RemoveAt(0)
}
}
$arguments.Insert(0, "echo");
cmd /c $arguments[0] $arguments[1..$($arguments.Count - 1)] 2`>`&1;
}
7 changes: 7 additions & 0 deletions scripts/ci.cmd
@@ -0,0 +1,7 @@
@echo off

For /F "tokens=* usebackq" %%F IN (`powershell -Command "& { Import-Module %~dp0GetCI; Get-CICommand %* }"`) DO (
SET args=%%F
)

cmd /c %args%

0 comments on commit 0d44467

Please sign in to comment.