Skip to content

Commit 0f1f871

Browse files
committed
Adding QA jobs and expanding test jobs for CI/CD.
1 parent 475266f commit 0f1f871

10 files changed

Lines changed: 379 additions & 37 deletions

File tree

.gitlab-ci.yml

Lines changed: 277 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ variables:
44
stages:
55
- check
66
- build
7+
- quality
78
- release
89

9-
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
10-
1110
lint:
11+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
1212
stage: check
1313
interruptible: true
1414
script:
@@ -18,17 +18,184 @@ lint:
1818
npm run lint;
1919
'
2020
21-
test:
21+
test 1/16:
22+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
2223
stage: check
2324
interruptible: true
2425
script:
2526
- >
2627
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
2728
npm install;
28-
npm run test;
29+
npm run test -- tests/client;
2930
'
3031
32+
test 2/16:
33+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
34+
stage: check
35+
interruptible: true
36+
script:
37+
- >
38+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
39+
npm install;
40+
npm run test -- tests/agent;
41+
'
42+
43+
test 3/16:
44+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
45+
stage: check
46+
interruptible: true
47+
script:
48+
- >
49+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
50+
npm install;
51+
npm run test -- tests/bin;
52+
'
53+
54+
test 4/16:
55+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
56+
stage: check
57+
interruptible: true
58+
script:
59+
- >
60+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
61+
npm install;
62+
npm run test -- tests/bootstrap;
63+
'
64+
65+
test 5/16:
66+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
67+
stage: check
68+
interruptible: true
69+
script:
70+
- >
71+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
72+
npm install;
73+
npm run test -- tests/network;
74+
'
75+
76+
test 6/16:
77+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
78+
stage: check
79+
interruptible: true
80+
script:
81+
- >
82+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
83+
npm install;
84+
npm run test -- tests/vaults;
85+
'
86+
87+
test 7/16:
88+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
89+
stage: check
90+
interruptible: true
91+
script:
92+
- >
93+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
94+
npm install;
95+
npm run test -- tests/workers;
96+
'
97+
98+
test 8/16:
99+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
100+
stage: check
101+
interruptible: true
102+
script:
103+
- >
104+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
105+
npm install;
106+
npm run test -- tests/grpc;
107+
'
108+
109+
test 9/16:
110+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
111+
stage: check
112+
interruptible: true
113+
script:
114+
- >
115+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
116+
npm install;
117+
npm run test -- tests/http;
118+
'
119+
120+
test 10/16:
121+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
122+
stage: check
123+
interruptible: true
124+
script:
125+
- >
126+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
127+
npm install;
128+
npm run test -- tests/GenericIdTypes.test.ts tests/index.test.ts tests/PolykeyAgent.test.ts tests/utils.test.ts;
129+
'
130+
131+
test 11/16:
132+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
133+
stage: check
134+
interruptible: true
135+
script:
136+
- >
137+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
138+
npm install;
139+
npm run test -- tests/claims;
140+
'
141+
142+
test 12/16:
143+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
144+
stage: check
145+
interruptible: true
146+
script:
147+
- >
148+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
149+
npm install;
150+
npm run test -- tests/gestalts;
151+
'
152+
153+
test 13/16:
154+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
155+
stage: check
156+
interruptible: true
157+
script:
158+
- >
159+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
160+
npm install;
161+
npm run test -- tests/nodes;
162+
'
163+
164+
test 14/16:
165+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
166+
stage: check
167+
interruptible: true
168+
script:
169+
- >
170+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
171+
npm install;
172+
npm run test -- tests/git;
173+
'
174+
175+
test 15/16:
176+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
177+
stage: check
178+
interruptible: true
179+
script:
180+
- >
181+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
182+
npm install;
183+
npm run test -- tests/keys;
184+
'
185+
186+
test 16/16:
187+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
188+
stage: check
189+
interruptible: true
190+
script:
191+
- >
192+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
193+
npm install;
194+
npm run test -- tests/acl tests/discovery tests/lockfile tests/notifications tests/session tests/sigchain tests/identities;
195+
'
196+
31197
nix-dry:
198+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
32199
stage: check
33200
interruptible: true
34201
script:
@@ -39,18 +206,120 @@ nix-dry:
39206
- nix-build -v -v --dry-run ./release.nix --attr package.macos.x64.macho
40207

