Skip to content

Commit 7aec791

Browse files
committed
Enhance GitHub Actions workflow by adding multiple test report jobs for various report types, including detailed, failed, flaky, and custom reports, while removing the 'tests-changed-report' option for improved clarity.
1 parent 9615fe6 commit 7aec791

File tree

2 files changed

+285
-4
lines changed

2 files changed

+285
-4
lines changed

.github/workflows/build-and-test.yaml

Lines changed: 274 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
with:
2626
report-path: './ctrf/*.json'
2727
summary-delta-report: true
28-
tests-changed-report: true
2928
github-report: true
3029
failed-report: true
3130
flaky-report: true
@@ -57,4 +56,278 @@ jobs:
5756
annotate: false
5857
env:
5958
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
if: always()
60+
standard-reports-test:
61+
needs: build-and-test
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Checkout code
65+
uses: actions/checkout@v4
66+
- name: Basic Test Report
67+
uses: ./
68+
with:
69+
report-path: './ctrf-reports/ctrf-report.json'
70+
summary-report: true
71+
annotate: false
72+
if: always()
73+
github-report-test:
74+
needs: build-and-test
75+
runs-on: ubuntu-latest
76+
steps:
77+
- name: Checkout code
78+
uses: actions/checkout@v4
79+
- name: Detailed Test Report
80+
uses: ./
81+
with:
82+
report-path: './ctrf-reports/ctrf-report.json'
83+
github-report: true
84+
annotate: false
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
if: always()
88+
detailed-reports-test:
89+
needs: build-and-test
90+
runs-on: ubuntu-latest
91+
steps:
92+
- name: Checkout code
93+
uses: actions/checkout@v4
94+
- name: Detailed Test Report
95+
uses: ./
96+
with:
97+
report-path: './ctrf-reports/ctrf-report.json'
98+
test-report: true
99+
test-list-report: true
100+
annotate: false
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
if: always()
104+
failed-reports-test:
105+
needs: build-and-test
106+
runs-on: ubuntu-latest
107+
steps:
108+
- name: Checkout code
109+
uses: actions/checkout@v4
110+
- name: Failed Test Reports
111+
uses: ./
112+
with:
113+
report-path: './ctrf-reports/ctrf-report.json'
114+
failed-report: true
115+
failed-folded-report: true
116+
annotate: false
117+
env:
118+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
if: always()
120+
flaky-reports-test:
121+
needs: build-and-test
122+
runs-on: ubuntu-latest
123+
steps:
124+
- name: Checkout code
125+
uses: actions/checkout@v4
126+
- name: Flaky Test Reports
127+
uses: ./
128+
with:
129+
report-path: './ctrf-reports/ctrf-report.json'
130+
flaky-report: true
131+
annotate: false
132+
env:
133+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
134+
if: always()
135+
ai-reports-test:
136+
needs: build-and-test
137+
runs-on: ubuntu-latest
138+
steps:
139+
- name: Checkout code
140+
uses: actions/checkout@v4
141+
- name: AI Test Reports
142+
uses: ./
143+
with:
144+
report-path: './ctrf-reports/ctrf-report.json'
145+
ai-report: true
146+
annotate: false
147+
if: always()
148+
skipped-reports-test:
149+
needs: build-and-test
150+
runs-on: ubuntu-latest
151+
steps:
152+
- name: Checkout code
153+
uses: actions/checkout@v4
154+
- name: Skipped Test Reports
155+
uses: ./
156+
with:
157+
report-path: './ctrf-reports/ctrf-report.json'
158+
skipped-report: true
159+
annotate: false
160+
if: always()
161+
suite-reports-test:
162+
needs: build-and-test
163+
runs-on: ubuntu-latest
164+
steps:
165+
- name: Checkout code
166+
uses: actions/checkout@v4
167+
- name: Suite Test Reports
168+
uses: ./
169+
with:
170+
report-path: './ctrf-reports/ctrf-report.json'
171+
suite-list-report: true
172+
suite-folded-report: true
173+
annotate: false
174+
if: always()
175+
commit-reports-test:
176+
needs: build-and-test
177+
runs-on: ubuntu-latest
178+
steps:
179+
- name: Checkout code
180+
uses: actions/checkout@v4
181+
- name: Commit Test Reports
182+
uses: ./
183+
with:
184+
report-path: './ctrf-reports/ctrf-report.json'
185+
commit-report: true
186+
annotate: false
187+
if: always()
188+
custom-reports-test:
189+
needs: build-and-test
190+
runs-on: ubuntu-latest
191+
steps:
192+
- name: Checkout code
193+
uses: actions/checkout@v4
194+
- name: Custom Test Reports
195+
uses: ./
196+
with:
197+
report-path: './ctrf-reports/ctrf-report.json'
198+
custom-report: true
199+
template-path: './templates/custom-report.hbs'
200+
annotate: false
201+
if: always()
202+
community-reports-test:
203+
needs: build-and-test
204+
runs-on: ubuntu-latest
205+
steps:
206+
- name: Checkout code
207+
uses: actions/checkout@v4
208+
- name: Community Test Reports
209+
uses: ./
210+
with:
211+
report-path: './ctrf-reports/ctrf-report.json'
212+
community-report: true
213+
community-report-name: 'summary-short'
214+
annotate: false
215+
if: always()
216+
previous-reports-test:
217+
needs: build-and-test
218+
runs-on: ubuntu-latest
219+
steps:
220+
- name: Checkout code
221+
uses: actions/checkout@v4
222+
- name: Install dependencies
223+
run: npm install
224+
- name: Modify reports
225+
run: npm run modify-reports
226+
- name: Reports Requiring Previous
227+
uses: ./
228+
with:
229+
report-path: './ctrf-reports/*.json'
230+
previous-results-report: true
231+
flaky-rate-report: true
232+
fail-rate-report: true
233+
insights-report: true
234+
slowest-report: true
235+
annotate: false
236+
env:
237+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
238+
if: always()
239+
report-order-test:
240+
needs: build-and-test
241+
runs-on: ubuntu-latest
242+
steps:
243+
- name: Checkout code
244+
uses: actions/checkout@v4
245+
- name: Install dependencies
246+
run: npm install
247+
- name: Modify reports
248+
run: npm run modify-reports
249+
- name: Custom Report Order
250+
uses: ./
251+
with:
252+
report-path: './ctrf-reports/*.json'
253+
summary-report: true
254+
failed-report: true
255+
flaky-report: true
256+
report-order: 'flaky-report,failed-report,summary-report'
257+
annotate: false
258+
env:
259+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
260+
if: always()
261+
collapse-large-reports-test:
262+
needs: build-and-test
263+
runs-on: ubuntu-latest
264+
steps:
265+
- name: Checkout code
266+
uses: actions/checkout@v4
267+
- name: Install dependencies
268+
run: npm install
269+
- name: Modify reports
270+
run: npm run modify-reports
271+
- name: Collapse Large Reports Test
272+
uses: ./
273+
with:
274+
report-path: './ctrf-reports/*.json'
275+
test-report: true
276+
test-list-report: true
277+
collapse-large-reports: true
278+
annotate: false
279+
env:
280+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
281+
if: always()
282+
junit-to-ctrf-test:
283+
needs: build-and-test
284+
runs-on: ubuntu-latest
285+
steps:
286+
- name: Checkout code
287+
uses: actions/checkout@v4
288+
- name: Install dependencies
289+
run: npm install
290+
- name: Modify reports
291+
run: npm run modify-reports
292+
- name: JUnit to CTRF integration test
293+
uses: ./
294+
with:
295+
report-path: './ctrf-reports/*.xml'
296+
integrations-config: |
297+
{
298+
"junit-to-ctrf": {
299+
"enabled": true,
300+
"action": "convert",
301+
"options": {
302+
"output": "./ctrf-reports/ctrf-report.json",
303+
"toolname": "junit-to-ctrf",
304+
"useSuiteName": false,
305+
"env": {
306+
"appName": "my-app"
307+
}
308+
}
309+
}
310+
}
311+
annotate: false
312+
env:
313+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
314+
if: always()
315+
file-reports-test:
316+
needs: build-and-test
317+
runs-on: ubuntu-latest
318+
steps:
319+
- name: Checkout code
320+
uses: actions/checkout@v4
321+
- name: Install dependencies
322+
run: npm install
323+
- name: Modify reports
324+
run: npm run modify-reports
325+
- name: File Reports Test
326+
uses: ./
327+
with:
328+
report-path: './ctrf-reports/*.json'
329+
file-report: true
330+
annotate: false
331+
env:
332+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60333
if: always()

