Use OpenCover to generate coverage statistics for SonarSloud
This commit is contained in:
1 parent
2748148a1d
commit
0d69b5ee62
1 file changed
+16
-3
+16
-3
@@ -33,7 +33,8 @@ install:
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$Env:TAG_NAME_WITH_BRANCH_NAME_FALLBACK = $Env:APPVEYOR_REPO_BRANCH
|
$Env:TAG_NAME_WITH_BRANCH_NAME_FALLBACK = $Env:APPVEYOR_REPO_BRANCH
|
||||||
}
|
}
|
||||||
|
choco install "opencover.portable" -y
|
||||||
before_build:
|
before_build:
|
||||||
- ps: |
|
- ps: |
|
||||||
Try
|
Try
|
||||||
@@ -63,14 +64,15 @@ before_build:
|
|||||||
/d:"sonar.pullrequest.branch=$env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH"
|
/d:"sonar.pullrequest.branch=$env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH"
|
||||||
}
|
}
|
||||||
elseif($Env:APPVEYOR_REPO_BRANCH -eq 'develop'){
|
elseif($Env:APPVEYOR_REPO_BRANCH -eq 'develop'){
|
||||||
choco install "msbuild-sonarqube-runner" -y
|
choco install "msbuild-sonarqube-runner" -y
|
||||||
SonarScanner.MSBuild.exe begin `
|
SonarScanner.MSBuild.exe begin `
|
||||||
/k:"lukeIam_Vocaluxe" `
|
/k:"lukeIam_Vocaluxe" `
|
||||||
/d:sonar.organization="lukeiam-github" `
|
/d:sonar.organization="lukeiam-github" `
|
||||||
/d:sonar.host.url="https://sonarcloud.io" `
|
/d:sonar.host.url="https://sonarcloud.io" `
|
||||||
/v:"$Env:GIT_VERSION_TAG" `
|
/v:"$Env:GIT_VERSION_TAG" `
|
||||||
/d:sonar.login="$Env:SonarQubeToken" `
|
/d:sonar.login="$Env:SonarQubeToken" `
|
||||||
/d:sonar.cs.nunit.reportsPaths="$env:APPVEYOR_BUILD_FOLDER\TestResult.xml"
|
/d:sonar.cs.nunit.reportsPaths=".\TestResult.xml" `
|
||||||
|
/d:sonar.cs.opencover.reportsPaths=".\CoverageResult.xml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
build:
|
build:
|
||||||
@@ -107,6 +109,17 @@ after_build:
|
|||||||
.\.appveyor\nightlyDetect.ps1
|
.\.appveyor\nightlyDetect.ps1
|
||||||
.\.appveyor\moveTagForSpecialBranches.ps1
|
.\.appveyor\moveTagForSpecialBranches.ps1
|
||||||
}
|
}
|
||||||
|
test_script:
|
||||||
|
- ps: |
|
||||||
|
if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){
|
||||||
|
OpenCover.Console.exe -register:user -target:"nunit3-console.exe" -targetargs:".\Tests\bin\Release\Tests.dll --result=.\TestResult.xml;format=AppVeyor" -output:".\CoverageResult.xml"
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
nunit3-console.exe ".\Tests\bin\Release\Tests.dll" --result=".\TestResult.xml;format=AppVeyor"
|
||||||
|
}
|
||||||
|
$wc = New-Object 'System.Net.WebClient'
|
||||||
|
$wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit3/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestResult.xml))
|
||||||
|
|
||||||
after_test:
|
after_test:
|
||||||
- ps: |
|
- ps: |
|
||||||
if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){
|
if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){
|
||||||
|
|||||||
Reference in new issue
Block a user