-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.yml
55 lines (46 loc) · 2.23 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
version: 1.0.{build}
os: WMF 5
# Skip on updates to the readme
skip_commits:
message: /readme*/
environment:
CA_Key:
secure: 5RSsazuNC6hRPAKulKD6F8TPlNJpX3tTwclQCDhILMS6nHbMTZYhX8hXu1tpPM1+
install:
- ps: Write-Host "Build version :` $env:APPVEYOR_BUILD_VERSION"
- ps: Write-Host "Branch :` $env:APPVEYOR_REPO_BRANCH"
- ps: Install-PackageProvider -Name NuGet -Force
- ps: Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
- ps: Install-Module Coveralls -Scope CurrentUser -Force
- ps: Import-Module Coveralls
- ps: Install-Module -Name Pester -Force
- ps: Install-Module PsScriptAnalyzer -Force
build: false
test_script:
- ps: |
$TestsUploadUrl = "https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)"
$TestsOutput = Invoke-Pester -Script '.\Tests' -CodeCoverage '.\DeploymentReadinessChecker.psm1' -OutputFile TestResults.xml -PassThru
(New-Object 'System.Net.WebClient').UploadFile($TestsUploadUrl, (Resolve-Path .\TestResults.xml))
$FailedCount = $UnitTestsOutput.FailedCount
If ($FailedCount -gt 0) {
Add-AppveyorMessage -Message "$($FailedCount) unit test(s) failed."
# Failing the build
Throw "Build failed because $($FailedCount) unit test(s) failed"
}
$Coverage = Format-Coverage -PesterResults $TestsOutput -CoverallsApiToken $ENV:CA_Key -BranchName $ENV:APPVEYOR_REPO_BRANCH
Publish-Coverage -Coverage $Coverage
- ps: |
Add-AppveyorTest -Name "PsScriptAnalyzer" -Outcome Running
$ScriptAnalyzerResults = Invoke-ScriptAnalyzer -Path $pwd -Severity Error -ErrorAction SilentlyContinue
If ($ScriptAnalyzerResults) {
$ScriptAnalyzerResultString = $ScriptAnalyzerResults | Out-String
Write-Warning $ScriptAnalyzerResultString
Add-AppveyorMessage -Message "PSScriptAnalyzer output contained one or more result(s) with 'Error' severity.`
Check the 'Tests' tab of this build for more details." -Category Error
Update-AppveyorTest -Name "PsScriptAnalyzer" -Outcome Failed -ErrorMessage $ScriptAnalyzerResultString
# Failing the build
Throw "Build failed"
}
Else {
Update-AppveyorTest -Name "PsScriptAnalyzer" -Outcome Passed
}