__tests__/ctrf/helpers.test.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ describe('getEmoji', () => {
55
expect(getEmoji('passed')).toBe('✅')
66
})
77

8-
it('returns the correct emoji fokr "failed"', () => {
8+
it('returns the correct emoji for "failed"', () => {
99
expect(getEmoji('failed')).toBe('❌')
1010
})
1111

12+
it('returns the correct emoji for "skipped"', () => {
13+
expect(getEmoji('skipped')).toBe('⏭️')
14+
})
15+
1216
it('returns the correct emoji for "pending"', () => {
1317
expect(getEmoji('pending')).toBe('⏳')
1418
})
@@ -21,10 +25,14 @@ describe('getEmoji', () => {
2125
expect(getEmoji('build')).toBe('🏗️')
2226
})
2327

24-
it('returns the correct emoji for "duratioppn"', () => {
28+
it('returns the correct emoji for "duration"', () => {
2529
expect(getEmoji('duration')).toBe('⏱️')
2630
})
2731

32+
it('returns the correct emoji for "flaky"', () => {
33+
expect(getEmoji('flaky')).toBe('🍂')
34+
})
35+
2836
it('returns the correct emoji for "tests"', () => {
2937
expect(getEmoji('tests')).toBe('📝')
3038
})
@@ -103,4 +111,4 @@ describe('stripAnsi', () => {
103111
// @ts-expect-error Testing runtime error
104112
expect(() => stripAnsi({})).toThrow(TypeError)
105113
})
106-
})
114+
})

0 commit comments

Comments
 (0)