1- name : Tests
1+ name : Tests
22
33on :
44 push :
@@ -102,21 +102,6 @@ jobs:
102102 comment_mode : off
103103 check_run : false
104104
105- # - name: Fail if tests failed (after publishing)
106- # if: always()
107- # shell: pwsh
108- # run: |
109- # if (-not (Test-Path 'test-results')) { Write-Error 'No test-results folder found'; exit 1 }
110- # $failed = 0
111- # Get-ChildItem 'test-results' -Filter *.trx | ForEach-Object {
112- # [xml]$xml = Get-Content $_.FullName
113- # $counters = $xml.TestRun.ResultSummary.Counters
114- # if ($counters) {
115- # $failed += [int]$counters.failed + [int]$counters.error + [int]$counters.timeout
116- # }
117- # }
118- # if ($failed -gt 0) { Write-Error "Tests failed: $failed"; exit 1 } else { Write-Host 'All tests passed' }
119-
120105 summary :
121106 name : Aggregate
122107 runs-on : ubuntu-24.04
@@ -128,6 +113,88 @@ jobs:
128113 with :
129114 path : test-results
130115
116+ # --- CTRF: setup & convert all TRX to CTRF in the aggregate job ---
117+ - name : Setup .NET (for CTRF conversion)
118+ uses : actions/setup-dotnet@v4
119+ with :
120+ dotnet-version : ' 10.0.x'
121+
122+ - name : Install CTRF TRX→CTRF converter (dotnet tool)
123+ run : |
124+ dotnet new tool-manifest
125+ dotnet tool install DotnetCtrfJsonReporter --local
126+
127+ - name : Convert TRX → CTRF (per downloaded artifact)
128+ shell : bash
129+ run : |
130+ set -euo pipefail
131+ mkdir -p ctrf
132+ shopt -s globstar nullglob
133+ conv=0
134+ # Expect structure like: test-results/test-results-ubuntu-24.04/*.trx
135+ for f in test-results/**/*.trx; do
136+ envname="$(basename "$(dirname "$f")")"
137+ # Fallback if the trx sits directly in test-results/
138+ [[ "$envname" == "test-results" ]] && envname="unknown"
139+ outdir="ctrf/${envname}"
140+ mkdir -p "$outdir"
141+ # Produce: ctrf/<env>/ctrf-report.json
142+ dotnet tool run DotnetCtrfJsonReporter -p "$f" -d "$outdir" -f "ctrf-report.json"
143+ echo "Converted $f -> $outdir/ctrf-report.json"
144+ conv=$((conv+1))
145+ done
146+ echo "Converted $conv TRX file(s) to CTRF"
147+
148+ - name : Upload CTRF reports (for history & insights)
149+ if : always()
150+ uses : actions/upload-artifact@v4
151+ with :
152+ name : ctrf-reports
153+ path : ctrf/**/*.json
154+ retention-days : 7
155+
156+ - name : Publish CTRF Test Report (all features)
157+ if : always()
158+ uses : ctrf-io/github-test-reporter@v1
159+ with :
160+ # Pick up every CTRF we just created (one per OS/artifact)
161+ report-path : ' ctrf/**/*.json'
162+
163+ # Post everywhere (job summary, PR comment, a status check)
164+ summary : true
165+ pull-request : true
166+ status-check : true
167+ status-check-name : ' CTRF Test Reporter'
168+
169+ # Turn on (almost) all built-in reports
170+ summary-report : true
171+ summary-delta-report : true
172+ tests-changed-report : true
173+ github-report : true
174+ test-report : true
175+ test-list-report : true
176+ failed-report : true
177+ failed-folded-report : true
178+ skipped-report : true
179+ suite-folded-report : true
180+ suite-list-report : true
181+ file-report : true
182+ previous-results-report : true
183+ insights-report : true
184+ flaky-report : true
185+ flaky-rate-report : true
186+ fail-rate-report : true
187+ slowest-report : true
188+
189+ # Store processed CTRF for comparisons on future runs
190+ upload-artifact : true
191+ fetch-previous-results : true
192+
193+ # Optional: make the order explicit
194+ report-order : ' summary-report,summary-delta-report,tests-changed-report,failed-report,failed-folded-report,flaky-report,flaky-rate-report,fail-rate-report,slowest-report,skipped-report,suite-folded-report,suite-list-report,file-report,test-report,test-list-report,previous-results-report,github-report'
195+ # env:
196+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
197+
131198 - name : Publish Test Results
132199 uses : EnricoMi/publish-unit-test-result-action@v2
133200 with :
0 commit comments