From 2b4b02d9ed29002a9fa33f947060b7879e83f045 Mon Sep 17 00:00:00 2001 From: Laurent Goderre Date: Mon, 7 May 2018 14:36:59 -0400 Subject: [PATCH] test --- appveyor.yml | 11 +++++++---- test-build.ps1 | 26 +++++++++++++++++--------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0909999e70..96632dad98 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,12 @@ version: 1.0.{build} image: Visual Studio 2017 +install: + - ps: Install-PackageProvider -Name NuGet -Force + - ps: Install-Module PsScriptAnalyzer -Force + +before_build: + -ps: Invoke-ScriptAnalyzer -Path '*.ps1' + build_script: - - ps: Install-Package -Name docker -ProviderName DockerMsftProvider -RequiredVersion 17.06.1-ee-1-rc1 -Force - - ps: start-service docker - - docker pull microsoft/windowsservercore - - docker pull microsoft/nanoserver - ps: .\test-build.ps1 diff --git a/test-build.ps1 b/test-build.ps1 index 593d67bc76..712aff2bfd 100755 --- a/test-build.ps1 +++ b/test-build.ps1 @@ -1,18 +1,26 @@ $ErrorActionPreference = 'Stop' +function Build { + param ( $version, $variant, $tag ) + + $path = "" + + Write-Host Building node:$tag-$variant + docker build -t node:$tag-$variant $version/windows/$variant + + $OUTPUT=$(docker run --rm node:$tag-$variant node -e "process.stdout.write(process.versions.node)") + if ( "$OUTPUT" -Ne "$tag" ) { + Write-Error "Test of $tag-$variant failed!" + } else { + Write-Host "Test of $tag-$variant succeeded." + } +} + ForEach ($Dir in dir -directory | where { $_.Name -ne "docs" }) { $tag = ((cat $Dir\windows\windowsservercore\Dockerfile | Select-String -Pattern 'ENV NODE_VERSION') -split ' ')[2] $variants = @('windowsservercore', 'nanoserver') ForEach ($variant in $variants) { - Write-Host Building node:$tag-$variant - docker build -t node:$tag-$variant $Dir/windows/$variant - - $OUTPUT=$(docker run --rm node:$tag-$variant node -e "process.stdout.write(process.versions.node)") - if ( "$OUTPUT" -Ne "$tag" ) { - Write-Error "Test of $tag-$variant failed!" - } else { - Write-Host "Test of $tag-$variant succeeded." - } + Build $Dir $variant $tag } }