Skip to content

Write test output and coverage to GH actions #8

Write test output and coverage to GH actions

Write test output and coverage to GH actions #8

Workflow file for this run

name: "Run tests"
on: [ push, pull_request ]
jobs:
test:
runs-on: ubuntu-latest
name: Run tests
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
global-json-file: global.json
cache: true
cache-dependency-path: src/**/packages.lock.json
- run: dotnet restore --locked-mode
- name: Run tests with coverage
run: dotnet test /p:CollectCoverage=true --logger trx --results-directory "TestResults"
- name: Upload dotnet test results
uses: actions/upload-artifact@v3
with:
name: dotnet-results
path: TestResults
if: ${{ always() }}
- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage/**/coverage.cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'
- 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