forked from PowerShell/PSScriptAnalyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
49 lines (43 loc) · 2.03 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
# WS2012R2 image with April WMF5.0
os: unstable
# clone directory
clone_folder: c:\projects\psscriptanalyzer
# Install Pester
install:
- cinst -y pester
# Build PSScriptAnalyzer using msbuild
build: true
# branches to build
branches:
# whitelist
only:
- master
- development
# Run Pester tests and store the results
test_script:
- SET PATH=c:\Program Files\WindowsPowerShell\Modules\;%PATH%;
- ps: |
copy "C:\projects\psscriptanalyzer\PSScriptAnalyzer" "$Env:ProgramFiles\WindowsPowerShell\Modules\" -Recurse -Force
$engineTestResultsFile = ".\EngineTestResults.xml"
$ruleTestResultsFile = ".\RuleTestResults.xml"
$engineTestResults = Invoke-Pester -Script "C:\projects\psscriptanalyzer\Tests\Engine" -OutputFormat NUnitXml -OutputFile $engineTestResultsFile -PassThru
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $engineTestResultsFile))
if ($engineTestResults.FailedCount -gt 0) {
throw "$($engineTestResults.FailedCount) tests failed."
}
$ruleTestResults = Invoke-Pester -Script "C:\projects\psscriptanalyzer\Tests\Rules" -OutputFormat NUnitXml -OutputFile $ruleTestResultsFile -PassThru
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $ruleTestResultsFile))
if ($ruleTestResults.FailedCount -gt 0) {
throw "$($ruleTestResults.FailedCount) tests failed."
}
# Upload the project along with TestResults as a zip archive
on_finish:
- ps: |
$stagingDirectory = (Resolve-Path ..).Path
$zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip"
Add-Type -assemblyname System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFile)
@(
# You can add other artifacts here
(ls $zipFile)
) | % { Push-AppveyorArtifact $_.FullName }