diff --git a/README.md b/README.md index 1708364fc..25d4aea1a 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,19 @@ To confirm installation: run ```Get-ScriptAnalyzerRule``` in the PowerShell cons Building the Code ================= -Use Visual Studio to build "ScriptAnalyzer.sln". Use ~/PSScriptAnalyzer/ folder to load PSScriptAnalyzer.psd1 +Use Visual Studio to build "PSScriptAnalyzer.sln". Use ~/PSScriptAnalyzer/ folder to load PSScriptAnalyzer.psd1 **Note: If there are any build errors, please refer to Requirements section and make sure all dependencies are properly installed** + +Build Status +============== + +| |Master Branch | +|---------|:------:|:------:|:-------:|:-------:| +|**Debug Version**|[![Build status](https://ci.appveyor.com/api/projects/status/h5mot3vqtvxw5d7l/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/psscriptanalyzer/branch/master) | + + Running Tests ============= @@ -70,6 +79,7 @@ Throughput Graph [![Throughput Graph](https://graphs.waffle.io/powershell/psscriptanalyzer/throughput.svg)](https://waffle.io/powershell/psscriptanalyzer/metrics) + Contributing to ScriptAnalyzer ============================== diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..28eb6cfa6 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,50 @@ +# 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 + - bugfixes + - 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 }