Skip to content

Commit 73914d4

Browse files
Fix/GitHub report multiline commit message (#168)
1 parent 72cfc3b commit 73914d4

File tree

9 files changed

+26
-281
lines changed

9 files changed

+26
-281
lines changed

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

Lines changed: 1 addition & 269 deletions
Original file line numberDiff line numberDiff line change
@@ -11,56 +11,7 @@ on:
1111
- cron: '0 2 * * *'
1212

1313
jobs:
14-
build-and-test:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- name: Checkout code
18-
uses: actions/checkout@v4
19-
- name: Install dependencies
20-
run: npm install
21-
- name: Build
22-
run: npm run all:action
23-
- name: Publish Test Report
24-
uses: ./
25-
with:
26-
report-path: './ctrf/*.json'
27-
summary-report: true
28-
github-report: true
29-
failed-report: true
30-
flaky-report: true
31-
insights-report: true
32-
fail-rate-report: true
33-
flaky-rate-report: true
34-
slowest-report: true
35-
previous-results-report: true
36-
use-suite-name: true
37-
upload-artifact: true
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
if: always()
41-
- name: Publish Test Report
42-
uses: ./
43-
with:
44-
report-path: './ctrf/*.json'
45-
pull-request-report: true
46-
env:
47-
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()
6214
github-report-test:
63-
needs: build-and-test
6415
runs-on: ubuntu-latest
6516
steps:
6617
- name: Checkout code
@@ -74,223 +25,4 @@ jobs:
7425
env:
7526
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7627
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
28+

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,4 +443,6 @@ analyzing test outcomes across multiple platforms becomes more straightforward.
443443
## Support Us
444444

445445
If you find this project useful, consider giving it a GitHub star ⭐ It means a
446-
lot to us.
446+
lot to us.
447+
448+
vcbc

badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

ctrf-reports/ctrf-report.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"skipped": 1,
1212
"other": 1,
1313
"start": 1722511783500,
14-
"stop": 1722511794528
14+
"stop": 1722519283500
1515
},
1616
"tests": [
1717
{

dist/index.js

Lines changed: 9 additions & 2 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.

dist/reports/github.hbs

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

src/handlebars/helpers/ctrf.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,14 @@ export function formatDurationStartStopToHumanHelper(): void {
138138
return `${Math.floor(durationMs)}ms`
139139
} else if (durationMs < 60000) {
140140
return `${(durationMs / 1000).toFixed(1)}s`
141-
} else {
141+
} else if (durationMs < 3600000) {
142142
const minutes = Math.floor(durationMs / 60000)
143143
const seconds = Math.floor((durationMs % 60000) / 1000)
144-
return `${minutes}m${seconds}s`
144+
return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`
145+
} else {
146+
const hours = Math.floor(durationMs / 3600000)
147+
const minutes = Math.floor((durationMs % 3600000) / 60000)
148+
return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`
145149
}
146150
})
147151
}

src/reports/github.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
![pull-request](https://ctrf.io/assets/github/git-pull-request.svg) #{{github.pullRequestNumber}}
4444
{{/if}}
4545
{{else}}
46-
{{#if github.context.commits}} ![commit](https://ctrf.io/assets/github/commit.svg) {{github.context.commits.[0].message}}{{#if github.context.commits.[0].id}} ![link](https://ctrf.io/assets/github/link.svg) [{{sliceString github.context.commits.[0].id 0 7}}]({{github.context.commits.[0].url}}){{/if}}{{else}}{{github.commit.message}}{{#if github.commit.hash}} ![link](https://ctrf.io/assets/github/link.svg) [{{github.commit.hash.substring 0 7}}]({{#if github.repository}}{{github.repository}}/commit/{{github.commit.hash}}{{else}}#{{/if}}){{/if}}{{/if}}
46+
{{#if github.context.commits}} ![commit](https://ctrf.io/assets/github/commit.svg) {{#with (splitLines github.context.commits.[0].message)}}{{#each this}}{{#if @first}}{{this}}{{/if}}{{/each}}{{/with}}{{#if github.context.commits.[0].id}} ![link](https://ctrf.io/assets/github/link.svg) [{{sliceString github.context.commits.[0].id 0 7}}]({{github.context.commits.[0].url}}){{/if}}{{else}}{{#with (splitLines github.commit.message)}}{{#each this}}{{#if @first}}{{this}}{{/if}}{{/each}}{{/with}}{{#if github.commit.hash}} ![link](https://ctrf.io/assets/github/link.svg) [{{github.commit.hash.substring 0 7}}]({{#if github.repository.htmlUrl}}{{github.repository.htmlUrl}}/commit/{{github.commit.hash}}{{else}}#{{/if}}){{/if}}{{/if}}
4747
{{/if}}
4848
{{#unless github.pullRequestNumber}}
4949
{{#if ctrf.environment.branchName}}
50-
![branch](https://ctrf.io/assets/github/git-branch.svg) {{ctrf.environment.branchName}}
50+
![branch](https://ctrf.io/assets/github/git-branch.svg) {{ctrf.environment.branchName}}{{#if github.repository.htmlUrl}} ![link](https://ctrf.io/assets/github/link.svg) [view]({{github.repository.htmlUrl}}/tree/{{ctrf.environment.branchName}}){{/if}}
5151
{{/if}}
5252
{{/unless}}
5353
{{#if ctrf.environment.testEnvironment}}

0 commit comments

Comments
 (0)