Skip to content

Commit 1cba9e4

Browse files
committed
Publish code coverage
1 parent 9d3fe4d commit 1cba9e4

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

appveyor.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ skip_tags: true
1010
clone_folder: C:\projects\libgit2sharp
1111

1212
environment:
13+
coveralls_token:
14+
secure: ixIsBslo9NheDb5lJknF58EYdgvZ0r3/L0ecRiXjfXmjHBLvoSU6/ZRwaMM+BAlG
1315
coverity_token:
1416
secure: nuzUT+HecXGIi3KaPd/1hgFEZJan/j6+oNbPV75JKjk=
1517
coverity_email:
@@ -60,6 +62,11 @@ install:
6062
Write-Host "Should package Nuget artifact = " -NoNewLine
6163
Write-Host $Env:SHOULD_PACKAGE_NUGET_ARTIFACT -ForegroundColor "Green"
6264
65+
$Env:SHOULD_RUN_COVERALLS = $($Env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null `
66+
-and $Env:APPVEYOR_SCHEDULED_BUILD -eq $False)
67+
Write-Host "Should run Coveralls = " -NoNewLine
68+
Write-Host $Env:SHOULD_RUN_COVERALLS -ForegroundColor "Green"
69+
6370
Write-Host "Should publish on success = " -NoNewLine
6471
Write-Host $Env:publish_on_success -ForegroundColor "Green"
6572
@@ -68,6 +75,12 @@ install:
6875
cinst sourcelink -y
6976
}
7077
78+
If ($Env:SHOULD_RUN_COVERALLS -eq $True)
79+
{
80+
nuget install OpenCover -Version 4.5.3723 -ExcludeVersion -OutputDirectory .\packages
81+
nuget install coveralls.net -Version 0.5.0 -ExcludeVersion -OutputDirectory .\packages
82+
}
83+
7184
If ($Env:SHOULD_RUN_COVERITY_ANALYSIS -eq $True)
7285
{
7386
cinst curl -y
@@ -98,7 +111,20 @@ test_script:
98111
- ps: |
99112
If ($Env:SHOULD_RUN_COVERITY_ANALYSIS -eq $False)
100113
{
101-
& "$Env:xunit_runner" "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.Tests\bin\Release\LibGit2Sharp.Tests.dll" /appveyor
114+
If ($Env:SHOULD_RUN_COVERALLS -eq $True -and $Env:publish_on_success -eq $True)
115+
{
116+
.\packages\OpenCover\OpenCover.Console.exe `
117+
-register:user `
118+
-target:$Env:xunit_runner `
119+
"-targetargs:""$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.Tests\bin\Release\LibGit2Sharp.Tests.dll"" /noshadow /appveyor" `
120+
"-filter:+[LibGit2Sharp]* -[LibGit2Sharp.Tests]*" `
121+
-hideskipped:All `
122+
-output:opencoverCoverage.xml
123+
}
124+
Else
125+
{
126+
& "$Env:xunit_runner" "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.Tests\bin\Release\LibGit2Sharp.Tests.dll" /appveyor
127+
}
102128
}
103129
104130
after_test:
@@ -122,6 +148,23 @@ after_test:
122148
Get-ChildItem "$Env:APPVEYOR_BUILD_FOLDER\LibGit2sharp\*.nupkg" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
123149
}
124150
151+
If ($Env:SHOULD_RUN_COVERALLS -eq $True -and $Env:publish_on_success -eq $True)
152+
{
153+
Write-Host "Uploading code coverage result..." -ForegroundColor "Green"
154+
155+
.\packages\coveralls.net\csmacnz.Coveralls.exe `
156+
--opencover -i opencoverCoverage.xml `
157+
--repoToken $Env:coveralls_token `
158+
--commitId $Env:APPVEYOR_REPO_COMMIT `
159+
--commitBranch $Env:APPVEYOR_REPO_BRANCH `
160+
--commitAuthor $Env:APPVEYOR_REPO_COMMIT_AUTHOR `
161+
--commitEmail $Env:APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL `
162+
--commitMessage $Env:APPVEYOR_REPO_COMMIT_MESSAGE `
163+
--useRelativePaths `
164+
--basePath "$Env:APPVEYOR_BUILD_FOLDER\"`
165+
--jobId $Env:APPVEYOR_JOB_ID
166+
}
167+
125168
If ($Env:SHOULD_RUN_COVERITY_ANALYSIS -eq $True -and $Env:publish_on_success -eq $True)
126169
{
127170
7z a "$Env:APPVEYOR_BUILD_FOLDER\$Env:APPVEYOR_PROJECT_NAME.zip" "$Env:APPVEYOR_BUILD_FOLDER\cov-int\"

0 commit comments

Comments
 (0)