forked from PowerShell/platyPS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
52 lines (46 loc) · 1.87 KB
/
appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
version: 0.7.6.{build}
install:
- ps: |
Write-Host "PowerShell Version:" $PSVersionTable.PSVersion.tostring()
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module Pester -Force
init:
- git config --global core.autocrlf true
before_build:
- nuget restore
build_script:
- ps: |
$ErrorActionPreference = 'Stop'
Update-Help # we need up-to-date help content for tests
.\build.ps1 -Configuration Release
after_test:
- ps: |
# We run Pester tests in after_test step
# we don't want to use test_script so Xunit tests just run
# appveyor doesn't run after_test, if tests failed.
#
# Pester tests produce artifacts in .\out directory
$pesterTestResultsFile = ".\TestsResults.xml"
$res = Invoke-Pester -OutputFormat NUnitXml -OutputFile $pesterTestResultsFile -PassThru
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $pesterTestResultsFile))
# Trying to fail the build
if ($res.FailedCount -gt 0) {
throw "$($res.FailedCount) tests failed."
}
on_finish:
- ps: |
$ErrorActionPreference = 'Stop'
try {
$stagingDirectory = (Resolve-Path ..).Path
$zipFile = Join-Path $stagingDirectory "platyPS-$($env:APPVEYOR_BUILD_VERSION).zip"
Add-Type -assemblyname System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory("$pwd\out\platyPS", $zipFile)
@(
# You can add other artifacts here
(ls $zipFile),
(ls .\out -File)
# flattering
) | % {$_} | ? {$_} |% { Push-AppveyorArtifact $_.FullName }
} catch {
Write-Host -Foreground Red $_
}