Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add statistics to citgm output
  • Loading branch information
codebytere committed Jul 9, 2020
commit f883ccc8f73c4a4a4cd40ceb6cdf3f4e147eb674
40 changes: 34 additions & 6 deletions lib/ci/ci_result_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ class CITGMBuild extends TestBuild {
return this.failures;
}

this.results = this.parseResults(resultData.childReports);
this.results = this.parseResults(resultData);

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

parseResults(data) {
const results = { all: {}, failures: {} };
const { childReports, totalCount, skipCount, failCount } = data;
const results = { all: {}, failures: {}, statistics: {} };

data.forEach(platform => {
const passCount = totalCount - failCount - skipCount;
results.statistics['passed'] = passCount;
results.statistics['total'] = totalCount;
results.statistics['skipped'] = skipCount;
results.statistics['failed'] = failCount;

childReports.forEach(platform => {
const cases = flatten(platform.result.suites[0].cases);
const url = platform.child.url;
const nodeName = getNodeName(url);
Expand All @@ -821,6 +828,15 @@ class CITGMBuild extends TestBuild {

displayBuilds() {
const { cli, results } = this;
const { failed, skipped, passed, total } = results.statistics;

cli.separator('Statistics');
console.table({
'Failed': failed,
'Skipped': skipped,
'Passed': passed,
'Total': total
});

cli.separator('Failures');
const output = {};
Expand All @@ -840,20 +856,32 @@ class CITGMBuild extends TestBuild {
const result = {
source: sourceURL,
upstream: jobUrl,
...results.statistics,
...results.failures
};

return JSON.parse(JSON.stringify(result));
}

formatAsMarkdown() {
const { jobUrl, result, results } = this;
const { jobUrl, result, results, id } = this;

let output = `# CITGM Data for [${id}](${jobUrl})\n\n`;

const { failed, skipped, passed, total } = results.statistics;

output += `## Statistics for job [${id}](${jobUrl})\n\n`;
output += '| FAILED | SKIPPED | PASSED | TOTAL |\n';
output += '| -------- | --------- | -------- | ------- |\n';
output += `| ${pad(failed, 8)} | ${pad(skipped, 9)} |`;
output += ` ${pad(passed, 8)} | ${pad(total, 7)} |\n\n`;

if (result === SUCCESS) {
return `Job ${jobUrl} is green.`;
output += `Job [${id}](${jobUrl}) is green.`;
return output;
}

let output = `Failures in job ${jobUrl}\n\n`;
output += `## Failures in job [${id}](${jobUrl})\n\n`;
for (const failure in results.failures) {
const data = results.failures[failure];
output += `### [${failure}](${data.url})\n\n`;
Expand Down
6 changes: 5 additions & 1 deletion test/fixtures/jenkins/citgm/expected.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"source": "https://github.com/nodejs/node/pull/34093/",
"upstream": "https://ci.nodejs.org/job/citgm-smoker/2400/",
"passed": 594,
"total": 848,
"skipped": 233,
"failed": 21,
"debian9-64": {
"url": "https://ci.nodejs.org/job/citgm-smoker/nodes=debian9-64/2400/",
"modules": [
Expand Down Expand Up @@ -125,4 +129,4 @@
}
]
}
}
}
52 changes: 30 additions & 22 deletions test/fixtures/jenkins/citgm/expected.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,55 @@
Failures in job https://ci.nodejs.org/job/citgm-smoker/2400/
# CITGM Data for [2400](https://ci.nodejs.org/job/citgm-smoker/2400/)

## Statistics for job [2400](https://ci.nodejs.org/job/citgm-smoker/2400/)

| FAILED | SKIPPED | PASSED | TOTAL |
| -------- | --------- | -------- | ------- |
| 21 | 233 | 594 | 848 |

## Failures in job [2400](https://ci.nodejs.org/job/citgm-smoker/2400/)

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

coffeescript-v2.5.1
through2-v4.0.2
* coffeescript-v2.5.1
* through2-v4.0.2

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

through2-v4.0.2
* through2-v4.0.2

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

coffeescript-v2.5.1
through2-v4.0.2
* coffeescript-v2.5.1
* through2-v4.0.2

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

coffeescript-v2.5.1
through2-v4.0.2
* coffeescript-v2.5.1
* through2-v4.0.2

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

acorn-v7.3.1
coffeescript-v2.5.1
clinic-v6.0.2
ember-cli-v3.19.0
semver-v7.3.2
watchify-v3.11.1
* acorn-v7.3.1
* coffeescript-v2.5.1
* clinic-v6.0.2
* ember-cli-v3.19.0
* semver-v7.3.2
* watchify-v3.11.1

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

coffeescript-v2.5.1
through2-v4.0.2
* coffeescript-v2.5.1
* through2-v4.0.2

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

coffeescript-v2.5.1
through2-v4.0.2
* coffeescript-v2.5.1
* through2-v4.0.2

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

coffeescript-v2.5.1
clinic-v6.0.2
torrent-stream-v1.2.0
through2-v4.0.2
* coffeescript-v2.5.1
* clinic-v6.0.2
* torrent-stream-v1.2.0
* through2-v4.0.2