PowerShell7/appveyor.yml

96 lines
3.7 KiB
YAML
Raw Normal View History

2016-07-13 20:56:39 +00:00
version: 0.6.0.{build}
cache:
- '%LocalAppData%\Microsoft\dotnet'
2016-05-20 03:56:48 +00:00
nuget:
project_feed: true
environment:
priv_key:
secure: <encryped-value>
install:
- ps: $fileContent = "-----BEGIN RSA PRIVATE KEY-----`n"
- ps: $fileContent += $env:priv_key.Replace(' ', "`n")
- ps: $fileContent += "`n-----END RSA PRIVATE KEY-----`n"
- ps: Set-Content c:\users\appveyor\.ssh\id_rsa $fileContent
- git config --global url.git@github.com:.insteadOf https://github.com/
- git submodule update --init
- ps: Import-Module .\build.psm1; Start-PSBootstrap
build_script:
2016-02-22 00:24:50 +00:00
- ps: |
$ErrorActionPreference = 'Stop'
Start-PSBuild -Publish
Start-PSBuild -FullCLR
test_script:
- ps: |
# fail tests execution, if any PS error detected
$ErrorActionPreference = 'Stop'
#
# CoreCLR
$env:CoreOutput = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions -Publish))
Write-Host -Foreground Green 'Run CoreCLR tests'
$testResultsFile = "$pwd\TestsResults.xml"
2016-07-19 23:47:48 +00:00
& ("$env:CoreOutput\powershell.exe") -noprofile -noninteractive -c "Invoke-Pester test/powershell -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))
#
# FullCLR
$env:FullOutput = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions -FullCLR))
Write-Host -Foreground Green 'Run FullCLR tests'
$testResultsFileFullCLR = "$pwd\TestsResults.FullCLR.xml"
2016-07-19 23:47:48 +00:00
Start-DevPowerShell -NoNewWindow -ArgumentList '-noprofile', '-noninteractive' -Command "Invoke-Pester test/fullCLR -ExcludeTag 'Slow' -OutputFormat NUnitXml -OutputFile $testResultsFileFullCLR"
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFileFullCLR))
#
# Fail the build, if tests failed
Write-Host -Foreground Green 'Upload CoreCLR test results'
$x = [xml](cat -raw $testResultsFile)
if ([int]$x.'test-results'.failures -gt 0)
{
throw "$($x.'test-results'.failures) tests in test/powershell failed"
}
Write-Host -Foreground Green 'Upload FullCLR test results'
$x = [xml](cat -raw $testResultsFileFullCLR)
if ([int]$x.'test-results'.failures -gt 0)
{
throw "$($x.'test-results'.failures) tests in test/fullCLR failed"
}
on_finish:
- ps: |
$ErrorActionPreference = 'Stop'
try {
2016-06-02 17:37:16 +00:00
# Build packages
2016-06-02 17:31:02 +00:00
$packages = Start-PSPackage
# Creating project artifact
$name = git describe
$zipFilePath = Join-Path $pwd "$name.zip"
$zipFileFullPath = Join-Path $pwd "$name.FullCLR.zip"
Add-Type -assemblyname System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory($env:CoreOutput, $zipFilePath)
[System.IO.Compression.ZipFile]::CreateFromDirectory($env:FullOutput, $zipFileFullPath)
2016-06-02 17:31:02 +00:00
$artifacts = New-Object System.Collections.ArrayList
2016-06-02 17:37:16 +00:00
foreach ($package in $packages) {
$artifacts.Add($package)
}
2016-06-02 17:37:16 +00:00
$artifacts.Add($zipFilePath)
$artifacts.Add($zipFileFullPath)
Publish-NuGetFeed -OutputPath .\nuget-artifacts -VersionSuffix "b$($env:APPVEYOR_BUILD_NUMBER)"
$artifacts += (ls .\nuget-artifacts | % {$_.FullName})
$artifacts | % {
Write-Host "Pushing $_ as Appveyor artifact"
Push-AppveyorArtifact $_
}
} catch {
Write-Host -Foreground Red $_
}