Skip to content

Commit 3db76ad

Browse files
author
Alex J Lennon
committed
Add code coverage collection and badges
- Add code coverage collection to CI using coverlet - Generate coverage reports with reportgenerator - Upload coverage reports as artifacts - Add code coverage badge to README (58% line coverage) Coverage: - Line Coverage: 58.1% - Branch Coverage: 48.2% Coverage reports are available as artifacts in GitHub Actions.
1 parent 2da7ccc commit 3db76ad

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,21 @@ jobs:
2929
- name: Clean build artifacts
3030
run: rm -rf obj bin
3131

32-
- name: Run Tests
33-
run: dotnet test tests/InstDotNet.Tests.csproj -c Release -p:GitCommitHash=${{ steps.git.outputs.hash }} --verbosity normal
32+
- name: Run Tests with Coverage
33+
run: dotnet test tests/InstDotNet.Tests.csproj -c Release -p:GitCommitHash=${{ steps.git.outputs.hash }} --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage
3434
continue-on-error: false
35+
36+
- name: Generate Coverage Report
37+
run: |
38+
dotnet tool install -g dotnet-reportgenerator-globaltool || true
39+
reportgenerator -reports:"./coverage/**/coverage.cobertura.xml" -targetdir:"./coverage/report" -reporttypes:"Html;Badges"
40+
41+
- name: Upload Coverage Report
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: coverage-report
45+
path: coverage/report
46+
retention-days: 30
3547

3648
build:
3749
name: Build Native Binaries

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![CI Build and Publish](https://github.com/DynamicDevices/cga-coordinate-mapping/actions/workflows/ci.yml/badge.svg)](https://github.com/DynamicDevices/cga-coordinate-mapping/actions/workflows/ci.yml)
44
[![.NET](https://img.shields.io/badge/.NET-8.0-512BD4?logo=dotnet)](https://dotnet.microsoft.com/)
55
[![Platform](https://img.shields.io/badge/platform-linux--arm64-lightgrey)](https://github.com/DynamicDevices/cga-coordinate-mapping)
6+
[![Code Coverage](https://img.shields.io/badge/coverage-58%25-green)](https://github.com/DynamicDevices/cga-coordinate-mapping/actions)
67

78
A .NET 8.0 application that converts Ultra-Wideband (UWB) sensor network data into GPS coordinates using trilateration algorithms. Designed for real-time position tracking and emergency response scenarios.
89

0 commit comments

Comments
 (0)