-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy path.ci.yml
More file actions
486 lines (434 loc) · 12.8 KB
/
Copy path.ci.yml
File metadata and controls
486 lines (434 loc) · 12.8 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
image: $CI_REGISTRY_IMAGE:rdfm-ci-base-trixie
.common_only: &common_only
only:
- main
- merge_requests
variables:
SSL_CERT_DIR: "certs"
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip
GOROOT: ""
SCALENODE_CPU: 2
SCALENODE_RAM: 2048
SCALENODE_DISK: 20
SCALENODE_KERNEL: legacy
.build-base:
variables:
JWT_SECRET: testsecret123123123
before_script:
- python -V
- (cd server && poetry build && poetry install)
- (cd manager && poetry build && poetry install)
- server/tests/certgen.sh certs IP.1:127.0.0.1 DEVICE no
.build:
<<: *common_only
extends: .build-base
.mypy-check-base:
variables:
TARGET: "" # fill this when extending
ARGS: "" # additional arguments for mypy, can be left empty
stage: static-checks
before_script:
- (cd tools/rdfm-lint-scripts && pipx install .)
script:
- cd $TARGET && poetry install
- rdfm-lint-mypy $ARGS
allow_failure: true
stages:
- docs-build
- docs-deploy
- build
- static-checks
- local-tests
python-pycodestyle-check:
stage: static-checks
before_script:
- (cd tools/rdfm-lint-scripts && pipx install .)
script:
- (cd server && rdfm-lint-pycodestyle)
- (cd manager && rdfm-lint-pycodestyle)
- (cd common/communication && rdfm-lint-pycodestyle)
- (cd tools/rdfm-plotter && rdfm-lint-pycodestyle --exclude log_pb2.py)
python-mypy-check-manager:
extends: .mypy-check-base
variables:
TARGET: manager
python-mypy-check-server:
extends: .mypy-check-base
variables:
TARGET: server
ARGS: "--config-file ./mypy.ini"
python-mypy-check-common-communication:
extends: .mypy-check-base
variables:
TARGET: common/communication
python-mypy-check-plotter:
extends: .mypy-check-base
variables:
TARGET: tools/rdfm-plotter
test-alembic-migration-validity:
extends: .build
stage: local-tests
<<: *common_only
script:
- (cd server && poetry run pytest tests/test-alembic-migrations.py -v)
test-package-api:
extends: .build
stage: local-tests
script:
- cd server
- poetry run pytest tests/test-packages.py
test-group-api:
extends: .build
stage: local-tests
script:
- cd server
- poetry run pytest tests/test-groups.py
test-server-update-policies:
extends: .build
stage: local-tests
script:
- cd server
- poetry run pytest tests/test-update-policies.py --sqlite
- poetry run pytest tests/test-update-policies.py --postgres
test-server-update-resolver:
extends: .build
stage: local-tests
script:
- cd server
- poetry run pytest tests/test-update-resolver.py
test-server-update-api:
extends: .build
stage: local-tests
script:
- cd server
- poetry run pytest tests/test-update-checker.py --sqlite
- poetry run pytest tests/test-update-checker.py --postgres
test-server-device-auth-api:
extends: .build
stage: local-tests
variables:
SCALENODE_RAM: 4096
script:
- cd server
- poetry run pytest tests/test-server-auth.py --sqlite
- poetry run pytest tests/test-server-auth.py --postgres
test-server-s3-storage:
extends: .build
stage: local-tests
script:
- cd server
- poetry run pytest tests/test-server-s3-storage.py
test-server-management-auth:
extends: .build
stage: local-tests
variables:
SCALENODE_RAM: 4096
script:
- cd server
- poetry run pytest tests/test-server-management-auth.py --sqlite
- poetry run pytest tests/test-server-management-auth.py --postgres
test-package-upload-auth:
extends: .build
stage: local-tests
variables:
SCALENODE_RAM: 4096
script:
- cd server
- poetry run pytest tests/test-package-upload-auth.py --sqlite
- poetry run pytest tests/test-package-upload-auth.py --postgres
test-server-route-correctness:
extends: .build
stage: local-tests
script:
- cd server
- poetry run pytest tests/test-server-route-correctness.py
test-server-websocket:
extends: .build
stage: local-tests
script:
- cd server
- poetry run pytest tests/test-server-ws.py --sqlite
- poetry run pytest tests/test-server-ws.py --postgres
test-manager:
extends: .build
stage: local-tests
variables:
SCALENODE_RAM: 4096
script:
- cd server
- poetry run pytest tests/test-manager.py --sqlite
- poetry run pytest tests/test-manager.py --postgres
test-server-stress:
extends: .build
stage: local-tests
variables:
SCALENODE_CPU: 4
SCALENODE_RAM: 16384
script:
- cd server
- poetry run pytest tests/test-stress.py -vs
artifacts:
paths:
- server/tests/logs/*
when: always
only:
- schedules
test-server-logs:
extends: .build
stage: local-tests
script:
- cd server
- poetry run pytest tests/test-server-logs.py --sqlite
- poetry run pytest tests/test-server-logs.py --postgres
test-server-file-download:
extends: .build
stage: local-tests
script:
- cd server
- poetry run pytest tests/test-file-download.py --sqlite
- poetry run pytest tests/test-file-download.py --postgres
test-actions:
extends: .build
stage: local-tests
script:
- cd server
- poetry run pytest tests/test-actions.py --sqlite
- poetry run pytest tests/test-actions.py --postgres
test-server-side-events:
extends: .build
stage: local-tests
script:
- cd server
- poetry run pytest tests/test-server-side-events.py --sqlite
- poetry run pytest tests/test-server-side-events.py --postgres
artifacts:
paths:
- server/tests/server_gunicorn.log
- server/tests/server_redis.log
when: always
test-server-pubsub-acl-handling:
extends: .build
stage: local-tests
script:
- cd server
- poetry run pytest tests/test-pubsub-acl-handling.py
test-server-pubsub-acl-side-effects:
extends: .build
stage: local-tests
<<: *common_only
script:
- cd server/
- SIF_SECRET=$(apptainer inspect --environment deploy/pubsub-demo/tests/test_kafka.sif | rg '^\s+export RDFM_JWT_SECRET=([\w\W]+)$' -r '$1')
- export JWT_SECRET=$SIF_SECRET
- poetry run pytest -v tests/test-pubsub-acl-side-effects.py --sifpath $(pwd)/deploy/pubsub-demo/tests --sqlite
artifacts:
paths:
- server/tests/server.log
when: always
# ===== rdfm-client ===== #
build-rdfm-client:
stage: build
extends: .build
script:
- cd devices/linux-client
- make
build-rdfm-logging-tool:
stage: build
script:
- cd tools/loggers
- make
test-rdfm-client:
stage: local-tests
<<: *common_only
dependencies:
- build-rdfm-artifact
script:
# Install rdfm-artifact, which is required for the tests
- mv tools/rdfm-artifact/rdfm-artifact /usr/bin/
- cd devices/linux-client
- make generate
- make test
test-rdfm-client-docker:
stage: local-tests
<<: *common_only
dependencies:
- build-rdfm-artifact
script:
# Install rdfm-artifact, which is required for the tests
- mv tools/rdfm-artifact/rdfm-artifact /usr/bin/
# The tests are running in a Docker container, install and set up
# the Docker daemon
- cd devices/linux-client
- apt update
- apt -qq -y --no-install-recommends install docker-cli docker.io crun fuse-overlayfs pigz ca-certificates
- mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
- pushd /sys/fs/cgroup
- mkdir {cpu,cpuset,blkio,devices,memory,pids}
- for name in cpu cpuset blkio devices memory pids; do mount -n -t cgroup -o $name cgroup $name; done
- popd
- ../../common/docker/start-docker.sh
# HACK: For CI runs, we have to replace the -it flag in docker run
# as this is not a real terminal.
# HACK: We also comment out git invocations, as only a subfolder is mounted
# in the container, which would cause that call to fail. This is fine,
# as the invocation is only required when container UID != source UID
# (i.e, not in CI runs, where we run everything as root).
- sed -i "s/\-it//g" ./scripts/test-docker/test-artifact-info.sh
- sed -i "s/git/#git/g" ./scripts/test-docker/data/check-artifact-info.sh
- sed -i "s/\-it//g" ./scripts/test-docker/test-deltas.sh
- sed -i "s/git/#git/g" ./scripts/test-docker/data/check-delta-patching.sh
- sed -i "s/\-it//g" ./scripts/test-docker/test-delta-over-http.sh
# Run rdfm-client Docker tests
- ./scripts/test-docker/test-artifact-info.sh
- cd scripts/test-docker/
- ./make-delta-samples.sh
- cd ../../
- ./scripts/test-docker/test-deltas.sh
- ./scripts/test-docker/test-delta-over-http.sh
# ===== rdfm-mcumgr-client ===== #
build-mcumgr-client:
stage: build
script:
- make -C devices/mcumgr-client
artifacts:
expire_in: 1 day
paths:
- devices/mcumgr-client/rdfm-mcumgr-client
build-mcumgr-test-samples:
variables:
SCALENODE_CPU: 4
SCALENODE_RAM: 8192
ZEPHYR_WORKSPACE: $CI_PROJECT_DIR/zephyr
ZEPHYR_BASE: $CI_PROJECT_DIR/zephyr/zephyr
ZEPHYR_SDK_INSTALL_DIR: $CI_PROJECT_DIR/zephyr/sdk
<<: *common_only
stage: build
before_script:
- apt update
- apt -qqy --no-install-recommends install cmake device-tree-compiler ninja-build
script:
- python3 -m venv venv
- source venv/bin/activate
- ./devices/mcumgr-client/tests/build/build_samples.sh
- ls -la ./devices/mcumgr-client/tests/out/
artifacts:
expire_in: 1 day
paths:
- devices/mcumgr-client/tests/out
test-mcumgr-client:
# NOTE: Prebuilt renode version used in this job won't resolve dependencies on debian:trixie.
# Bumping this should be done in a separate issue.
image: debian:bookworm
variables:
SCALENODE_CPU: 4
SCALENODE_RAM: 6144
SCALENODE_DISK: 10
<<: *common_only
dependencies:
- build-mcumgr-client
- build-mcumgr-test-samples
- build-rdfm-artifact
stage: local-tests
before_get_sources:
- apt update && apt -qqy --no-install-recommends install build-essential ca-certificates curl git-lfs iproute2 libpq-dev python3-venv python3-dev >/dev/null
script:
- set -eo pipefail
# NOTE: Currently Renode is tracked using LFS since we're using a custom
# build with support for both STM32F764 and NRF52840 flash controllers.
# If they get added into main, this can be replaced with official release
# `wget --quiet https://builds.renode.io/renode_1.X.Y_amd64.deb`
- git lfs pull && apt -qqy --no-install-recommends install ./devices/mcumgr-client/tests/prebuilt/renode*.deb >/dev/null
- mv tools/rdfm-artifact/rdfm-artifact /usr/bin/
- mv devices/mcumgr-client/rdfm-mcumgr-client /usr/bin/
- python3 -m venv venv
- source venv/bin/activate
- pip3 install -e ./common/communication
- pip3 install -e ./server
- pip3 install -e ./manager
- cd devices/mcumgr-client
# Run the test
- ./tests/end2end/test.sh
# ===== rdfm-artifact ===== #
build-rdfm-artifact:
stage: build
script:
- cd tools/rdfm-artifact
- make
artifacts:
paths:
- tools/rdfm-artifact/rdfm-artifact
test-rdfm-artifact:
<<: *common_only
stage: local-tests
script:
- cd tools/rdfm-artifact
- make test
# ===== rdfm-jwt-auth ===== #
build-rdfm-jwt-auth:
stage: build
script:
- (cd server/deploy/pubsub-demo/rdfm-jwt-auth && mvn package)
- cp server/deploy/pubsub-demo/rdfm-jwt-auth/target/rdfm-jwt-auth-*.jar server/deploy/pubsub-demo/tests
- cd server/deploy/pubsub-demo/tests
- mkdir tmp
- APPTAINER_TMPDIR=$(pwd)/tmp apptainer -v build test_kafka.sif test_kafka.def
artifacts:
expire_in: 1 day
paths:
- server/deploy/pubsub-demo/rdfm-jwt-auth/target/rdfm-jwt-auth-*.jar
- server/deploy/pubsub-demo/tests/test_kafka.sif
# ===== rdfm-plotter ===== #
test-rdfm-plotter:
<<: *common_only
stage: local-tests
dependencies:
- build-rdfm-jwt-auth
script:
- SIFPATH=$(pwd)/server/deploy/pubsub-demo/tests
- cd tools/rdfm-plotter
- poetry install
- poetry run pytest tests/test-plotter.py -s -v --testpath $SIFPATH
- poetry run pytest tests/test-rdfm-jwt-auth.py -s -v --testpath $SIFPATH
# ===== rdfm-frontend ===== #
build-rdfm-frontend:
image: node:20
stage: static-checks
<<: *common_only
script:
- cd frontend
- npm install
- npm run format-check
- npm run build
artifacts:
paths:
- frontend/dist
# ===== documentation ===== #
docs-build:
stage: docs-build
<<: *common_only
image: $CI_REGISTRY_IMAGE:rdfm-ci-documentation-trixie
before_script:
- cd documentation/
- poetry install
script:
- cd documentation/
- poetry run make html latexpdf
- cp build/latex/*.pdf build/html/
# Make sure the docs archive lands in the root of the repository
- tar cf ../$CI_DOCS_ARCHIVE -C build/html/ .
artifacts:
paths:
- documentation/build
- $CI_DOCS_ARCHIVE
docs-deploy:
variables:
GIT_STRATEGY: none
<<: *common_only
dependencies:
- docs-build
stage: docs-deploy
tags: ["docs"]
script: echo 'Deploying docs'
artifacts:
paths:
- $CI_DOCS_ARCHIVE