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