diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6fd3d9c..5d8aeff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,5 +26,15 @@ jobs: - name: Build run: dotnet build --no-restore -c Release - - name: Test - run: dotnet test --no-build -c Release --verbosity normal + - name: Test with Coverage + run: | + dotnet tool install -g dotnet-coverage + dotnet-coverage collect -s coverage.runsettings -f cobertura -o ./coverage/coverage.cobertura.xml "dotnet test --no-build -c Release --verbosity normal" + + - name: Generate Coverage Report + run: | + dotnet tool install -g dotnet-reportgenerator-globaltool + reportgenerator -reports:./coverage/coverage.cobertura.xml -targetdir:./coverage/report -reporttypes:"MarkdownSummaryGithub" -assemblyfilters:"+SimpleBranchVersioning" + + - name: Add Coverage to Job Summary + run: cat ./coverage/report/SummaryGithub.md >> $GITHUB_STEP_SUMMARY diff --git a/coverage.runsettings b/coverage.runsettings new file mode 100644 index 0000000..a958ca0 --- /dev/null +++ b/coverage.runsettings @@ -0,0 +1,20 @@ + + + + + + .*SimpleBranchVersioning\.dll$ + + + .*\.Tests\.dll$ + .*Basic\.Reference\.Assemblies.* + + + + + ^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$ + ^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$ + + + +