eddievelasquez / Bach

Bach - .NET Music Theory Library
MIT License
6 stars 1 forks source link

Generate and display Code Coverage report #15

Open eddievelasquez opened 1 year ago

eddievelasquez commented 1 year ago

See Code Coverage in .NET for ideas.

Steps for generating locally:

A partial GitHub action for this could be:

    - name: Test
      run: dotnet test src/DocFXExample.sln --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory coverage

    - name: Copy Coverage To Predictable Location
      run: cp coverage/**/coverage.cobertura.xml coverage.cobertura.xml

    - name: Coverage Summary Report
      uses:  irongut/CodeCoverageSummary@v1.3.0
      with:
        filename: coverage.cobertura.xml
        badge: true
        format: 'md'
        output: 'both'

    - name: Add Coverage PR Comment
      uses: marocchino/sticky-pull-request-comment@v2.5.0
      if: github.event_name == 'pull_request'
      with:
        recreate: true
        path: code-coverage-results.md

    - name: Upload Coverage Artifact
      uses: actions/upload-artifact@v3.1.2
      with:
        name: test-coverage-report
        path: |
          coverage.cobertura.xml
          code-coverage-results.md     

Still need to figure out how to publish the report to GitHub Pages.

DaveHogan commented 2 months ago

I suggest publishing the code coverage results to CodeCov. Apologies if you're familiar with this, but if you haven't seen it, take a look here - https://about.codecov.io/

It's free for public repos and can provide badges and statuses https://docs.codecov.com/docs/status-badges.

I'm not affiliated in anyway.