-
Notifications
You must be signed in to change notification settings - Fork 148
/
appveyor.yml
49 lines (40 loc) · 2.1 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
os: WMF 5
version: 0.5.0.{build}-{branch}
skip_commits:
message: /^.*readme.*$/
install:
- cinst pester
- ps: Install-PackageProvider -Name NuGet -Force
- ps: Install-Module PsScriptAnalyzer -Force
build: false
test_script:
- ps: |
$ErrorActionPreference = 'Stop'
Write-Host 'Adding PsScriptAnalyzer test'
# PSScriptAnalyzer template derived from here:
# http://theshellnut.com/integrating-psscriptanalyzer-appveyor/
Add-AppveyorTest -Name 'PsScriptAnalyzer' -Outcome Running
Write-Host 'Performing PSScriptAnalyzer tests'
$Results = Get-ChildItem . -Directory -Recurse |
Where-Object { $_.Name -ne 'Tests' } |
Get-ChildItem -File -Include '*.ps1, *.psm1' |
% { Invoke-ScriptAnalyzer -ErrorAction SilentlyContinue -Path $_.FullName -ExcludeRule PSShouldProcess }
if ($Results) {
Write-Host 'PSScriptAnalyzer returned errors/warnings that need to be addressed.'
$ResultString = $Results | Out-String
Write-Warning $ResultString
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 $ResultString
throw 'Build failed'
} else {
Write-Host 'PSScriptAnalyzer returned nothing that needs to be addressed.'
Update-AppveyorTest -Name 'PsScriptAnalyzer' -Outcome Passed
}
Write-Host 'Performing Pester tests'
$TestResults = Invoke-Pester -Path '.\CimSweep\Tests' -OutputFormat NUnitXml -OutputFile TestsResults.xml -PassThru
Write-Host 'Uploading build results'
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($Env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestsResults.xml))
if ($TestResults.FailedCount -gt 0) {
throw "$($TestResults.FailedCount) tests failed."
}
Write-Host 'All tests complete'