Closed fbridger closed 3 days ago
I encountered the same issue and tried the following which seems to be a workaround.
Try using reportgenerator to merge the reports:
- name: Merge Coverage Reports
run: reportgenerator -reports:./coverage/**/coverage.cobertura.xml -targetdir:./coverage -reporttypes:Cobertura
Then reference the merged filename instead of the wild card
- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: ./coverage/Cobertura.xml
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 30 days.
We did a workaround by aggregating the results of the tests using danielpalme/ReportGenerator-GitHub-Action
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage -l trx
# https://reportgenerator.io/usage
- name: Aggregate coverage files with ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@5.3.8
with:
reports: coverage/**/coverage.cobertura.xml
targetdir: coveragereport
reporttypes: Cobertura
# https://github.com/irongut/CodeCoverageSummary
- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coveragereport/Cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'
Bug Report
When running CCS on a solution that has multiple test projects that shares multiple libraries (common libraries) it generates multiple code coverage files.
Visual Studio Code Coverage generates the calculation correctly which generates a line coverage of 80,27%
However, CCS is calculating a line coverage of 43%. It seems CCS is not calculating the code coverage correctly for projects that are shared as they sometime have 0% coverage when they are run in other Tests projects.
Example:
Linked To
https://github.com/irongut/CodeCoverageSummary/issues/38 https://github.com/irongut/CodeCoverageSummary/issues/19