diff --git a/appveyor.yml b/appveyor.yml index fdfd0a73a..49ed21b69 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,12 +32,14 @@ install: build_script: - ps: | - Set-Location $env:APPVEYOR_BUILD_FOLDER - ./build.ps1 -Documentation - if ( $env:PSVersion -eq "4" ) { # On WMF4: Also build for v3 to check it builds at least since we do not have a WMF3 image - ./build.ps1 -Configuration "$env:BuildConfiguration" -PSVersion 3 -Framework full + if ( $env:PowerShellEdition -eq 'WindowsPowerShell' ) { + Set-Location $env:APPVEYOR_BUILD_FOLDER + ./build.ps1 -Documentation + if ( $env:PSVersion -eq "4" ) { # On WMF4: Also build for v3 to check it builds at least since we do not have a WMF3 image + ./build.ps1 -Configuration "$env:BuildConfiguration" -PSVersion 3 -Framework full + } + ./build.ps1 -Configuration "$env:BuildConfiguration" -PSVersion "$env:PSVersion" -Framework full } - ./build.ps1 -Configuration "$env:BuildConfiguration" -PSVersion "$env:PSVersion" -Framework full - pwsh: | if ($env:PowerShellEdition -eq 'PowerShellCore') { Set-Location $env:APPVEYOR_BUILD_FOLDER @@ -58,4 +60,4 @@ test_script: # Upload the project along with test results as a zip archive on_finish: - - ps: Import-Module "${env:BuildConfiguration}\tools\appveyor.psm1"; Invoke-AppveyorFinish + - ps: Import-Module "${env:APPVEYOR_BUILD_FOLDER}\tools\appveyor.psm1"; Invoke-AppveyorFinish diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index a65c95b19..3fc8475d8 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -50,11 +50,15 @@ function Invoke-AppveyorTest { $CheckoutPath ) + Write-Verbose -Verbose ("Running tests on PowerShell version " + $PSVersionTable.PSVersion) + $modulePath = $env:PSModulePath.Split([System.IO.Path]::PathSeparator) | Where-Object { Test-Path $_} | Select-Object -First 1 Copy-Item "${CheckoutPath}\out\PSScriptAnalyzer" "$modulePath\" -Recurse -Force $testResultsFile = ".\TestResults.xml" $testScripts = "${CheckoutPath}\Tests\Engine","${CheckoutPath}\Tests\Rules","${CheckoutPath}\Tests\Documentation" $testResults = Invoke-Pester -Script $testScripts -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru + $assemblyLocation = (Get-Command Invoke-ScriptAnalyer).ImplementingType.Assembly.Location + Write-Verbose -Verbose "Engine loaded from $assemblyLocation" (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/${env:APPVEYOR_JOB_ID}", (Resolve-Path $testResultsFile)) if ($testResults.FailedCount -gt 0) { throw "$($testResults.FailedCount) tests failed."