Skip to content

Commit 898d0f5

Browse files
committed
ci: collect and upload coverage to Codecov; docs: add badge
- test: add coverlet.collector to JSSoft.Randora.Tests for XPlat Code Coverage - ci(build-and-test): collect coverage during dotnet test and upload via codecov-action - docs(README): add Codecov badge; add tuple/value tuple and nullable usage - ci(pack): keep push-only secrets usage; PR packaging split into separate workflow (no secrets)
1 parent 856761e commit 898d0f5

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

.github/workflows/build-and-test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,18 @@ jobs:
4747
-p:TestFramework=${{ matrix.framework }} \
4848
--no-restore \
4949
--no-build \
50+
--collect "XPlat Code Coverage" \
5051
--logger "trx;LogFileName=${{ env.TEST_RESULTS_PATH }}"
5152
- uses: dorny/test-reporter@v2
5253
with:
5354
name: XUnit Tests for ${{ matrix.framework }}
5455
path: ${{ env.TEST_RESULTS_PATH }}
5556
reporter: dotnet-trx
57+
- name: Upload coverage to Codecov
58+
uses: codecov/codecov-action@v4
59+
with:
60+
files: "**/coverage.cobertura.xml"
61+
flags: ${{ matrix.framework }}
62+
name: linux-${{ matrix.framework }}
63+
fail_ci_if_error: true
64+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/pack.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: Pack
22

33
on:
4-
pull_request:
4+
pull_request:
55
push:
6-
branches:
7-
- main
86
tags:
97
- "*"
108

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# Randora
1+
# Randora
22

33
[![NuGet](https://img.shields.io/nuget/v/JSSoft.Randora.svg?label=release)](https://www.nuget.org/packages/JSSoft.Randora/)
44
[![NuGet (prerelease)](https://img.shields.io/nuget/vpre/JSSoft.Randora.svg?label=preview)](https://www.nuget.org/packages/JSSoft.Randora/)
5+
[![codecov](https://codecov.io/gh/s2quake/randora/branch/main/graph/badge.svg)](https://codecov.io/gh/s2quake/randora)
56
[![License](https://img.shields.io/github/license/s2quake/randora.svg)](https://github.com/s2quake/randora/blob/main/LICENSE.md)
67

78
A lightweight random-value utility. It provides simple APIs to generate a wide range of data: primitives, collections, enums, text, time values, shuffles, and more.

test/JSSoft.Randora.Tests/JSSoft.Randora.Tests.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,11 @@
44
<ProjectReference Include="..\..\src\JSSoft.Randora\JSSoft.Randora.csproj" />
55
</ItemGroup>
66

7+
<ItemGroup>
8+
<PackageReference Include="coverlet.collector" Version="6.0.0">
9+
<PrivateAssets>all</PrivateAssets>
10+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
11+
</PackageReference>
12+
</ItemGroup>
13+
714
</Project>

0 commit comments

Comments
 (0)