Skip to content

Commit 22e28e1

Browse files
committed
Coverage report in test summary
1 parent 5a9a322 commit 22e28e1

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

.github/workflows/test.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,33 @@ 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" --results-directory "test-results"
36+
- name: Find coverage files and generate report
37+
run: |
38+
reportgenerator -reports:"test-results/*.coverage" \
39+
-targetdir:"coverage-report" \
40+
-reporttypes:MarkdownSummaryGithub
41+
- name: Upload coverage report
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: coverage-report
45+
path: ${{ github.workspace }}/coverage-report
46+
- name: Add coverage to summary
47+
run: cat ${{ github.workspace }}/coverage-report/SummaryGithub.md >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)