/
publish-codecoverage.yml
31 lines (31 loc) · 1.43 KB
/
publish-codecoverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
steps:
- download: current
artifact: coverageResults-Windows
displayName: Download Windows code coverage results
continueOnError: true
- download: current
artifact: coverageResults-Linux
displayName: Download Linux code coverage results
continueOnError: true
- download: current
artifact: coverageResults-macOS
displayName: Download macOS code coverage results
continueOnError: true
- powershell: |
dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.8.5 --configfile azure-pipelines/justnugetorg.nuget.config
Copy-Item -Recurse $(Pipeline.Workspace)/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj
Write-Host "Substituting {reporoot} with $(System.DefaultWorkingDirectory)"
$reports = Get-ChildItem -Recurse "$(Pipeline.Workspace)/coverage.*.cobertura.xml"
$reports |% {
$content = Get-Content -Path $_ |% { $_.Replace("{reporoot}", "$(System.DefaultWorkingDirectory)") }
Set-Content -Path $_ -Value $content -Encoding UTF8
}
$Inputs = [string]::join(';', ($reports |% { Resolve-Path -relative $_ }))
obj/reportgenerator -reports:"$Inputs" -targetdir:coveragereport -reporttypes:Cobertura
displayName: Merge coverage
- task: PublishCodeCoverageResults@1
displayName: Publish code coverage results to Azure DevOps
inputs:
codeCoverageTool: cobertura
summaryFileLocation: 'coveragereport/Cobertura.xml'
failIfCoverageEmpty: true