PowerShell/appveyor.yml
Andrew Schwartzmeyer ea5d5c3d05 Switch to netcoreapp1.0
Instead of using `dotnet publish`, we can use `dotnet build` and the new
`netcoreapp1.0` framework with a new dependency on
`Microsoft.NETCore.App` to generate output that does not include the
runtime, but can be run anywhere (given the installation of the
runtime).

While we cannot yet adopt a dependency on the shared host until .NET
Core RTM, we are forced to switch to this system anyway because the
latest RC3 packages and CLI do not support `netstandardapp1.5`. See
dotnet/cli#2482.

Thus we're in an in-between state where we have to use `netcoreapp1.0`,
but cannot use `"Microsoft.NETCore.App": { "type": "platform" }` to
utilize the shared host, as we need to continue to ship our host.
Without specifying "platform", we retain the status quo with respect to
build steps and outputs.

Additionally, there is no longer a good reason to use the RC3 packages,
and it has been advised we switch to RC2 since the
`Microsoft.NETCore.App` is only available for RC2. We must update
packages because our current version can no longer be debugged.
2016-04-25 14:01:44 -07:00

87 lines
3.5 KiB
YAML

image: Visual Studio 2015
version: 0.2.0.{build}
environment:
priv_key:
secure: <encryped-value>
notifications:
- provider: Slack
incoming_webhook:
secure: bwwXBTeJBtRFea6FSQKzVENLwL0AOeusUSUFIh/TeHA4y0UFk7bC9+OcxgZW+YfIC0VZyTpZClJHlPFFHSgiQs4g9om17RxzJEeq4EjsW5g=
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 -- src/windows-build src/Modules/Pester
- ps: Import-Module .\PowerShellGitHubDev.psm1; Start-PSBootstrap
build_script:
- ps: |
$ErrorActionPreference = 'Stop'
Import-Module .\PowerShellGitHubDev.psm1
Start-PSBuild -Publish
Start-PSBuild -FullCLR
test_script:
- ps: |
# fail tests execution, if any PS error detected
$ErrorActionPreference = 'Stop'
#
# CoreCLR
$env:CoreOutput = "$pwd\src\Microsoft.PowerShell.CoreConsoleHost\bin\Debug\netcoreapp1.0\win81-x64\publish"
Write-Host -Foreground Green 'Run CoreCLR tests'
$testResultsFile = "$pwd\TestsResults.xml"
& ("$env:CoreOutput\powershell.exe") -c "Invoke-Pester test/powershell -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 = "$pwd\src\Microsoft.PowerShell.ConsoleHost\bin\Debug\net451"
Write-Host -Foreground Green 'Run FullCLR tests'
$testResultsFileFullCLR = "$pwd\TestsResults.FullCLR.xml"
Start-DevPSGitHub -binDir $env:FullOutput -NoNewWindow -ArgumentList '-command', "Import-Module .\src\Modules\Pester; Invoke-Pester test/fullCLR -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 {
# 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)
@(
# You can add other artifacts here
$zipFilePath,
$zipFileFullPath
) | % {
Write-Host "Pushing package $_ as Appveyor artifact"
Push-AppveyorArtifact $_
}
} catch {
Write-Host -Foreground Red $_
}