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
44 changes: 42 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
Expand All @@ -24,8 +26,46 @@ jobs:
- name: Build
run: dotnet build src/Endpointer.slnx --no-restore -c Release

- name: Test
run: dotnet test --solution src/Endpointer.slnx --no-build -c Release
- name: Test with Coverage
run: |
dotnet tool install -g dotnet-coverage
dotnet-coverage collect -s src/coverage.runsettings -f cobertura -o ./coverage/coverage.cobertura.xml "dotnet test --solution src/Endpointer.slnx --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;Badges" -assemblyfilters:"+Endpointer"

- name: Add Coverage to Job Summary
if: always()
run: cat ./coverage/report/SummaryGithub.md >> $GITHUB_STEP_SUMMARY

- name: Publish Coverage Badge
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

mkdir -p /tmp/badges
cp ./coverage/report/badge_linecoverage.svg /tmp/badges/
cp ./coverage/report/badge_branchcoverage.svg /tmp/badges/

if git ls-remote --exit-code --heads origin coverage; then
git fetch origin coverage:coverage
git switch coverage
else
git switch --orphan coverage
fi

cp /tmp/badges/*.svg .
git add badge_linecoverage.svg badge_branchcoverage.svg

if git diff --staged --quiet; then
echo "No changes to coverage badges"
else
git commit -m "Update coverage badges"
git push origin coverage
fi

- name: Pack
run: dotnet pack src/Endpointer/Endpointer.csproj --no-build -c Release -o ./artifacts
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ScaffoldingReadMe.txt
~$*
*~
CodeCoverage/
coverage/

# MSBuild Binary and Structured Log
*.binlog
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Endpointer

[![Build](https://github.com/stephanprobst/Endpointer/actions/workflows/build.yml/badge.svg)](https://github.com/stephanprobst/Endpointer/actions/workflows/build.yml)
[![Coverage](https://raw.githubusercontent.com/stephanprobst/Endpointer/coverage/badge_linecoverage.svg)](https://github.com/stephanprobst/Endpointer)
[![NuGet](https://img.shields.io/nuget/v/Endpointer.svg)](https://www.nuget.org/packages/Endpointer/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![netstandard2.0](https://img.shields.io/badge/netstandard-2.0-blue)](https://docs.microsoft.com/en-us/dotnet/standard/net-standard)
[![Roslyn](https://img.shields.io/badge/Roslyn-Source%20Generator-blueviolet)](https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/)
[![.NET 8](https://img.shields.io/badge/.NET-8.0-blue)](https://dotnet.microsoft.com/)
[![.NET 9](https://img.shields.io/badge/.NET-9.0-blue)](https://dotnet.microsoft.com/)
[![.NET 10](https://img.shields.io/badge/.NET-10.0-blue)](https://dotnet.microsoft.com/)

A **C# source generator** for ASP.NET Core Minimal APIs implementing the **REPR (Request-Endpoint-Response) pattern**.

Expand Down
21 changes: 21 additions & 0 deletions src/coverage.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Configuration>
<CodeCoverage>
<ModulePaths>
<Include>
<ModulePath>.*Endpointer\.dll$</ModulePath>
</Include>
<Exclude>
<ModulePath>.*\.Tests\.dll$</ModulePath>
<ModulePath>.*TestWebApi\.dll$</ModulePath>
<ModulePath>.*Basic\.Reference\.Assemblies.*</ModulePath>
</Exclude>
</ModulePaths>
<Attributes>
<Exclude>
<Attribute>^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$</Attribute>
<Attribute>^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$</Attribute>
</Exclude>
</Attributes>
</CodeCoverage>
</Configuration>