forked from BitGo/BitGoJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.jsonnet
139 lines (131 loc) · 2.99 KB
/
.drone.jsonnet
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
local branches() = {
branch: [
"master",
"rel/*",
"prod/production",
],
};
local BuildInfo(version, limit_branches=false) = {
name: "build information",
image: "node:" + version,
commands: [
"node --version",
"npm --version",
],
[if limit_branches then "when"]: branches(),
};
local Install(version, limit_branches=false) = {
name: "install",
image: "node:" + version,
commands: [
"npm install --unsafe-perm",
],
[if limit_branches then "when"]: branches(),
};
local UploadCoverage(version, tag="untagged", limit_branches=true) = {
name: "upload coverage",
image: "node:" + version,
environment: {
CODECOV_TOKEN: { from_secret: "codecov" },
},
commands: [
"npm install -g codecov",
"node_modules/.bin/nyc report --reporter=text-lcov > coverage.lcov",
"codecov -f coverage.lcov -t \"$CODECOV_TOKEN\" -F " + tag,
],
[if limit_branches then "when"]: branches(),
};
local UnitTest(version) = {
kind: "pipeline",
name: "unit tests (node:" + version + ")",
steps: [
BuildInfo(version),
Install(version),
{
name: "unit tests",
image: "node:" + version,
environment: {
BITGOJS_TEST_PASSWORD: { from_secret: "password" },
},
commands: [
"npm run test-node",
],
},
UploadCoverage(version, "unit"),
],
};
local IntegrationTest(version, limit_branches=true) = {
kind: "pipeline",
name: "integration tests (node:" + version + ")",
steps: [
BuildInfo(version, limit_branches),
Install(version, limit_branches),
{
name: "integration tests",
image: "node:" + version,
environment: {
BITGOJS_TEST_PASSWORD: { from_secret: "password" },
},
commands: [
"npx nyc -- node_modules/.bin/mocha -r ts-node/register --timeout 20000 --reporter list --exit 'test/v2/integration/**/*.ts'",
],
[if limit_branches then "when"]: branches(),
},
UploadCoverage(version, "integration", limit_branches),
],
};
local MeasureSizeAndTiming(version, limit_branches=false) = {
kind: "pipeline",
name: "size and timing (node:" + version + ")",
steps: [
{
name: "slow-deps",
image: "node:" + version,
commands: [
"npm install -g slow-deps",
"slow-deps"
],
[if limit_branches then "when"]: branches(),
},
],
};
[
{
kind: "pipeline",
name: "audit",
steps: [
BuildInfo("lts"),
Install("lts"),
{
name: "audit",
image: "node:lts",
commands: [
"npm audit",
],
},
],
},
{
kind: "pipeline",
name: "lint",
steps: [
BuildInfo("lts"),
Install("lts"),
{
name: "lint",
image: "node:lts",
commands: [
"npx eslint 'src/**/*.ts'",
"npx eslint 'test/**/*.ts' || true"
],
},
],
},
UnitTest("6"),
UnitTest("8"),
UnitTest("9"),
UnitTest("10"),
UnitTest("11"),
IntegrationTest("10"),
MeasureSizeAndTiming("lts"),
]