Add trx logger #262
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: Tests | |
on: | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
workflow_dispatch: | |
workflow_call: | |
permissions: { } | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
jobs: | |
test: | |
name: Tests | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
aka.ms:443 | |
api.nuget.org:443 | |
crl3.digicert.com:80 | |
crl4.digicert.com:80 | |
dc.services.visualstudio.com:443 | |
dotnetbuilds.azureedge.net:443 | |
dotnetcli.azureedge.net:443 | |
s.symcb.com:80 | |
ts-crl.ws.symantec.com:80 | |
www.microsoft.com:80 | |
github.com:443 | |
results-receiver.actions.githubusercontent.com:443 | |
*.blob.core.windows.net:443 | |
api.github.com:443 | |
*.actions.githubusercontent.com:443 | |
codeload.github.com:443 | |
ghcr.io:443 | |
*.actions.githubusercontent.com:443 | |
objects.githubusercontent.com:443 | |
objects-origin.githubusercontent.com:443 | |
github-releases.githubusercontent.com:443 | |
github-registry-files.githubusercontent.com:443 | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Setup Dotnet | |
id: dotnet-setup | |
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 # v4.1.0 | |
with: | |
dotnet-version: | | |
9.0.x | |
6.0.x | |
- name: dotnet tool restore | |
run: dotnet tool restore | |
- name: Dotnet restore | |
run: dotnet restore | |
- name: Dotnet build | |
run: dotnet build --configuration Release --no-restore | |
- name: Test with dotnet | |
run: > | |
dotnet test | |
--configuration Release | |
--no-restore | |
--logger trx | |
--collect:"XPlat Code Coverage" | |
--results-directory ./coverage | |
- name: TRX report | |
if: always() | |
run: dotnet trx --gh-summary true --gh-comment true | |
- name: TRX report upload | |
if: always() | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: trx-reports-${{ matrix.os }} | |
path: "./**/*.trx" | |
- name: ReportGenerator | |
uses: danielpalme/ReportGenerator-GitHub-Action@810356ce07a94200154301fb73d878e327b2dd58 # 5.4.1 | |
with: | |
reports: ./coverage/**/coverage.cobertura.xml | |
targetdir: ./coverage | |
reporttypes: Cobertura;MarkdownSummaryGithub | |
- name: Coverage summary | |
shell: bash | |
run: | | |
cat coverage/SummaryGithub.md >> $GITHUB_STEP_SUMMARY | |
- name: Upload Test Report Artifact | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: dotnet-coverage-on-${{ matrix.os }} | |
path: | | |
coverage/Cobertura.xml | |
if-no-files-found: 'error' |