Skip to content

Commit 0c65d77

Browse files
authored
BG-18658 Merge pull request #70 from BitGo/BG-19209-node10
BG-18658 Implement CI pipeline for our KRSv2 project.
2 parents 2a498b6 + 3c908f6 commit 0c65d77

File tree

5 files changed

+2118
-641
lines changed

5 files changed

+2118
-641
lines changed

.drone.jsonnet

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
/// High level setup
2+
3+
local pipeline(
4+
name,
5+
kind = "pipeline",
6+
type = "docker",
7+
clone = null,
8+
platform = null,
9+
workspace = null,
10+
services = [],
11+
steps = [],
12+
trigger = null,
13+
node = null,
14+
volumes = [],
15+
depends_on = [],
16+
) = {
17+
kind: kind,
18+
type: type,
19+
name: name,
20+
[if platform != null then 'platform']: platform,
21+
[if workspace != null then 'workspace']: workspace,
22+
[if clone != null then 'clone']: clone,
23+
[if services != [] then 'services']: services,
24+
[if steps != [] then 'steps']: steps,
25+
[if trigger != null then 'trigger']: trigger,
26+
[if node != null then 'node']: node,
27+
[if volumes != [] then 'volumes']: volumes,
28+
[if depends_on != [] then 'depends_on']: depends_on,
29+
};
30+
31+
local step(
32+
name,
33+
image,
34+
settings = null,
35+
depends_on = [],
36+
commands = null,
37+
environment = null,
38+
failure = false,
39+
detach = false,
40+
privileged = false,
41+
volumes = [],
42+
when = null
43+
) = {
44+
name: name,
45+
image: image,
46+
[if failure then 'failure']: failure,
47+
[if detach then 'detach']: detach,
48+
[if privileged then 'privileged']: detach,
49+
[if settings != null then 'settings']: settings,
50+
[if depends_on != [] then 'depends_on']: depends_on,
51+
[if commands != [] then 'commands']: commands,
52+
[if environment != null then 'environment']: environment,
53+
[if volumes != [] then 'volumes']: volumes,
54+
[if when != null then 'when']: when,
55+
};
56+
57+
[
58+
pipeline(
59+
kind = "pipeline",
60+
name = "checks (node:10)",
61+
steps = [
62+
step(
63+
name = "build information",
64+
image = "node:10",
65+
commands = [
66+
"node --version",
67+
"npm --version",
68+
"git --version",
69+
],
70+
),
71+
step(
72+
name = "install",
73+
image = "node:10",
74+
commands = [
75+
"npm install",
76+
],
77+
),
78+
/// step(
79+
/// name = "lint",
80+
/// image = "node:10",
81+
/// failure = true,
82+
/// commands = [
83+
/// "npm run lint",
84+
/// ],
85+
/// ),
86+
],
87+
),
88+
pipeline(
89+
kind = "pipeline",
90+
name = "unit tests (node:10)",
91+
steps = [
92+
step(
93+
name = "build information",
94+
image = "node:10",
95+
commands = [
96+
"node --version",
97+
"npm --version",
98+
"git --version",
99+
],
100+
),
101+
step(
102+
name = "install",
103+
image = "node:10",
104+
commands = [
105+
"npm install",
106+
],
107+
),
108+
step(
109+
name = "unit-test",
110+
image = "node:10",
111+
depends_on = [
112+
"install",
113+
],
114+
commands = [
115+
"npm run test",
116+
],
117+
environment = {
118+
MONGO_URI: "mongodb://mongo:27017/key-recovery-service-test",
119+
},
120+
),
121+
step(
122+
name = "audit",
123+
image = "node:10",
124+
/// failure = true,
125+
commands = [
126+
"npm run audit",
127+
],
128+
),
129+
],
130+
trigger = {
131+
branch: {
132+
exclude: [
133+
"prod/production",
134+
],
135+
},
136+
},
137+
services = [
138+
{
139+
name: "mongo",
140+
image: "mongo:3.4",
141+
},
142+
],
143+
),
144+
pipeline(
145+
kind = "pipeline",
146+
name = "unit tests (node:12)",
147+
steps = [
148+
step(
149+
name = "build information",
150+
image = "node:12",
151+
commands = [
152+
"node --version",
153+
"npm --version",
154+
"git --version",
155+
],
156+
),
157+
step(
158+
name = "install",
159+
image = "node:12",
160+
commands = [
161+
"npm install",
162+
],
163+
),
164+
step(
165+
name = "unit-test",
166+
image = "node:12",
167+
depends_on = [
168+
"install",
169+
],
170+
commands = [
171+
"npm run test",
172+
],
173+
environment = {
174+
MONGO_URI: "mongodb://mongo:27017/key-recovery-service-test",
175+
},
176+
),
177+
step(
178+
name = "audit",
179+
image = "node:12",
180+
/// failure = true,
181+
commands = [
182+
"npm run audit",
183+
],
184+
),
185+
],
186+
trigger = {
187+
branch: {
188+
exclude: [
189+
"prod/production",
190+
],
191+
},
192+
},
193+
services = [
194+
{
195+
name: "mongo",
196+
image: "mongo:3.4",
197+
},
198+
],
199+
),
200+
]

