103 lines
4.0 KiB
YAML
103 lines
4.0 KiB
YAML
version: 0.5.0.{build}
|
|
|
|
nuget:
|
|
project_feed: true
|
|
|
|
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/Modules/Pester
|
|
- ps: Import-Module .\build.psm1; Start-PSBootstrap
|
|
|
|
build_script:
|
|
- 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"
|
|
& ("$env:CoreOutput\powershell.exe") -noprofile -noninteractive -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 = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions -FullCLR))
|
|
Write-Host -Foreground Green 'Run FullCLR tests'
|
|
$testResultsFileFullCLR = "$pwd\TestsResults.FullCLR.xml"
|
|
Start-DevPSGitHub -binDir $env:FullOutput -NoNewWindow -ArgumentList '-noprofile', '-noninteractive', '-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"
|
|
}
|
|
#
|
|
# Portable module test
|
|
Write-Host -Foreground Green 'Test use of cross-platform binary module'
|
|
Import-Module ./docs/cmdlet-example/bin/Debug/netstandard1.3/SendGreeting.dll
|
|
Send-Greeting -Name World
|
|
|
|
|
|
on_finish:
|
|
- ps: |
|
|
$ErrorActionPreference = 'Stop'
|
|
try {
|
|
# Build packages
|
|
$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)
|
|
|
|
$artifacts = New-Object System.Collections.ArrayList
|
|
foreach ($package in $packages) {
|
|
$artifacts.Add($package)
|
|
}
|
|
|
|
$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 $_
|
|
}
|