forked from MathieuBuisson/PowerShell-DevOps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappveyor.yml
More file actions
48 lines (37 loc) · 1.97 KB
/
appveyor.yml
File metadata and controls
48 lines (37 loc) · 1.97 KB
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
version: 1.0.{build}
os: WMF 5
# Skip on updates to the readme
skip_commits:
message: /readme*/
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: Install-Module -Name Pester -Force
- ps: Install-Module PsScriptAnalyzer -Force
build: false
test_script:
- ps: |
$UnitTestsOutput = Invoke-Pester -Script ".\Merge-DscConfigData" -OutputFile TestsResults.xml -OutputFormat NUnitXml -PassThru
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestsResults.xml))
$FailedCount = $UnitTestsOutput.FailedCount
If ($FailedCount -gt 0) {
Add-AppveyorMessage -Message "$($FailedCount) unit test(s) failed. Check the test results for more information."
# Failing the build
Throw "Build failed because $($FailedCount) unit test(s) failed. Check the test results for more information."
}
- ps: |
Import-Module -Name 'PsScriptAnalyzer' -Force
$ScriptAnalyzerRules = Get-ScriptAnalyzerRule -Severity Error
$ScriptAnalyzerResult = Invoke-ScriptAnalyzer -Path $pwd -IncludeRule $ScriptAnalyzerRules -Recurse
If ( $ScriptAnalyzerResult ) {
$ScriptAnalyzerResultString = $ScriptAnalyzerResult | Out-String
Write-Warning $ScriptAnalyzerResultString
}
Import-Module ".\Export-NUnitXml\Export-NUnitXml.psm1" -Force
Export-NUnitXml -ScriptAnalyzerResult $ScriptAnalyzerResult -Path ".\ScriptAnalyzerResult.xml"
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\ScriptAnalyzerResult.xml))
If ( $ScriptAnalyzerResult ) {
# Failing the build
Throw 'Build failed because there was one or more PSScriptAnalyzer violation. See test results for more information.'
}