Skip to content

Commit 77911e2

Browse files
committed
Add global exclusion from code coverage to test directory
Remove old exclusion attributes Append code coverage to action summary.
1 parent 449f4de commit 77911e2

File tree

12 files changed

+25
-30
lines changed

12 files changed

+25
-30
lines changed

.github/workflows/ci-build.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ permissions:
2121
env:
2222
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
2323
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
24+
COVERAGE_REPORT: ${{ github.workspace}}/coveragereport
2425

2526
jobs:
2627
build:
@@ -74,12 +75,25 @@ jobs:
7475
show: "fail, skip"
7576
if: always()
7677

78+
- name: Publish Test Results
79+
uses: EnricoMi/publish-unit-test-result-action@3a74b2957438d0b6e2e61d67b05318aa25c9e6c6 # v2.20.0
80+
if: always()
81+
with:
82+
files: "test/**/TestResults.xml"
83+
84+
- name: Upload Test Artifacts
85+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
86+
with:
87+
name: test-results
88+
path: "test/**/TestResults.xml"
89+
retention-days: 5
90+
7791
- name: 'Generate Coverage Reports'
7892
uses: danielpalme/ReportGenerator-GitHub-Action@82ef2bc4c83f42bbeec82a5cd9a8e3f6156b64b9 # 5.4.9
7993
with:
8094
reports: "test/**/coverage.cobertura.xml"
81-
targetdir: "${{ github.workspace }}"
82-
reporttypes: "Cobertura"
95+
targetdir: "${{ env.COVERAGE_REPORT }}"
96+
reporttypes: "Cobertura,MarkdownSummaryGithub"
8397
verbosity: "Info"
8498
title: "Code Coverage"
8599
tag: "${{ github.run_number }}_${{ github.run_id }}"
@@ -103,20 +117,9 @@ jobs:
103117
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
104118
with:
105119
name: coverage-results
106-
path: |
107-
${{ github.workspace }}/Cobertura.xml
108-
${{ github.workspace }}/code-coverage-results.md
120+
path: ${{ env.COVERAGE_REPORT }}
109121
retention-days: 5
110122

111-
- name: Publish Test Results
112-
uses: EnricoMi/publish-unit-test-result-action@3a74b2957438d0b6e2e61d67b05318aa25c9e6c6 # v2.20.0
113-
if: always()
114-
with:
115-
files: "test/**/TestResults.xml"
116-
117-
- name: Upload Test Artifacts
118-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
119-
with:
120-
name: test-results
121-
path: "test/**/TestResults.xml"
122-
retention-days: 5
123+
- name: Add coverage to build summary
124+
shell: bash
125+
run: cat ${COVERAGE_REPORT}/SummaryGithub.md >> $GITHUB_STEP_SUMMARY

test/Directory.Build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<IsPublishable>False</IsPublishable>
66
</PropertyGroup>
77

8+
<ItemGroup>
9+
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage" />
10+
</ItemGroup>
11+
812
<ItemGroup>
913
<Using Include="System.Diagnostics.CodeAnalysis" />
1014
<Using Include="Xunit" />
@@ -23,4 +27,5 @@
2327
</PackageReference>
2428
<PackageReference Include="JunitXml.TestLogger" />
2529
</ItemGroup>
30+
2631
</Project>

test/idunno.AtProto.Test/AtCidTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace idunno.AtProto.Test
55
{
6-
[ExcludeFromCodeCoverage]
76
public class AtCidTests
87
{
98
const string ValidCid = "bafyreievgu2ty7qbiaaom5zhmkznsnajuzideek3lo7e65dwqlrvrxnmo4";

test/idunno.AtProto.Test/AtIdentifierTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace idunno.AtProto.Test
55
{
6-
[ExcludeFromCodeCoverage]
76
public class AtIdentifierTests
87
{
98
// Test cases from https://github.com/bluesky-social/atproto/blob/main/interop-test-files/syntax/atidentifier_syntax_valid.txt

test/idunno.AtProto.Test/AtUriTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace idunno.AtProto.Test
55
{
6-
[ExcludeFromCodeCoverage]
76
public class AtUriTests
87
{
98
[Theory]

test/idunno.AtProto.Test/BuilderTests.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22
// Licensed under the MIT License.
33

44
using System.Net.Http.Headers;
5-
using System.Threading.Tasks;
65
using idunno.AtProto.Authentication;
76
using Microsoft.Extensions.Logging;
87
using Microsoft.Extensions.Logging.Abstractions;
9-
using Microsoft.Extensions.Options;
10-
using static System.Formats.Asn1.AsnWriter;
118

129
namespace idunno.AtProto.Test
1310
{
14-
[ExcludeFromCodeCoverage]
1511
public class BuilderTests
1612
{
1713
[Fact]

test/idunno.AtProto.Test/DidTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace idunno.AtProto.Test
55
{
6-
[ExcludeFromCodeCoverage]
76
public class DidTests
87
{
98
// Test cases from https://github.com/bluesky-social/atproto/blob/main/interop-test-files/syntax/did_syntax_valid.txt

test/idunno.AtProto.Test/HandleTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace idunno.AtProto.Test
55
{
6-
[ExcludeFromCodeCoverage]
76
public class HandleTests
87
{
98
[Fact]

test/idunno.AtProto.Test/HttpResultTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
namespace idunno.AtProto.Test
77
{
8-
[ExcludeFromCodeCoverage]
98
public class HttpResultTests
109
{
1110
[Fact]

test/idunno.AtProto.Test/NsidTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace idunno.AtProto.Test
55
{
6-
[ExcludeFromCodeCoverage]
76
public class NsidTests
87
{
98
// Test cases from https://github.com/bluesky-social/atproto/blob/290a7e67b8e6417b00352cc1d54bac006c2f6f93/interop-test-files/syntax/nsid_syntax_valid.txt

0 commit comments

Comments
 (0)