boa-constrictor icon indicating copy to clipboard operation
boa-constrictor copied to clipboard

Add code coverage report to unit-tests.yml GitHub Action

Open AndyLPK247 opened this issue 4 years ago • 1 comments

This is a follow-up to #18. It would be nice to run code coverage and share the report.

Check out this article: https://codeburst.io/code-coverage-in-net-core-projects-c3d6536fd7d7

Questions:

  • What code coverage tool should we use?
  • Where should the report be published? (in the log, uploaded elsewhere, etc.)
  • Is code coverage worthwhile for this project?

AndyLPK247 avatar Oct 23 '20 21:10 AndyLPK247

In this article https://samlearnsazure.blog/2021/01/05/code-coverage-in-github-with-net-core/ the output format for coverlet is set to lcov and he adds it to the pipeline

`- name: Run automated unit and integration tests
  run: dotnet test FeatureFlags/FeatureFlags.Tests/FeatureFlags.Tests.csproj  /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov`

Sends it up to https://coveralls.io

`- name: Publish coverage report to coveralls.io   
  uses: coverallsapp/github-action@master   
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }} 
    path-to-lcov: FeatureFlags/FeatureFlags.Tests/TestResults/coverage.info`

Then has a nice coverage badge

CoffeeAtBedtime avatar Dec 04 '22 23:12 CoffeeAtBedtime