Skip to content

Commit 7102eb7

Browse files
committed
feat: add inputs to report
1 parent 27b97ad commit 7102eb7

File tree

7 files changed

+30
-252
lines changed

7 files changed

+30
-252
lines changed

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

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

badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

dist/index.js

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/action-handler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export async function runAction(): Promise<void> {
1212
const githubContext = getAllGitHubContext()
1313

1414
const report = await prepareReport(inputs, githubContext)
15+
console.log(JSON.stringify(report, null, 2))
1516
await processIntegrations(inputs.integrationsConfig, report)
1617

1718
await handleViewsAndComments(inputs, report)

src/ctrf/report-preparation.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export async function prepareReport(
6060
)
6161
}
6262

63+
report = addInputsToExtra(report, inputs)
64+
6365
return report
6466
}
6567

@@ -115,3 +117,12 @@ function shouldProcessPreviousResults(inputs: Inputs): boolean {
115117
function hasJunitIntegration(inputs: Inputs): boolean {
116118
return Boolean(inputs.integrationsConfig?.['junit-to-ctrf'])
117119
}
120+
121+
function addInputsToExtra(report: CtrfReport, inputs: Inputs): CtrfReport {
122+
if (report.results.extra) {
123+
report.results.extra.inputs = inputs
124+
} else {
125+
report.results.extra = { inputs }
126+
}
127+
return report
128+
}

src/types/ctrf.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Inputs } from './reporter'
2+
13
export interface CtrfReport {
24
results: Results
35
}
@@ -139,7 +141,8 @@ export interface EnhancedSummaryExtra extends Record<string, unknown> {
139141
* Enhanced results extra fields.
140142
*/
141143
export interface EnhancedResultsExtra {
142-
previousReports: EnhancedCtrfReport[]
144+
previousReports?: EnhancedCtrfReport[]
145+
inputs?: Inputs
143146
}
144147

145148
/**

0 commit comments

Comments
 (0)