Fix typo when getting Core build output location

Fail build if we fail to build PowerShell.exe before running tests
Fail build if we fail to push an artifact because it doesn't exist.
This commit is contained in:
Travis Plunk committed 2016-08-12 12:35:46 -07:00
1 parent 4ba6153c2a
commit 8233b5e332
1 file changed
+19 -2
+19 -2
View File
@@ -38,9 +38,13 @@ test_script:
$ErrorActionPreference = 'Stop'
#
# CoreCLR
$env:CoreOutput = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions -Publish -Configuration $buildConfiguratio))
$env:CoreOutput = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions -Publish -Configuration $buildConfiguration))
Write-Host -Foreground Green 'Run CoreCLR tests'
$testResultsFile = "$pwd\TestsResults.xml"
if(!(Test-Path "$env:CoreOutput\powershell.exe"))
{
throw "CoreCL PowerShell.exe was not built"
}
& ("$env:CoreOutput\powershell.exe") -noprofile -noninteractive -c "Set-ExecutionPolicy -Scope Process Unrestricted; Invoke-Pester test/powershell -Tag 'CI' -ExcludeTag 'Slow' -OutputFormat NUnitXml -OutputFile $testResultsFile"
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile))
@@ -111,10 +115,23 @@ on_finish:
$artifacts += (ls .\nuget-artifacts | % {$_.FullName})
$pushedAllArtifacts = $true
$artifacts | % {
Write-Host "Pushing $_ as Appveyor artifact"
Push-AppveyorArtifact $_
if(Test-Path $_)
{
Push-AppveyorArtifact $_
}
else
{
$pushedAllArtifacts = $false
Write-Warning "Artifact $_ does not exist."
}
}
if(!$pushedAllArtifacts)
{
throw "Some artifacts did not exist!"
}
} catch {
Write-Host -Foreground Red $_
}