88jobs :
99 test :
1010 runs-on : ubuntu-latest
11- steps :
11+
12+ strategy :
13+ matrix :
14+ include :
15+ - name : UserManagementApi.Tests.Unit
16+ proj : UserManagementApi.Tests.Unit.csproj
17+ - name : UserManagementApi.Tests.Integration
18+ proj : UserManagementApi.Tests.Integration.csproj
19+
20+ steps :
1221 - uses : actions/checkout@v4
22+
1323 - uses : actions/setup-dotnet@v4
1424 with :
1525 dotnet-version : ' 9.0.x'
1626
27+ - name : Sanity: show files at repo root
28+ run : ls -la
29+
1730 - name : Restore
1831 run : dotnet restore
1932
20- - name : Test with coverage (collector → LCOV)
21- run : dotnet test --collect:"XPlat Code Coverage" --settings coverlet.runsettings --results-directory ./TestResults
33+ - name : Build (Release)
34+ run : dotnet build --configuration Release --no-restore
35+
36+ - name : Test with coverage (collector -> LCOV)
37+ run : |
38+ dotnet test "${{ matrix.proj }}" \
39+ --no-build \
40+ --collect:"XPlat Code Coverage" \
41+ --settings coverlet.runsettings.xml \
42+ --results-directory "./TestResults/${{ matrix.name }}" \
43+ --logger "trx;LogFileName=${{ matrix.name }}.trx" \
44+ -v n
45+
46+ - name : Upload coverage + TRX
47+ if : always()
48+ uses : actions/upload-artifact@v4
49+ with :
50+ name : ${{ matrix.name }}-results
51+ path : |
52+ TestResults/${{ matrix.name }}/**/coverage.info
53+ TestResults/${{ matrix.name }}/**/*.trx
2254
23- # Upload all coverage.info files (supports multiple test projects )
55+ # Codecov (optional )
2456 - name : Upload to Codecov
25- uses : codecov/codecov-action@v4
57+ if : success()
58+ uses : codecov/codecov-action@v5
2659 with :
27- files : ' **/ TestResults/**/coverage.info'
28- flags : unit,integration
60+ files : TestResults/${{ matrix.name }}/ **/coverage.info
61+ flags : ${{ matrix.name }}
2962 fail_ci_if_error : true
30- verbose : true
31- # token: ${{ secrets.CODECOV_TOKEN }} # only needed for private repos
63+ use_oidc : true
64+ permissions :
65+ id-token : write
0 commit comments