Skip to content

Commit

Permalink
Add automatic Coverity Scan runs on schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
odinserj committed Sep 6, 2016
1 parent 5ec7e1a commit 7e788d9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions .nuget/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
<package id="OpenCover" version="4.5.3723" />
<package id="psake" version="4.4.1" />
<package id="xunit.runner.console" version="2.2.0-beta2-build3300" />
<package id="PublishCoverity" version="0.11.0" />
</packages>
8 changes: 5 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ environment:
Hangfire_SqlServer_ConnectionStringTemplate: Server=.\SQL2008R2SP2;Database={0};User Id=sa;Password=Password12!
COVERALLS_REPO_TOKEN:
secure: oE4uB475V9hPzKmm+ZRP+1BacnMFOE98a/2tVeFieYJi5BbYG6X3VM+p6vKIQZdd
COVERITY_TOKEN:
secure: r3yBqxgALySnCK9W6uiStqoadsqYtrWQolzxGDVKF74=
COVERITY_EMAIL:
secure: wf51HXCiUYxuTe+eo3uQOxqyptSLrH4IEqq0958Rmx8=

# enable service required for tests
services:
Expand Down Expand Up @@ -48,9 +52,7 @@ cache:

# to run your custom scripts instead of automatic MSBuild
build_script:
- build.bat pack
- dotnet restore
- dotnet test tests/Hangfire.Core.Tests
- build.bat ci

after_build:
- packages\coveralls.io.1.3.4\tools\coveralls.net --opencover coverage.xml
Expand Down
19 changes: 19 additions & 0 deletions psake-project.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Properties {
}

Task Default -Depends Collect
Task CI -Depends Default, TestNetCore, CoverityScan

Task Test -Depends Compile -Description "Run unit and integration tests under OpenCover." {
Remove-File $coverage_file
Expand Down Expand Up @@ -53,6 +54,24 @@ Task Pack -Depends Collect -Description "Create NuGet packages and archive files
Create-Package "Hangfire.AspNetCore" $version
}

Task TestNetCore -Depends Clean -Description "Run unit and integration tests against .NET Core" {
Exec {
dotnet restore
dotnet test tests/Hangfire.Core.Tests
}
}

Task CoverityScan -Depends Restore -PreCondition { return $env:APPVEYOR_SCHEDULED_BUILD } -Description "Runs static code analysis using Coverity Scan" {
Exec {
cov-build --dir cov-int msbuild /t:rebuild Hangfire.sln

$publish = Resolve-Path "packages\PublishCoverity.*\tools\PublishCoverity.exe"

.$publish compress -o coverity.zip -i cov-int --nologo
.$publish publish -z coverity.zip -r HangfireIO/Hangfire -t $env:COVERITY_TOKEN -e $env:COVERITY_EMAIL --codeVersion $env:APPVEYOR_BUILD_VERSION --nologo
}
}

function Run-OpenCoverXunit2($projectWithOptionalTarget, $coverageFile, $coverageFilter) {
$project = $projectWithOptionalTarget
$target = $null
Expand Down

0 comments on commit 7e788d9

Please sign in to comment.