Skip to content

Commit 0bc94d4

Browse files
committed
Coverage report in test summary
1 parent 5a9a322 commit 0bc94d4

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,34 @@ jobs:
1515
runs-on: ${{ matrix.os }}
1616
strategy:
1717
matrix:
18-
os: ["ubuntu-latest", "windows-latest"]
18+
os: ["ubuntu-latest"]
1919
dotnet: ["9.0.x"]
2020
steps:
2121
- uses: actions/checkout@v4
2222
- name: Setup .NET ${{ matrix.dotnet }}
2323
uses: actions/setup-dotnet@v4
2424
with:
2525
dotnet-version: ${{ matrix.dotnet }}
26+
- name: Install Report Generator
27+
run: dotnet tool install --global dotnet-reportgenerator-globaltool
2628
- name: Restore
2729
run: dotnet restore
2830
- name: Build
29-
run: dotnet build --configuration Release --no-restore
30-
- name: Test
31-
run: dotnet test --configuration Release --no-restore --no-build
31+
run: dotnet build -c Release --no-restore
32+
- name: Test & collect coverage
33+
run: |
34+
dotnet test -c Release --no-restore --no-build \
35+
--collect:"Code Coverage;Format=cobertura" \
36+
--results-directory "test-results"
37+
- name: Find coverage files and generate report
38+
run: |
39+
reportgenerator -reports:"test-results/**/coverage.cobertura.xml" \
40+
-targetdir:"coverage-report" \
41+
-reporttypes:MarkdownSummaryGithub
42+
- name: Upload coverage report
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: coverage-report
46+
path: coverage-report
47+
- name: Add coverage to summary
48+
run: cat coverage-report/SummaryGithub.md >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)