Skip to content

Commit a32fd05

Browse files
committed
Coverage report in test summary
1 parent 6562da9 commit a32fd05

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

.github/workflows/test.yml

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

0 commit comments

Comments
 (0)