forked from dahlbyk/posh-git
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
64 lines (54 loc) · 2.39 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
os:
- "WMF 5"
environment:
CA_KEY:
secure: JQtUaB+zduPID8bzI5nfHRc2V6xYJiJp4mTHkE4W6broH8rznT1ypvn5orQ6YcGn
branches:
only:
- master
- v0
init:
- git config --global core.autocrlf true
install:
- ps: |
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | Out-Null
Install-Module Pester -MinimumVersion 5.0.0 -MaximumVersion 5.99.99 -Scope CurrentUser -Force | Out-Null
"Git version: $(git.exe --version)"
"PSVersion: $($PSVersionTable.PSVersion), build: $($PSVersionTable.BuildVersion), clr version: $($PSVersionTable.ClrVersion)"
"Host name: $($Host.Name)"
build: false
before_test:
- ps: Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
- ps: Install-Module Coveralls -MinimumVersion 1.0.5 -Scope CurrentUser
- ps: Import-Module Coveralls
test_script:
- ps: |
$testResultsFile = Join-Path $Env:APPVEYOR_BUILD_FOLDER TestResults.xml
Import-Module Pester -PassThru
$configuration = [PesterConfiguration]::Default
$configuration.Run.Path = "$Env:APPVEYOR_BUILD_FOLDER\test"
$configuration.Run.PassThru = $true
$configuration.Output.Verbosity = "Detailed"
$configuration.TestResult.Enabled = $true
$configuration.TestResult.OutputFormat = "NUnit2.5"
$configuration.TestResult.OutputPath = $testResultsFile
$configuration.CodeCoverage.Enabled = $true
$configuration.CodeCoverage.Path = (gci .\src\* -include *.ps1,*.psm1)
$res = Invoke-Pester -Configuration $configuration -ErrorAction SilentlyContinue
if (Test-Path $testResultsFile) {
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", $testResultsFile)
}
if (!$res -or ($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;
}
Write-Host 'Skipping coverage; anyone know how to fix?'
Write-Host '"Please provide pester results with code coverage using the -CodeCoverage parameter"'
# $coverageResult = Format-Coverage -PesterResults $res -CoverallsApiToken $ENV:CA_KEY -BranchName $ENV:APPVEYOR_REPO_BRANCH
# Publish-Coverage -Coverage $coverageResult