-
Notifications
You must be signed in to change notification settings - Fork 693
Adding code coverage to tests in workflow #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
eiriktsarpalis
merged 16 commits into
modelcontextprotocol:main
from
aaronpowell:code-coverage
Mar 25, 2025
Merged
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
81d31a7
Adding code coverage to tests in workflow
aaronpowell e5a8e81
Merge branch 'main' into code-coverage
stephentoub f591495
Feedback from code review
aaronpowell 6c7226a
Merge branch 'code-coverage' of https://github.com/aaronpowell/csharp…
aaronpowell 352493d
Slight change to structure
aaronpowell e35c365
Bad indentation
aaronpowell c90641a
Ensuring .NET SDK is installed
aaronpowell 0e176b1
Merge branch 'main' into code-coverage
stephentoub 617ca38
Disabling fail-fast so that jobs aren't terminated if one fails
aaronpowell ffde296
Merge branch 'code-coverage' of https://github.com/aaronpowell/csharp…
aaronpowell 0d0b2eb
Merge branch 'main' into code-coverage
eiriktsarpalis 5640270
Merge branch 'main' into code-coverage
eiriktsarpalis 7dff276
Forgot to include coverlet.collector
aaronpowell 8ccbf29
Update Directory.Packages.props
stephentoub e224b2a
Merge branch 'main' into code-coverage
stephentoub 54d46fb
Merge branch 'main' into code-coverage
eiriktsarpalis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| name: Code Coverage | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| publish-coverage: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: | | ||
| 9.0.x | ||
| 8.0.x | ||
|
|
||
| - name: Download test results | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: testresults-* | ||
|
|
||
| - name: Combine coverage reports | ||
| uses: danielpalme/ReportGenerator-GitHub-Action@5.4.4 | ||
| with: | ||
| reports: "**/*.cobertura.xml" | ||
| targetdir: "${{ github.workspace }}/report" | ||
| reporttypes: "HtmlSummary;Cobertura;MarkdownSummary;MarkdownSummaryGithub" | ||
| verbosity: "Info" | ||
| title: "Code Coverage" | ||
| tag: "${{ github.run_number }}_${{ github.run_id }}" | ||
| customSettings: "" | ||
| toolpath: "reportgeneratortool" | ||
|
|
||
| - name: Upload combined coverage XML | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage | ||
| path: ${{ github.workspace }}/report | ||
| retention-days: 7 | ||
|
|
||
| - name: Publish code coverage report | ||
| uses: irongut/CodeCoverageSummary@v1.3.0 | ||
| with: | ||
| filename: "report/Cobertura.xml" | ||
| badge: true | ||
| fail_below_min: true | ||
| format: markdown | ||
| hide_branch_rate: false | ||
| hide_complexity: false | ||
| indicators: true | ||
| output: both | ||
| thresholds: "60 80" | ||
|
|
||
| - name: Upload combined coverage markdown | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-markdown | ||
| path: ${{ github.workspace }}/code-coverage-results.md | ||
| retention-days: 7 | ||
|
|
||
| - name: Add Coverage PR Comment | ||
| uses: marocchino/sticky-pull-request-comment@v2 | ||
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | ||
| with: | ||
| recreate: true | ||
| path: ${{ github.workspace }}/code-coverage-results.md | ||
|
|
||
| - name: Coverage on step summary | ||
| if: always() | ||
| run: cat "${{ github.workspace }}/report/SummaryGithub.md" >> $GITHUB_STEP_SUMMARY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,43 @@ | ||
| <Project> | ||
| <PropertyGroup> | ||
| <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||
| <SystemVersion>9.0.3</SystemVersion> | ||
| <System10Version>10.0.0-preview.2.25163.2</System10Version> | ||
| <MicrosoftExtensionsVersion>9.0.3</MicrosoftExtensionsVersion> | ||
| <MicrosoftExtensionsAIVersion>9.3.0-preview.1.25161.3</MicrosoftExtensionsAIVersion> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <!-- Product dependencies --> | ||
| <PackageVersion Include="Microsoft.Bcl.Memory" Version="$(SystemVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.AI" Version="$(MicrosoftExtensionsAIVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="$(MicrosoftExtensionsAIVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(MicrosoftExtensionsVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsVersion)" /> | ||
| <PackageVersion Include="System.Net.ServerSentEvents" Version="$(System10Version)" /> | ||
| <PackageVersion Include="System.Text.Json" Version="$(SystemVersion)" /> | ||
| <PackageVersion Include="System.Threading.Channels" Version="$(SystemVersion)" /> | ||
|
|
||
| <!-- Build Infra & Packaging --> | ||
| <PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" /> | ||
|
|
||
| <!-- Testing dependencies --> | ||
| <PackageVersion Include="Anthropic.SDK" Version="4.7.1" /> | ||
| <PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="$(MicrosoftExtensionsAIVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.Hosting" Version="$(MicrosoftExtensionsVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsVersion)" /> | ||
| <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" /> | ||
| <PackageVersion Include="Moq" Version="4.20.72" /> | ||
| <PackageVersion Include="Serilog.Extensions.Hosting" Version="9.0.0" /> | ||
| <PackageVersion Include="Serilog.Extensions.Logging" Version="9.0.0" /> | ||
| <PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" /> | ||
| <PackageVersion Include="Serilog.Sinks.Debug" Version="3.0.0" /> | ||
| <PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" /> | ||
| <PackageVersion Include="System.Linq.AsyncEnumerable" Version="$(System10Version)" /> | ||
| <PackageVersion Include="xunit.v3" Version="1.1.0" /> | ||
| <PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" /> | ||
| </ItemGroup> | ||
| <Project> | ||
| <PropertyGroup> | ||
| <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||
| <SystemVersion>9.0.3</SystemVersion> | ||
| <System10Version>10.0.0-preview.2.25163.2</System10Version> | ||
| <MicrosoftExtensionsVersion>9.0.3</MicrosoftExtensionsVersion> | ||
| <MicrosoftExtensionsAIVersion>9.3.0-preview.1.25161.3</MicrosoftExtensionsAIVersion> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <!-- Product dependencies --> | ||
| <PackageVersion Include="coverlet.collector" Version="6.0.4"> | ||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
| <PrivateAssets>all</PrivateAssets> | ||
| </PackageVersion> | ||
| <PackageVersion Include="Microsoft.Bcl.Memory" Version="$(SystemVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.AI" Version="$(MicrosoftExtensionsAIVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="$(MicrosoftExtensionsAIVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(MicrosoftExtensionsVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsVersion)" /> | ||
| <PackageVersion Include="System.Net.ServerSentEvents" Version="$(System10Version)" /> | ||
| <PackageVersion Include="System.Text.Json" Version="$(SystemVersion)" /> | ||
| <PackageVersion Include="System.Threading.Channels" Version="$(SystemVersion)" /> | ||
| <!-- Build Infra & Packaging --> | ||
| <PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" /> | ||
| <!-- Testing dependencies --> | ||
| <PackageVersion Include="Anthropic.SDK" Version="4.7.1" /> | ||
|
stephentoub marked this conversation as resolved.
|
||
| <PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" /> | ||
| <PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="$(MicrosoftExtensionsAIVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.Hosting" Version="$(MicrosoftExtensionsVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsVersion)" /> | ||
| <PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsVersion)" /> | ||
| <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" /> | ||
| <PackageVersion Include="Moq" Version="4.20.72" /> | ||
| <PackageVersion Include="Serilog.Extensions.Hosting" Version="9.0.0" /> | ||
| <PackageVersion Include="Serilog.Extensions.Logging" Version="9.0.0" /> | ||
| <PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" /> | ||
| <PackageVersion Include="Serilog.Sinks.Debug" Version="3.0.0" /> | ||
| <PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" /> | ||
| <PackageVersion Include="System.Linq.AsyncEnumerable" Version="$(System10Version)" /> | ||
| <PackageVersion Include="xunit.v3" Version="1.1.0" /> | ||
| <PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" /> | ||
| </ItemGroup> | ||
| </Project> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.