name: Coverage
on:
pull_request:
branches:
- main
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Get Cover
uses: orgoro/coverage@v3
with:
coverageFile: path/to/coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
Update_Coverage:
runs-on: ubuntu-latest
steps:
- name: Test
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --logger trx --results-directory coverage
- name: Copy Coverage to Predictable Location
run: cp coverage/*/coverage.cobertura.xml coverage/coverage.cobertura.xml
- name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage/coverage.cobertura.xml
badge: true
format: 'markdown'
output: 'both'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
- name: Write to Job Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY