-
Notifications
You must be signed in to change notification settings - Fork 8
/
appveyor.yml
65 lines (54 loc) · 2.11 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
53
54
55
56
57
58
59
60
61
62
63
64
65
image:
- "Visual Studio 2017"
- "Ubuntu"
environment:
CA_KEY:
secure: coNAepwqm5KC1dqYwQvxPxw/qvxI7RuhCBTHZujJUufj3pI+KqIOCKs5Z86uzHvf
branches:
only:
- master
init:
install:
- ps: |
Install-Module Pester -MinimumVersion 4.0.8 -MaximumVersion 4.99.99 -Scope CurrentUser -Force -SkipPublisherCheck | Out-Null
if (($PSVersionTable.PSVersion.Major -le 5) -or $IsWindows) {
Install-Module Coveralls -MinimumVersion 1.0.5 -Scope CurrentUser -Force
}
"Git version: $(git --version)"
"PSVersion: $($PSVersionTable.PSVersion), build: $($PSVersionTable.BuildVersion), clr version: $($PSVersionTable.ClrVersion)"
"Host name: $($Host.Name)"
build: false
test_script:
- ps: |
$testResultsFile = Join-Path $Env:APPVEYOR_BUILD_FOLDER TestResults.xml
$pesterParams = @{
Script = "$Env:APPVEYOR_BUILD_FOLDER\test"
OutputFile = $testResultsFile
OutputFormat = "NUnitXml"
PassThru = $true
Verbose = $VerbosePreference
}
Import-Module Pester
# Only use Coveralls for windows build
if (($PSVersionTable.PSVersion.Major -le 5) -or $IsWindows) {
Import-Module Coveralls
}
$res = Invoke-Pester @pesterParams
if (Test-Path $testResultsFile) {
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", $testResultsFile)
}
if ($res.FailedCount -gt 0) {
# Terminate the script to fail the build
$Error | Format-List * -Force
exit 1;
}
$ErrorActionPreference = 'Stop'
if (!(Test-Path Env:CA_KEY)) {
Write-Host 'CA_KEY not set! (Expected on PR builds.)'
return;
}
# Only upload coverage for windows build
if (($PSVersionTable.PSVersion.Major -le 5) -or $IsWindows) {
$coverageResult = Format-Coverage -Include (@(gci *.psm1) + @(gci src/*.ps1)) -CoverallsApiToken $ENV:CA_KEY -RootFolder ../ -BranchName $ENV:APPVEYOR_REPO_BRANCH
Publish-Coverage -Coverage $coverageResult
}