Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,39 @@ jobs:
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal
run: dotnet test
--configuration Release
--no-build
--verbosity normal
--collect:"XPlat Code Coverage"
--results-directory ./coverage
--settings .runsettings

- name: Install dotnet coverage
if: matrix.os == 'ubuntu-latest'
run: dotnet tool install --global dotnet-coverage

- name: Merge cobertura reports
if: matrix.os == 'ubuntu-latest'
run: dotnet-coverage merge "coverage/**/*.cobertura.xml" --output ./coverage/merged.cobertura.xml --output-format cobertura

- name: Create a code coverage summary
if: matrix.os == 'ubuntu-latest'
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: source/coverage/merged.cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'

- name: Add code coverage PR comment
if: matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-results.md
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ bld/

# Coverage Reports
[Cc]overage[Rr]eport/
coverage/

# Benchmark Results
BenchmarkDotNet.Artifacts/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

A library to safely handle various types of quantities, typically physical quantities.

[![master status](https://github.com/atmoos/Quantities/actions/workflows/dotnet.yml/badge.svg)](https://github.com/atmoos/Quantities/actions/workflows/dotnet.yml)
[![main status](https://github.com/atmoos/Quantities/actions/workflows/dotnet.yml/badge.svg)](https://github.com/atmoos/Quantities/actions/workflows/dotnet.yml)
[![nuget package](https://img.shields.io/nuget/v/Atmoos.Quantities.svg?logo=nuget)](https://www.nuget.org/packages/Atmoos.Quantities)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/atmoos/Quantities/blob/master/LICENSE)

Expand Down
17 changes: 17 additions & 0 deletions source/.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat Code Coverage">
<Configuration>
<Exclude>[Atmoos.Quantities.TestTools]*</Exclude>
<ExcludeByAttribute>Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute</ExcludeByAttribute>
<!-- Exclude the test projects from coverage -->
<IncludeTestAssembly>false</IncludeTestAssembly>
<!-- Calculate each line hit only once. More conservative -->
<SingleHit>true</SingleHit>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
1 change: 1 addition & 0 deletions source/Atmoos.Quantities.Test.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<PropertyGroup>
<IsPackable>false</IsPackable>
<RunSettingsFilePath>$(MSBuildStartupDirectory)\.runsettings</RunSettingsFilePath>
</PropertyGroup>

<ItemGroup>
Expand Down