.eslintrc.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es6": true,
5+
"node": true,
6+
"mocha": true
7+
},
8+
"globals": {
9+
"app": true, // BitGo side-effect from testutil
10+
"ethUtil": true, // BitGo side-effect from testutil
11+
"requireCommon": true
12+
},
13+
"extends": "eslint:recommended",
14+
"parserOptions": {
15+
"ecmaVersion": 6
16+
},
17+
"rules": {
18+
"operator-linebreak": ["error", "before"],
19+
"max-len": ["error", { "code": 256 } ],
20+
"indent": ["error", 2, {"SwitchCase": 1, "MemberExpression": "off"}],
21+
"linebreak-style": ["error", "unix"],
22+
"semi": ["error", "always"],
23+
"eqeqeq": ["error", "always"],
24+
"curly": "error",
25+
"no-extra-boolean-cast": "off",
26+
"no-unused-vars": ["error", {"vars": "all", "args": "none"}],
27+
"object-curly-spacing": ["error", "always", {"objectsInObjects": true, "arraysInObjects": true}],
28+
"array-bracket-spacing": ["error", "never"],
29+
"require-yield": "off",
30+
"func-call-spacing": ["error", "never"],
31+
"quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
32+
"key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "strict" }],
33+
"quote-props": ["error", "as-needed"],
34+
"no-console": "off",
35+
"no-empty": ["error", { "allowEmptyCatch": false }],
36+
"no-inner-declarations": "off",
37+
"no-useless-escape": "off",
38+
"func-names": "off",
39+
"generator-star-spacing": ["error", {"before": true, "after": false}],
40+
"yield-star-spacing": ["error", {"before": true, "after": false}],
41+
"no-duplicate-imports": "error", // whilst imports are not being used, if we start to use them, we do not want duplicates
42+
"no-unreachable": "error",
43+
"no-path-concat": "off",
44+
"no-process-env": "off",
45+
"no-process-exit": "off",
46+
"no-sync": "warn",
47+
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
48+
"eol-last": "error",
49+
"no-trailing-spaces": ["error", { "skipBlankLines": true, "ignoreComments": true }],
50+
"no-unneeded-ternary": "error",
51+
"switch-colon-spacing": ["error", {"before": false, "after": true}],
52+
"arrow-spacing": ["error", { "before": true, "after": true }],
53+
"no-dupe-args": "error",
54+
"no-undef": "error",
55+
"no-var": "error",
56+
"prefer-const": "error",
57+
"no-compare-neg-zero": "error",
58+
"no-extra-semi": "error",
59+
"radix": "error",
60+
"comma-spacing": ["error", { "before": false, "after": true }],
61+
"comma-dangle": ["error", "never"],
62+
"no-multi-spaces": ["error", {"ignoreEOLComments": true}],
63+
"keyword-spacing": ["error"],
64+
"space-before-blocks": ["error"],
65+
"space-infix-ops": ["error"],
66+
"spaced-comment": ["error", "always"],
67+
"no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1 }]
68+
}
69+
}

0 commit comments

Comments
 (0)