-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
dangerfile.js
35 lines (32 loc) · 1.1 KB
/
dangerfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* global danger, fail, warn, message */
// requires
const junit = require('@seadub/danger-plugin-junit').default;
const dependencies = require('@seadub/danger-plugin-dependencies').default;
const moduleLint = require('@seadub/danger-plugin-titanium-module').default;
const ENV = process.env;
// Add links to artifacts we've stuffed into the ENV.ARTIFACTS variable
async function linkToArtifacts() {
if (ENV.ARTIFACTS) {
const artifacts = ENV.ARTIFACTS.split(';');
if (artifacts.length !== 0) {
const artifactsListing = '- ' + artifacts.map(a => danger.utils.href(`${ENV.BUILD_URL}artifact/${a}`, a)).join('\n- ');
message(`:floppy_disk: Here are the artifacts produced:\n${artifactsListing}`);
}
}
}
async function main() {
// do a bunch of things in parallel
// Specifically, anything that collects what labels to add or remove has to be done first before...
await Promise.all([
junit({ pathToReport: './TESTS-*.xml' }),
dependencies({ type: 'npm' }),
linkToArtifacts(),
moduleLint(),
]);
}
main()
.then(() => process.exit(0))
.catch(err => {
fail(err.toString());
process.exit(1);
});