Skip to content

Make AppVeyor run Coverity scan #1066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 6, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 76 additions & 18 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ skip_tags: true
clone_folder: C:\projects\libgit2sharp

environment:
coverity_token:
secure: nuzUT+HecXGIi3KaPd/1hgFEZJan/j6+oNbPV75JKjk=
coverity_email:
secure: eGVilNg1Yuq+Xj+SW8r3WCtjnzhoDV0sNJkma4NRq7A=
version : 0.22.0
matrix:
- xunit_runner: xunit.console.clr4.exe
Expand All @@ -22,23 +26,38 @@ matrix:

install:
- ps: |
Write-Host "Commit being built = $($Env:APPVEYOR_REPO_COMMIT)"
Write-Host "Current build version = $($Env:VERSION)"
Write-Host "Target branch = $($Env:APPVEYOR_REPO_BRANCH)"
Write-Host "Is a Pull Request = $($Env:APPVEYOR_PULL_REQUEST_NUMBER -ne $null)"
Write-Host "Commit being built = " -NoNewLine
Write-Host $Env:APPVEYOR_REPO_COMMIT -ForegroundColor "Green"
Write-Host "Current build version = " -NoNewLine
Write-Host $Env:VERSION -ForegroundColor "Green"
Write-Host "Target branch = " -NoNewLine
Write-Host $Env:APPVEYOR_REPO_BRANCH -ForegroundColor "Green"
Write-Host "Is a Pull Request = " -NoNewLine
Write-Host $($Env:APPVEYOR_PULL_REQUEST_NUMBER -ne $null) -ForegroundColor "Green"

$BuildDate = (Get-Date).ToUniversalTime().ToString("yyyyMMddHHmmss")
Write-Host "Build UTC date = $BuildDate"
Write-Host "Build UTC date = " -NoNewLine
Write-Host $BuildDate -ForegroundColor "Green"

$VersionSuffix = ""
If ($Env:APPVEYOR_REPO_BRANCH -ne "master")
{
$VersionSuffix = "-pre$BuildDate"
}
$Version = "$($Env:VERSION)$($VersionSuffix)"
$Env:ASSEMBLY_INFORMATIONAL_VERSION = $Version
Write-Host "Assembly informational version = $($Env:ASSEMBLY_INFORMATIONAL_VERSION)"
$ShouldPublishNugetArtifact = "$($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null)"
Write-Host "Assembly informational version = " -NoNewLine
Write-Host $Env:ASSEMBLY_INFORMATIONAL_VERSION -ForegroundColor "Green"

$ShouldPublishNugetArtifact = $($Env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null)
$Env:SHOULD_PUBLISH_NUGET_ARTIFACT = $ShouldPublishNugetArtifact
Write-Host "Should publish Nuget artifact = $($Env:SHOULD_PUBLISH_NUGET_ARTIFACT)"
Write-Host "Should publish Nuget artifact = " -NoNewLine
Write-Host $Env:SHOULD_PUBLISH_NUGET_ARTIFACT -ForegroundColor "Green"

$Env:SHOULD_PUBLISH_COVERITY_ANALYSIS = $($Env:APPVEYOR_SCHEDULED_BUILD -eq $True)
Write-Host "Should publish Coverity analysis = " -NoNewLine
Write-Host $Env:SHOULD_PUBLISH_COVERITY_ANALYSIS -ForegroundColor "Green"

cinst sourcelink -y

assembly_info:
Expand All @@ -52,23 +71,62 @@ cache:
- packages

before_build:
- nuget restore "%APPVEYOR_BUILD_FOLDER%\LibGit2Sharp.sln"
- ps: nuget restore "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.sln"

build_script:
- msbuild "%APPVEYOR_BUILD_FOLDER%\LibGit2Sharp.sln" /verbosity:normal /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /property:ExtraDefine="LEAKS_IDENTIFYING"
- ps: |
& cov-build.exe --dir cov-int msbuild "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.sln" `
/verbosity:normal `
/p:Configuration=Release `
/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" `
/property:ExtraDefine="LEAKS_IDENTIFYING"

test_script:
- '%xunit_runner% "%APPVEYOR_BUILD_FOLDER%\LibGit2Sharp.Tests\bin\Release\LibGit2Sharp.Tests.dll" /appveyor'
- IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
- ps: |
If ($Env:SHOULD_PUBLISH_COVERITY_ANALYSIS -eq $False)
{
& "$Env:xunit_runner" "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.Tests\bin\Release\LibGit2Sharp.Tests.dll" /appveyor
}

on_success:
after_test:
- ps: |
& "$env:APPVEYOR_BUILD_FOLDER\nuget.package\BuildNugetPackage.ps1" -commitSha "$env:APPVEYOR_REPO_COMMIT" -postBuild { sourcelink index -pr LibGit2Sharp.csproj -pp Configuration Release -nf Core\NativeDllName.cs -nf Core\UniqueIdentifier.cs -nf Properties\AssemblyInfo.cs -r .. -u 'https://raw.githubusercontent.com/libgit2/libgit2sharp/{0}/%var2%' }
Add-Type -Path "$env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp\bin\Release\LibGit2Sharp.dll"
Write-Host "LibGit2Sharp version = $([LibGit2Sharp.GlobalSettings]::Version)" -ForegroundColor "Magenta"
If ($Env:SHOULD_PUBLISH_NUGET_ARTIFACT -eq $True)
If ($Env:SHOULD_PUBLISH_COVERITY_ANALYSIS -eq $False)
{
Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\LibGit2sharp\*.nupkg" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
& "$Env:APPVEYOR_BUILD_FOLDER\nuget.package\BuildNugetPackage.ps1" `
-commitSha "$Env:APPVEYOR_REPO_COMMIT" `
-postBuild { sourcelink index `
-pr LibGit2Sharp.csproj `
-pp Configuration Release `
-nf Core\NativeDllName.cs `
-nf Core\UniqueIdentifier.cs `
-nf Properties\AssemblyInfo.cs `
-r .. `
-u 'https://raw.githubusercontent.com/libgit2/libgit2sharp/{0}/%var2%' }

Add-Type -Path "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp\bin\Release\LibGit2Sharp.dll"
Write-Host "LibGit2Sharp version = $([LibGit2Sharp.GlobalSettings]::Version)" -ForegroundColor "Magenta"

If ($Env:SHOULD_PUBLISH_NUGET_ARTIFACT -eq $True)
{
Get-ChildItem "$Env:APPVEYOR_BUILD_FOLDER\LibGit2sharp\*.nupkg" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
}
}
Else
{
& nuget install PublishCoverity -Version 0.9.0 -ExcludeVersion -OutputDirectory .\packages

& .\packages\PublishCoverity\PublishCoverity.exe compress `
-i "$Env:APPVEYOR_BUILD_FOLDER\cov-int" `
-o "$Env:APPVEYOR_BUILD_FOLDER\$Env:APPVEYOR_PROJECT_NAME.zip"

& .\packages\PublishCoverity\PublishCoverity.exe publish `
-t "$Env:coverity_token" `
-e "$Env:coverity_email" `
-r "$Env:APPVEYOR_REPO_NAME" `
-z "$Env:APPVEYOR_BUILD_FOLDER\$env:APPVEYOR_PROJECT_NAME.zip" `
-d "CI server scheduled build." `
--codeVersion "$Env:ASSEMBLY_INFORMATIONAL_VERSION" `
--nologo
}

notifications:
Expand Down