Skip to content

Commit 84e4909

Browse files
committed
Adding QA jobs and expanding test jobs for CI/CD.
1 parent 6ecb478 commit 84e4909

File tree

8 files changed

+508
-299
lines changed

8 files changed

+508
-299
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.env*
44
!.env.example
55
/result*
6+
/builds
67

78
# Logs
89
logs

.gitlab-ci.yml

Lines changed: 285 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1+
default:
2+
interruptible: true
3+
14
variables:
25
GIT_SUBMODULE_STRATEGY: recursive
36

47
stages:
58
- check
69
- build
10+
- quality
711
- release
812

9-
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
10-
11-
lint:
13+
.lint:
14+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
1215
stage: check
1316
interruptible: true
1417
script:
@@ -18,19 +21,185 @@ lint:
1821
npm run lint;
1922
'
2023
21-
test:
24+
.test 1/16:
25+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
2226
stage: check
2327
interruptible: true
2428
script:
2529
- >
2630
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
2731
npm install;
28-
npm run test;
32+
npm run test -- tests/client;
2933
'
3034
31-
nix-dry:
35+
.test 2/16:
36+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
37+
stage: check
38+
interruptible: true
39+
script:
40+
- >
41+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
42+
npm install;
43+
npm run test -- tests/agent;
44+
'
45+
46+
.test 3/16:
47+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
48+
stage: check
49+
interruptible: true
50+
script:
51+
- >
52+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
53+
npm install;
54+
npm run test -- tests/bin;
55+
'
56+
57+
.test 4/16:
58+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
59+
stage: check
60+
interruptible: true
61+
script:
62+
- >
63+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
64+
npm install;
65+
npm run test -- tests/bootstrap;
66+
'
67+
68+
.test 5/16:
69+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
70+
stage: check
71+
interruptible: true
72+
script:
73+
- >
74+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
75+
npm install;
76+
npm run test -- tests/network;
77+
'
78+
79+
.test 6/16:
80+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
81+
stage: check
82+
interruptible: true
83+
script:
84+
- >
85+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
86+
npm install;
87+
npm run test -- tests/vaults;
88+
'
89+
90+
.test 7/16:
91+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
92+
stage: check
93+
interruptible: true
94+
script:
95+
- >
96+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
97+
npm install;
98+
npm run test -- tests/workers;
99+
'
100+
101+
.test 8/16:
102+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
103+
stage: check
104+
interruptible: true
105+
script:
106+
- >
107+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
108+
npm install;
109+
npm run test -- tests/grpc;
110+
'
111+
112+
.test 9/16:
113+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
32114
stage: check
33115
interruptible: true
116+
script:
117+
- >
118+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
119+
npm install;
120+
npm run test -- tests/http;
121+
'
122+
123+
.test 10/16:
124+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
125+
stage: check
126+
interruptible: true
127+
script:
128+
- >
129+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
130+
npm install;
131+
npm run test -- tests/GenericIdTypes.test.ts tests/index.test.ts tests/PolykeyAgent.test.ts tests/utils.test.ts;
132+
'
133+
134+
.test 11/16:
135+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
136+
stage: check
137+
interruptible: true
138+
script:
139+
- >
140+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
141+
npm install;
142+
npm run test -- tests/claims;
143+
'
144+
145+
.test 12/16:
146+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
147+
stage: check
148+
interruptible: true
149+
script:
150+
- >
151+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
152+
npm install;
153+
npm run test -- tests/gestalts;
154+
'
155+
156+
.test 13/16:
157+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
158+
stage: check
159+
interruptible: true
160+
script:
161+
- >
162+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
163+
npm install;
164+
npm run test -- tests/nodes;
165+
'
166+
167+
.test 14/16:
168+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
169+
stage: check
170+
interruptible: true
171+
script:
172+
- >
173+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
174+
npm install;
175+
npm run test -- tests/git;
176+
'
177+
178+
.test 15/16:
179+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
180+
stage: check
181+
interruptible: true
182+
script:
183+
- >
184+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
185+
npm install;
186+
npm run test -- tests/keys;
187+
'
188+
189+
.test 16/16:
190+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
191+
stage: check
192+
interruptible: true
193+
script:
194+
- >
195+
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
196+
npm install;
197+
npm run test -- tests/acl tests/discovery tests/lockfile tests/notifications tests/session tests/sigchain tests/identities;
198+
'
199+
200+
.nix-dry:
201+
stage: check
202+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
34203
script:
35204
- nix-build -v -v --dry-run ./release.nix --attr application
36205
- nix-build -v -v --dry-run ./release.nix --attr docker
@@ -40,31 +209,127 @@ nix-dry:
40209

