Skip to content

Commit 8956a40

Browse files
authored
ci: run and collect code coverage (#17)
1 parent be57ef5 commit 8956a40

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

.github/workflows/test.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
run: dotnet restore src
3939

4040
- name: Build
41-
run: dotnet build src --no-restore
41+
run: dotnet build src -m:1 --no-restore
4242

4343
- name: Configure
4444
run: |
@@ -47,4 +47,24 @@ jobs:
4747
xmlstarlet ed -L -N ns="urn:nhibernate-configuration-2.2" -u '//ns:property[@name="connection.connection_string"]' -v '${{matrix.CONNECTION_STRING}}' hibernate.cfg.xml
4848
4949
- name: Test
50-
run: dotnet test src -f net6.0 --no-build --verbosity normal
50+
run: dotnet test src -f net6.0 --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
51+
52+
- name: Code Coverage Report
53+
uses: irongut/[email protected]
54+
with:
55+
filename: coverage/**/coverage.cobertura.xml
56+
badge: true
57+
fail_below_min: true
58+
format: markdown
59+
hide_branch_rate: false
60+
hide_complexity: true
61+
indicators: true
62+
output: both
63+
thresholds: '60 80'
64+
65+
- name: Add Coverage PR Comment
66+
uses: marocchino/sticky-pull-request-comment@v2
67+
if: github.event_name == 'pull_request'
68+
with:
69+
recreate: true
70+
path: code-coverage-results.md

src/NHibernate.Search.Tests/NHibernate.Search.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
1717
<PackageReference Include="NUnit" Version="3.13.3" />
1818
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
19+
<PackageReference Include="coverlet.collector" Version="3.1.2" PrivateAssets="All" />
1920
</ItemGroup>
2021
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
2122
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />

0 commit comments

Comments
 (0)