Skip to content

Commit f883ccc

Browse files
committed
Add statistics to citgm output
1 parent 489f159 commit f883ccc

File tree

3 files changed

+69
-29
lines changed

3 files changed

+69
-29
lines changed

lib/ci/ci_result_parser.js

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ class CITGMBuild extends TestBuild {
794794
return this.failures;
795795
}
796796

797-
this.results = this.parseResults(resultData.childReports);
797+
this.results = this.parseResults(resultData);
798798

799799
// Update id again so that it correctly displays in Summary output.
800800
this.path = `job/citgm-smoker/${id}/`;
@@ -803,9 +803,16 @@ class CITGMBuild extends TestBuild {
803803
}
804804

805805
parseResults(data) {
806-
const results = { all: {}, failures: {} };
806+
const { childReports, totalCount, skipCount, failCount } = data;
807+
const results = { all: {}, failures: {}, statistics: {} };
807808

808-
data.forEach(platform => {
809+
const passCount = totalCount - failCount - skipCount;
810+
results.statistics['passed'] = passCount;
811+
results.statistics['total'] = totalCount;
812+
results.statistics['skipped'] = skipCount;
813+
results.statistics['failed'] = failCount;
814+
815+
childReports.forEach(platform => {
809816
const cases = flatten(platform.result.suites[0].cases);
810817
const url = platform.child.url;
811818
const nodeName = getNodeName(url);
@@ -821,6 +828,15 @@ class CITGMBuild extends TestBuild {
821828

822829
displayBuilds() {
823830
const { cli, results } = this;
831+
const { failed, skipped, passed, total } = results.statistics;
832+
833+
cli.separator('Statistics');
834+
console.table({
835+
'Failed': failed,
836+
'Skipped': skipped,
837+
'Passed': passed,
838+
'Total': total
839+
});
824840

825841
cli.separator('Failures');
826842
const output = {};
@@ -840,20 +856,32 @@ class CITGMBuild extends TestBuild {
840856
const result = {
841857
source: sourceURL,
842858
upstream: jobUrl,
859+
...results.statistics,
843860
...results.failures
844861
};
845862

846863
return JSON.parse(JSON.stringify(result));
847864
}
848865

849866
formatAsMarkdown() {
850-
const { jobUrl, result, results } = this;
867+
const { jobUrl, result, results, id } = this;
868+
869+
let output = `# CITGM Data for [${id}](${jobUrl})\n\n`;
870+
871+
const { failed, skipped, passed, total } = results.statistics;
872+
873+
output += `## Statistics for job [${id}](${jobUrl})\n\n`;
874+
output += '| FAILED | SKIPPED | PASSED | TOTAL |\n';
875+
output += '| -------- | --------- | -------- | ------- |\n';
876+
output += `| ${pad(failed, 8)} | ${pad(skipped, 9)} |`;
877+
output += ` ${pad(passed, 8)} | ${pad(total, 7)} |\n\n`;
851878

852879
if (result === SUCCESS) {
853-
return `Job ${jobUrl} is green.`;
880+
output += `Job [${id}](${jobUrl}) is green.`;
881+
return output;
854882
}
855883

856-
let output = `Failures in job ${jobUrl}\n\n`;
884+
output += `## Failures in job [${id}](${jobUrl})\n\n`;
857885
for (const failure in results.failures) {
858886
const data = results.failures[failure];
859887
output += `### [${failure}](${data.url})\n\n`;

test/fixtures/jenkins/citgm/expected.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"source": "https://github.com/nodejs/node/pull/34093/",
33
"upstream": "https://ci.nodejs.org/job/citgm-smoker/2400/",
4+
"passed": 594,
5+
"total": 848,
6+
"skipped": 233,
7+
"failed": 21,
48
"debian9-64": {
59
"url": "https://ci.nodejs.org/job/citgm-smoker/nodes=debian9-64/2400/",
610
"modules": [
@@ -125,4 +129,4 @@
125129
}
126130
]
127131
}
128-
}
132+
}
Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,55 @@
1-
Failures in job https://ci.nodejs.org/job/citgm-smoker/2400/
1+
# CITGM Data for [2400](https://ci.nodejs.org/job/citgm-smoker/2400/)
2+
3+
## Statistics for job [2400](https://ci.nodejs.org/job/citgm-smoker/2400/)
4+
5+
| FAILED | SKIPPED | PASSED | TOTAL |
6+
| -------- | --------- | -------- | ------- |
7+
| 21 | 233 | 594 | 848 |
8+
9+
## Failures in job [2400](https://ci.nodejs.org/job/citgm-smoker/2400/)
210

311
### [debian9-64](https://ci.nodejs.org/job/citgm-smoker/nodes=debian9-64/2400/)
412

5-
coffeescript-v2.5.1
6-
through2-v4.0.2
13+
* coffeescript-v2.5.1
14+
* through2-v4.0.2
715

816
### [rhel7-s390x](https://ci.nodejs.org/job/citgm-smoker/nodes=rhel7-s390x/2400/)
917

10-
through2-v4.0.2
18+
* through2-v4.0.2
1119

1220
### [fedora-latest-x64](https://ci.nodejs.org/job/citgm-smoker/nodes=fedora-latest-x64/2400/)
1321

14-
coffeescript-v2.5.1
15-
through2-v4.0.2
22+
* coffeescript-v2.5.1
23+
* through2-v4.0.2
1624

1725
### [ubuntu1604-64](https://ci.nodejs.org/job/citgm-smoker/nodes=ubuntu1604-64/2400/)
1826

19-
coffeescript-v2.5.1
20-
through2-v4.0.2
27+
* coffeescript-v2.5.1
28+
* through2-v4.0.2
2129

2230
### [osx1014](https://ci.nodejs.org/job/citgm-smoker/nodes=osx1014/2400/)
2331

24-
acorn-v7.3.1
25-
coffeescript-v2.5.1
26-
clinic-v6.0.2
27-
ember-cli-v3.19.0
28-
semver-v7.3.2
29-
watchify-v3.11.1
32+
* acorn-v7.3.1
33+
* coffeescript-v2.5.1
34+
* clinic-v6.0.2
35+
* ember-cli-v3.19.0
36+
* semver-v7.3.2
37+
* watchify-v3.11.1
3038

3139
### [ubuntu1804-64](https://ci.nodejs.org/job/citgm-smoker/nodes=ubuntu1804-64/2400/)
3240

33-
coffeescript-v2.5.1
34-
through2-v4.0.2
41+
* coffeescript-v2.5.1
42+
* through2-v4.0.2
3543

3644
### [fedora-last-latest-x64](https://ci.nodejs.org/job/citgm-smoker/nodes=fedora-last-latest-x64/2400/)
3745

38-
coffeescript-v2.5.1
39-
through2-v4.0.2
46+
* coffeescript-v2.5.1
47+
* through2-v4.0.2
4048

4149
### [centos7-ppcle](https://ci.nodejs.org/job/citgm-smoker/nodes=centos7-ppcle/2400/)
4250

43-
coffeescript-v2.5.1
44-
clinic-v6.0.2
45-
torrent-stream-v1.2.0
46-
through2-v4.0.2
51+
* coffeescript-v2.5.1
52+
* clinic-v6.0.2
53+
* torrent-stream-v1.2.0
54+
* through2-v4.0.2
4755

0 commit comments

Comments
 (0)