41210
nix:
42211
stage: build
43-
interruptible: true
212+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
44213
script:
214+
- mkdir -p ./builds
215+
# nix-specific application target
45216
- >
46-
nix-build ./release.nix
47-
--max-jobs $(nproc)
48-
--attr application
49-
--attr docker
217+
build_application="$(nix-build \
218+
--max-jobs "$(nproc)" --cores "$(nproc)" \
219+
./release.nix \
220+
--attr application \
221+
)"
222+
- >
223+
nix-store --export $( \
224+
nix-store --query --requisites "$build_application" \
225+
) | gzip > ./builds/js-polykey.closure.gz
226+
# non-nix targets
227+
- >
228+
builds="$(nix-build \
229+
--max-jobs "$(nproc)" --cores "$(nproc)" \
230+
./release.nix \
231+
--attr docker \
232+
--attr package.linux.x64.elf \
233+
--attr package.windows.x64.exe \
234+
--attr package.macos.x64.macho)"
235+
- cp -r $builds ./builds/
236+
only:
237+
- qa-testing
238+
- master
239+
artifacts:
240+
paths:
241+
- ./builds/
242+
243+
application run:
244+
stage: quality
245+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
246+
dependencies:
247+
- nix
248+
script:
249+
- >
250+
build_application="$( \
251+
gunzip -c ./builds/js-polykey.closure.gz | \
252+
nix-store --import | \
253+
tail -1 \
254+
)"
255+
- echo password > testPassword
256+
- $build_application/bin/polykey agent start -np ./nodePath --password-file ./testPassword --test
257+
only:
258+
- master
259+
- qa-testing
260+
261+
docker run:
262+
stage: quality
263+
image: docker:20.10.11
264+
dependencies:
265+
- nix
266+
services:
267+
- docker:20.10.11-dind
268+
variables:
269+
DOCKER_TLS_CERTDIR: "/certs"
270+
before_script:
271+
- docker info
272+
script:
273+
- image="$(docker load --input ./builds/*docker* | cut -d' ' -f3)"
274+
- docker run "$image"
275+
only:
276+
- qa-testing
277+
- master
278+
279+
linux run:
280+
stage: quality
281+
image: ubuntu:latest
282+
dependencies:
283+
- nix
284+
script:
285+
- echo password > testPassword
286+
- for f in ./builds/*-linux-*; do "$f" agent start -np ./nodePath --password-file ./testPassword --test; done
287+
only:
288+
- qa-testing
289+
- master
290+
291+
windows run:
292+
stage: quality
293+
dependencies:
294+
- nix
295+
script:
296+
- echo password > testPassword
297+
- Get-ChildItem -File ./builds/*-win32-* | ForEach {& $_.FullName agent start -np ./nodePath --password-file ./testPassword --test}
298+
tags:
299+
- windows
50300
only:
301+
- qa-testing
51302
- master
52303

53-
packages:
304+
macos run:
305+
stage: quality
306+
image: macos-11-xcode-12
307+
dependencies:
308+
- nix
309+
script:
310+
- echo password > testPassword
311+
- for f in ./builds/*-macos-*; do "$f" agent start -np ./nodePath --password-file ./testPassword --test; done
312+
only:
313+
- qa-testing
314+
- master
315+
tags:
316+
- shared-macos-amd64
317+
318+
.packages:
54319
stage: release
55-
interruptible: true
320+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
321+
dependencies:
322+
- nix
56323
script:
57324
- >
58325
nix-shell -I nixpkgs=./pkgs.nix --packages git gitAndTools.gh --run '
59-
builds="$(nix-build \
60-
--max-jobs $(nproc) --cores $(nproc) \
61-
./release.nix \
62-
--attr package.linux.x64.elf \
63-
--attr package.windows.x64.exe \
64-
--attr package.macos.x64.macho)";
65326
commit="$(git rev-parse --short HEAD)";
66327
gh release \
67-
create "$commit" $builds \
328+
create "$commit" \
329+
builds/*.closure.gz \
330+
builds/*-linux-* \
331+
builds/*-win32-* \
332+
builds/*-macos-* \
68333
--title "Build-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
69334
--prerelease \
70335
--notes "" \

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
/tmp
1414
/docs
1515
/benches
16+
/builds

default.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ let
1212
}
1313
''
1414
mkdir -p $out/lib/node_modules/${utils.node2nixDev.packageName}
15-
# copy only the dist
15+
# copy the package.json
16+
cp ${utils.node2nixDev}/lib/node_modules/${utils.node2nixDev.packageName}/package.json $out/lib/node_modules/${utils.node2nixDev.packageName}/
17+
# copy the dist
1618
cp -r ${utils.node2nixDev}/lib/node_modules/${utils.node2nixDev.packageName}/dist $out/lib/node_modules/${utils.node2nixDev.packageName}/
1719
# copy over the production dependencies
1820
if [ -d "${utils.node2nixProd}/lib/node_modules" ]; then

0 commit comments

Comments
 (0)