-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add code coverage report to pipeline. Fixes #42. Design is basically: 1. Capture code coverage files in `test.runsettings` to avoid embedding settings / logic in the pipeline YAML and make it possible to generate coverage locally the same as CI - Currently uses a simple assembly include limited to `Moq.Analyzers.dll`. Ideally we could say "all project references". Added a TODO for that, as well as to discuss with the code coverage team 3. Add `CleanCoverageReport` and `GenerateCoverageReport` targets in test MSBuild slice to handle merging the reports across test projects 4. Use the MSBuild task for `dotnet-reportgenerator` to merge code coverage reports into: - A markdown summary for GitHub - An HTML report with line-coverage info - A merged Cobertura XML report for tool processing 5. Update GitHub Actions YAML so that: - Markdown summary is added to the summary of the run - Other coverage reports are added as a build artifact I didn't add any functionality to fail below a certain threshold, as tools generally use a static threshold, or do odd things to smuggle state like creating a branch in the repo or storing information in a gist, so leaving that for later.
- Loading branch information
1 parent
5a8cad8
commit 5212cbe
Showing
5 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- File name extension must be .runsettings --> | ||
<RunSettings> | ||
<DataCollectionRunSettings> | ||
<DataCollectors> | ||
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | ||
<Configuration> | ||
<Format>cobertura</Format> | ||
<IncludeTestAssembly>False</IncludeTestAssembly> | ||
<CodeCoverage> | ||
<EnableStaticNativeInstrumentation>False</EnableStaticNativeInstrumentation> | ||
<EnableDynamicNativeInstrumentation>False</EnableDynamicNativeInstrumentation> | ||
<ModulePaths> | ||
<Include> | ||
<!-- | ||
Limit code coverage to the shipping binary. | ||
TODO: Consider using a "Just my code"-esque tool to automatically include all project references. | ||
Discuss in https://github.com/microsoft/codecoverage. | ||
--> | ||
<ModulePath>.*Moq\.Analyzers\.dll$</ModulePath> | ||
</Include> | ||
</ModulePaths> | ||
</CodeCoverage> | ||
</Configuration> | ||
</DataCollector> | ||
</DataCollectors> | ||
</DataCollectionRunSettings> | ||
</RunSettings> |