Skip to content

Commit a74b7c4

Browse files
committed
Create appveyor.yml
1 parent 5f0c03a commit a74b7c4

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

appveyor.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# WS2012R2 image with April WMF5.0
2+
os: unstable
3+
4+
# Install Pester
5+
install:
6+
- cinst -y pester
7+
8+
# Build PSScriptAnalyzer using msbuild
9+
build: true
10+
11+
# branches to build
12+
branches:
13+
# whitelist
14+
only:
15+
- master
16+
- bugfixes
17+
- development
18+
19+
# Run Pester tests and store the results
20+
test_script:
21+
- SET PATH=c:\Program Files\WindowsPowerShell\Modules\;%PATH%;
22+
- ps: |
23+
copy "C:\projects\psscriptanalyzer\PSScriptAnalyzer" "$Env:ProgramFiles\WindowsPowerShell\Modules\" -Recurse -Force
24+
$engineTestResultsFile = ".\EngineTestResults.xml"
25+
$ruleTestResultsFile = ".\RuleTestResults.xml"
26+
$engineTestResults = Invoke-Pester -Script "C:\projects\psscriptanalyzer\Tests\Engine" -OutputFormat NUnitXml -OutputFile $engineTestResultsFile -PassThru
27+
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $engineTestResultsFile))
28+
if ($engineTestResults.FailedCount -gt 0) {
29+
throw "$($engineTestResults.FailedCount) tests failed."
30+
}
31+
$ruleTestResults = Invoke-Pester -Script "C:\projects\psscriptanalyzer\Tests\Rules" -OutputFormat NUnitXml -OutputFile $ruleTestResultsFile -PassThru
32+
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $ruleTestResultsFile))
33+
if ($ruleTestResults.FailedCount -gt 0) {
34+
throw "$($ruleTestResults.FailedCount) tests failed."
35+
}
36+
37+
# Upload the project along with TestResults as a zip archive
38+
on_finish:
39+
- ps: |
40+
$stagingDirectory = (Resolve-Path ..).Path
41+
$zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip"
42+
Add-Type -assemblyname System.IO.Compression.FileSystem
43+
[System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFile)
44+
@(
45+
# You can add other artifacts here
46+
(ls $zipFile)
47+
) | % { Push-AppveyorArtifact $_.FullName }

0 commit comments

Comments
 (0)