Skip to content

Commit 5d7bafb

Browse files
CopilotScarletKuro
andauthored
Tests: Add Codecov Test Analytics support (#7)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ScarletKuro <19953225+ScarletKuro@users.noreply.github.com>
1 parent 25be883 commit 5d7bafb

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

.github/workflows/continuous.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ jobs:
3535
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
3636
- name: 'Run: Compile, Test, Pack'
3737
run: ./build.cmd Compile Test Pack
38+
- name: 'Upload test results to Codecov'
39+
if: ${{ !cancelled() }}
40+
uses: codecov/test-results-action@v1
41+
with:
42+
token: ${{ secrets.CODECOV_TOKEN }}
43+
files: artifacts/test-results/*.xml
3844
- name: 'Upload coverage to Codecov'
3945
uses: codecov/codecov-action@v5
4046
with:

build/Build.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class Build : NukeBuild
6161
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
6262
AbsolutePath PackagesDirectory => ArtifactsDirectory / "packages";
6363
AbsolutePath CoverageDirectory => ArtifactsDirectory / "coverage";
64+
AbsolutePath TestResultsDirectory => ArtifactsDirectory / "test-results";
6465

6566
Target Clean => _ => _
6667
.Before(Restore)
@@ -107,11 +108,13 @@ class Build : NukeBuild
107108
Target Test => _ => _
108109
.DependsOn(Compile)
109110
.Produces(CoverageDirectory / "*.xml")
111+
.Produces(TestResultsDirectory / "*.xml")
110112
.Executes(() =>
111113
{
112114
var projects = Solution.GetAllProjects("*.Tests");
113115

114116
CoverageDirectory.CreateOrCleanDirectory();
117+
TestResultsDirectory.CreateOrCleanDirectory();
115118

116119
foreach (var project in projects)
117120
{
@@ -122,6 +125,7 @@ class Build : NukeBuild
122125
.EnableCollectCoverage()
123126
.SetCoverletOutputFormat(CoverletOutputFormat.cobertura)
124127
.SetCoverletOutput(CoverageDirectory / $"{project.Name}.xml")
128+
.SetLoggers($"junit;LogFilePath={TestResultsDirectory / $"{project.Name}.xml"}")
125129
);
126130
}
127131
});

src/Scarlet.System.Text.Json.DateTimeConverter.Tests/Scarlet.System.Text.Json.DateTimeConverter.Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
<PrivateAssets>all</PrivateAssets>
2525
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2626
</PackageReference>
27+
<PackageReference Include="JunitXml.TestLogger" Version="4.1.0">
28+
<PrivateAssets>all</PrivateAssets>
29+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
30+
</PackageReference>
2731
</ItemGroup>
2832

2933
<ItemGroup>

0 commit comments

Comments
 (0)