3838 build-test :
3939 name : Build & test
4040 runs-on : ubuntu-latest # Docker is preinstalled here — the integration tests need it (Testcontainers).
41+ permissions :
42+ contents : read
43+ checks : write # let the test reporter publish a per-test Check run.
4144 steps :
42- - uses : actions/checkout@v5
45+ - uses : actions/checkout@v7
4346
4447 - name : Setup .NET (from global.json)
4548 uses : actions/setup-dotnet@v5
@@ -60,15 +63,38 @@ jobs:
6063 - name : Build (Release, warnings-as-errors)
6164 run : dotnet build Warehouse.slnx -c Release --no-restore
6265
63- # To also collect coverage, add the `coverlet.collector` package to the test projects
64- # and append: --collect "XPlat Code Coverage"
6566 - name : Test (unit + architecture + integration)
6667 run : >
6768 dotnet test Warehouse.slnx -c Release --no-build
68- --logger "trx;LogFileName=test-results.trx"
69+ --logger trx
70+ --collect "XPlat Code Coverage"
6971 --results-directory ${{ github.workspace }}/TestResults
7072
71- - name : Upload test results
73+ # Surfaces a per-test pass/fail Check (with failure annotations on the PR) from the TRX files,
74+ # so you can see which tests broke without downloading the artifact. Runs even when tests fail.
75+ - name : Publish test report
76+ if : ${{ !cancelled() }}
77+ uses : dorny/test-reporter@v3
78+ with :
79+ name : Backend tests
80+ path : TestResults/**/*.trx
81+ reporter : dotnet-trx
82+ fail-on-error : false
83+
84+ # Turn the cobertura output (from coverlet.collector) into a markdown table on the run's summary page.
85+ - name : Coverage summary
86+ if : ${{ !cancelled() }}
87+ uses : danielpalme/ReportGenerator-GitHub-Action@5
88+ with :
89+ reports : ${{ github.workspace }}/TestResults/**/coverage.cobertura.xml
90+ targetdir : ${{ github.workspace }}/coveragereport
91+ reporttypes : MarkdownSummaryGithub
92+
93+ - name : Append coverage to job summary
94+ if : ${{ !cancelled() }}
95+ run : cat ${{ github.workspace }}/coveragereport/SummaryGithub.md >> "$GITHUB_STEP_SUMMARY" || true
96+
97+ - name : Upload test results & coverage
7298 if : ${{ !cancelled() }}
7399 uses : actions/upload-artifact@v7
74100 with :
93119 - name : logistics-api
94120 project : src/Services/Logistics/Warehouse.Logistics.Api/Warehouse.Logistics.Api.csproj
95121 steps :
96- - uses : actions/checkout@v5
122+ - uses : actions/checkout@v7
97123
98124 - name : Setup .NET (from global.json)
99125 uses : actions/setup-dotnet@v5
0 commit comments