Publish code coverage results #615
Workflow file for this run
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
name: .NET | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
VSTEST_CONNECTION_TIMEOUT: 180 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1 | |
TERM: xterm | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
permissions: | |
pull-requests: write | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
8.0.x | |
9.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore -c Release /p:ContinuousIntegrationBuild=true | |
- name: Test | |
run: dotnet test -c Release --no-build -p:VSTestUseMSBuildOutput=false --collect:"XPlat Code Coverage" --logger trx --results-directory coverage | |
- name: ReportGenerator | |
uses: danielpalme/ReportGenerator-GitHub-Action@5 | |
with: | |
reports: 'coverage/*/coverage.cobertura.xml' | |
targetdir: coveragereport | |
reporttypes: MarkdownSummaryGithub | |
- name: Write to Job Summary | |
shell: pwsh | |
run: Get-Content coveragereport/SummaryGithub.md >> ${env:GITHUB_STEP_SUMMARY} | |
# Can't be properly tested from a fork | |
# | |
# - name: Add comment to PR | |
# if: github.event_name == 'pull_request' | |
# run: gh pr comment $PR_NUMBER --body-file coveragereport/SummaryGithub.md | |
# env: | |
# GH_TOKEN: ${{ github.comment }} | |
# PR_NUMBER: ${{ github.event.number }} |