41208
nix:
209+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
42210
stage: build
43211
interruptible: true
44212
script:
45213
- >
46-
nix-build ./release.nix
47-
--max-jobs $(nproc)
48-
--attr application
49-
--attr docker
214+
BUILDOUT=`nix-build ./release.nix\
215+
--attr application\
216+
--attr docker\
217+
--attr package.linux.x64.elf\
218+
--attr package.windows.x64.exe\
219+
--attr package.macos.x64.macho`;
220+
mkdir builds;
221+
cp -r $BUILDOUT builds/;
222+
chmod -R a+rw builds;
50223
only:
51224
- master
225+
artifacts:
226+
paths:
227+
- builds
228+
229+
runs in node:
230+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
231+
stage: quality
232+
only:
233+
- master
234+
interruptible: true
235+
script:
236+
- >
237+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
238+
npm install;
239+
echo password > testPassword;
240+
npm run polykey -- agent start --test -np ./nodePath --password-file ./testPassword;
241+
'
242+
243+
running application build:
244+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
245+
stage: quality
246+
only:
247+
- master
248+
needs:
249+
- job: nix
250+
artifacts: true
251+
interruptible: true
252+
script:
253+
- >
254+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
255+
echo password > testPassword;
256+
node builds/*/lib/node_modules/@matrixai/polykey/dist/bin/polykey.js agent start -np ./nodePath --password-file ./testPassword --test;
257+
'
258+
259+
260+
running docker build:
261+
image: docker:19.03.12
262+
variables:
263+
DOCKER_TLS_CERTDIR: "/certs"
264+
services:
265+
- docker:19.03.12-dind
266+
before_script:
267+
- docker info
268+
stage: quality
269+
only:
270+
- master
271+
needs:
272+
- job: nix
273+
artifacts: true
274+
interruptible: true
275+
script:
276+
- ./scripts/runDocker.sh
277+
278+
running linux build:
279+
stage: quality
280+
only:
281+
- master
282+
tags:
283+
- linux
284+
needs:
285+
- job: nix
286+
artifacts: true
287+
interruptible: true
288+
script:
289+
- "echo password > testPassword"
290+
- "./builds/*linux* agent start -np ./nodePath --password-file ./testPassword --test"
291+
292+
running windows build:
293+
stage: quality
294+
only:
295+
- master
296+
tags:
297+
- windows
298+
needs:
299+
- job: nix
300+
artifacts: true
301+
interruptible: true
302+
script:
303+
- "echo password > testPassword"
304+
- "./builds/*win32* agent start -np ./nodePath --password-file ./testPassword --test"
305+
306+
running macos build:
307+
tags: [ shared-macos-amd64 ]
308+
image: macos-11-xcode-12
309+
stage: quality
310+
only:
311+
- master
312+
needs:
313+
- job: nix
314+
artifacts: true
315+
interruptible: true
316+
script:
317+
- "echo password > testPassword"
318+
- "./builds/*macos* agent start -np ./nodePath --password-file ./testPassword --test"
319+
52320

53321
packages:
322+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
54323
stage: release
55324
interruptible: true
56325
script:

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@
5252
"assets": [
5353
"node_modules/jose/**/*",
5454
"node_modules/utp-native/**/*",
55-
"node_modules/leveldown/**/*"
55+
"node_modules/leveldown/**/*",
56+
"node_modules/fd-lock/**/*",
57+
"dist/**/*.json"
5658
],
5759
"scripts": "dist/workers/polykeyWorker.js"
5860
},
5961
"scripts": {
6062
"build": "tsc -p ./tsconfig.build.json",
61-
"postbuild": "cp -fR src/proto dist",
63+
"postbuild": "cp -fR src/proto dist; cp src/notifications/*.json dist/notifications/; cp src/claims/*.json dist/claims/",
6264
"ts-node": "ts-node -r tsconfig-paths/register",
6365
"test": "jest",
6466
"lint": "eslint '{src,tests}/**/*.{js,ts}'",

scripts/runDocker.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
NAME=`docker load -i builds/*docker* | awk '{ print $3}'`
4+
docker run $NAME

0 commit comments

Comments
 (0)