Skip to content

Commit 56f204c

Browse files
committed
Adding QA jobs and expanding test jobs for CI/CD.
1 parent fcb0800 commit 56f204c

8 files changed

Lines changed: 357 additions & 314 deletions

File tree

.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: 134 additions & 35 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,7 +21,7 @@ lint:
1821
npm run lint;
1922
'
2023
21-
test 1/16:
24+
.test 1/16:
2225
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
2326
stage: check
2427
interruptible: true
@@ -29,7 +32,7 @@ test 1/16:
2932
npm run test -- tests/client;
3033
'
3134
32-
test 2/16:
35+
.test 2/16:
3336
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
3437
stage: check
3538
interruptible: true
@@ -40,7 +43,7 @@ test 2/16:
4043
npm run test -- tests/agent;
4144
'
4245
43-
test 3/16:
46+
.test 3/16:
4447
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
4548
stage: check
4649
interruptible: true
@@ -51,7 +54,7 @@ test 3/16:
5154
npm run test -- tests/bin;
5255
'
5356
54-
test 4/16:
57+
.test 4/16:
5558
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
5659
stage: check
5760
interruptible: true
@@ -62,7 +65,7 @@ test 4/16:
6265
npm run test -- tests/bootstrap;
6366
'
6467
65-
test 5/16:
68+
.test 5/16:
6669
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
6770
stage: check
6871
interruptible: true
@@ -73,7 +76,7 @@ test 5/16:
7376
npm run test -- tests/network;
7477
'
7578
76-
test 6/16:
79+
.test 6/16:
7780
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
7881
stage: check
7982
interruptible: true
@@ -84,7 +87,7 @@ test 6/16:
8487
npm run test -- tests/vaults;
8588
'
8689
87-
test 7/16:
90+
.test 7/16:
8891
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
8992
stage: check
9093
interruptible: true
@@ -95,7 +98,7 @@ test 7/16:
9598
npm run test -- tests/workers;
9699
'
97100
98-
test 8/16:
101+
.test 8/16:
99102
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
100103
stage: check
101104
interruptible: true
@@ -106,7 +109,7 @@ test 8/16:
106109
npm run test -- tests/grpc;
107110
'
108111
109-
test 9/16:
112+
.test 9/16:
110113
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
111114
stage: check
112115
interruptible: true
@@ -117,7 +120,7 @@ test 9/16:
117120
npm run test -- tests/http;
118121
'
119122
120-
test 10/16:
123+
.test 10/16:
121124
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
122125
stage: check
123126
interruptible: true
@@ -128,7 +131,7 @@ test 10/16:
128131
npm run test -- tests/GenericIdTypes.test.ts tests/index.test.ts tests/PolykeyAgent.test.ts tests/utils.test.ts;
129132
'
130133
131-
test 11/16:
134+
.test 11/16:
132135
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
133136
stage: check
134137
interruptible: true
@@ -139,7 +142,7 @@ test 11/16:
139142
npm run test -- tests/claims;
140143
'
141144
142-
test 12/16:
145+
.test 12/16:
143146
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
144147
stage: check
145148
interruptible: true
@@ -150,7 +153,7 @@ test 12/16:
150153
npm run test -- tests/gestalts;
151154
'
152155
153-
test 13/16:
156+
.test 13/16:
154157
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
155158
stage: check
156159
interruptible: true
@@ -161,7 +164,7 @@ test 13/16:
161164
npm run test -- tests/nodes;
162165
'
163166
164-
test 14/16:
167+
.test 14/16:
165168
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
166169
stage: check
167170
interruptible: true
@@ -172,7 +175,7 @@ test 14/16:
172175
npm run test -- tests/git;
173176
'
174177
175-
test 15/16:
178+
.test 15/16:
176179
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
177180
stage: check
178181
interruptible: true
@@ -183,7 +186,7 @@ test 15/16:
183186
npm run test -- tests/keys;
184187
'
185188
186-
test 16/16:
189+
.test 16/16:
187190
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
188191
stage: check
189192
interruptible: true
@@ -194,9 +197,9 @@ test 16/16:
194197
npm run test -- tests/acl tests/discovery tests/lockfile tests/notifications tests/session tests/sigchain tests/identities;
195198
'
196199
197-
nix-dry:
200+
.nix-dry:
198201
stage: check
199-
interruptible: true
202+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
200203
script:
201204
- nix-build -v -v --dry-run ./release.nix --attr application
202205
- nix-build -v -v --dry-run ./release.nix --attr docker
@@ -206,31 +209,127 @@ nix-dry:
206209

207210
nix:
208211
stage: build
209-
interruptible: true
212+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
213+
script:
214+
- mkdir -p ./builds
215+
# nix-specific application target
216+
- >
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
210248
script:
211249
- >
212-
nix-build ./release.nix
213-
--max-jobs $(nproc)
214-
--attr application
215-
--attr docker
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
216257
only:
217258
- master
259+
- qa-testing
218260

219-
packages:
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
300+
only:
301+
- qa-testing
302+
- master
303+
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:
220319
stage: release
221-
interruptible: true
320+
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
321+
dependencies:
322+
- nix
222323
script:
223324
- >
224325
nix-shell -I nixpkgs=./pkgs.nix --packages git gitAndTools.gh --run '
225-
builds="$(nix-build \
226-
--max-jobs $(nproc) --cores $(nproc) \
227-
./release.nix \
228-
--attr package.linux.x64.elf \
229-
--attr package.windows.x64.exe \
230-
--attr package.macos.x64.macho)";
231326
commit="$(git rev-parse --short HEAD)";
232327
gh release \
233-
create "$commit" $builds \
328+
create "$commit" \
329+
builds/*.closure.gz \
330+
builds/*-linux-* \
331+
builds/*-win32-* \
332+
builds/*-macos-* \
234333
--title "Build-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
235334
--prerelease \
236335
--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)