forked from PowerShell/PSScriptAnalyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
66 lines (59 loc) · 2.74 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: WMF 5
PowerShellEdition: Desktop
BuildConfiguration: Release
- APPVEYOR_BUILD_WORKER_IMAGE: WMF 4
PowerShellEdition: Desktop
BuildConfiguration: PSv3Release
# clone directory
clone_folder: c:\projects\psscriptanalyzer
# cache nuget packages
cache:
- '%USERPROFILE%\.nuget\packages -> **\project.json'
# Install Pester
install:
- cinst -y pester --version 3.4.0
- ps: nuget install platyPS -Version 0.5.0 -source https://www.powershellgallery.com/api/v2 -outputDirectory "$Env:ProgramFiles\WindowsPowerShell\Modules\." -ExcludeVersion
build_script:
- ps: |
$PSVersionTable
Push-Location C:\projects\psscriptanalyzer
dotnet restore
C:\projects\psscriptanalyzer\buildCoreClr.ps1 -Framework net451 -Configuration $env:BuildConfiguration -Build
C:\projects\psscriptanalyzer\build.ps1 -BuildDocs
Pop-Location
# 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\out\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 }