-
Notifications
You must be signed in to change notification settings - Fork 38
/
.gitlab-ci.yml
554 lines (517 loc) · 16.7 KB
/
.gitlab-ci.yml
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
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "" # Instructs Docker not to start over TLS, needed for DinD
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
TRACY_NO_INVARIANT_CHECK: 1
stages:
- deps
- test
- analysis
- staging
- package
- deploy
cache:
paths:
- ccache/
#
# ┏━╸╻ ╻╺┳╸┏━╸┏┓╻┏━┓╻┏━┓┏┓╻┏━┓
# ┣╸ ┏╋┛ ┃ ┣╸ ┃┗┫┗━┓┃┃ ┃┃┗┫┗━┓
# ┗━╸╹ ╹ ╹ ┗━╸╹ ╹┗━┛╹┗━┛╹ ╹┗━┛
#
.amd64:
variables:
ARCH: amd64
tags:
- amd64
- privileged
.arm64:
variables:
ARCH: arm64
tags:
- arm64
- privileged
.ubuntu-22.04:
variables:
UBUNTU_VERSION: 22.04
.ubuntu-24.04:
variables:
UBUNTU_VERSION: 24.04
.ubuntu-deps:
before_script:
# CCache stuff
- mkdir -p ccache
- export CCACHE_BASEDIR=${PWD}
- export CCACHE_DIR=${PWD}/ccache
- export PATH="/usr/lib/ccache:${PATH}"
#
# ╺┳┓┏━╸┏━┓┏━╸┏┓╻╺┳┓┏━╸┏┓╻┏━╸╻┏━╸┏━┓
# ┃┃┣╸ ┣━┛┣╸ ┃┗┫ ┃┃┣╸ ┃┗┫┃ ┃┣╸ ┗━┓
# ╺┻┛┗━╸╹ ┗━╸╹ ╹╺┻┛┗━╸╹ ╹┗━╸╹┗━╸┗━┛
#
.deps:container:
stage: deps
image: docker:24.0.5
services:
- docker:24.0.5-dind
timeout: 12h
variables:
IMAGE_NAME: ${CI_REGISTRY_IMAGE}:ubuntu-${UBUNTU_VERSION}-${ARCH}
before_script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} $CI_REGISTRY
script:
- docker buildx build -f tools/docker/dockerfile-ubuntu-${UBUNTU_VERSION} -t ${IMAGE_NAME} --push .
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- tools/docker/**/*
deps:container:22.04:amd64:
extends:
- .amd64
- .ubuntu-22.04
- .deps:container
deps:container:22.04:arm64:
extends:
- .arm64
- .ubuntu-22.04
- .deps:container
deps:container:24.04:amd64:
extends:
- .amd64
- .ubuntu-24.04
- .deps:container
deps:container:24.04:arm64:
extends:
- .arm64
- .ubuntu-24.04
- .deps:container
#
# ╺┳╸┏━╸┏━┓╺┳╸┏━┓
# ┃ ┣╸ ┗━┓ ┃ ┗━┓
# ╹ ┗━╸┗━┛ ╹ ┗━┛
#
test:22.04:gcc-amd64-bundled-libs:
stage: test
image: ${CI_REGISTRY_IMAGE}:ubuntu-22.04-${ARCH}
extends:
- .amd64
- .ubuntu-deps
script:
- ./make_deps.sh
- rm -rf build && mkdir build
- cmake -B build -DPROFILE=ON -DCMAKE_INSTALL_PREFIX=/usr
- make -sC build -j$(nproc)
- make check -sC build
- ./build/src/splash --info
- ./build/src/splash --child --prefix unittest local &
- ./build/src/splash --doNotSpawn --prefix unittest ./data/share/splash/splash.json
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
test:22.04:clang-amd64-system-libs:
stage: test
image: ${CI_REGISTRY_IMAGE}:ubuntu-22.04-${ARCH}
extends:
- .amd64
- .ubuntu-deps
script:
# Test using Clang with system libs
- rm -rf build && mkdir build
- CC=clang CXX=clang++ cmake -B build -DPROFILE=ON -DCMAKE_INSTALL_PREFIX=/usr -DUSE_SYSTEM_LIBS=ON
- make -sC build -j$(nproc)
- make check -sC build
- ./build/src/splash --info
- ./build/src/splash --child --prefix unittest local &
- ./build/src/splash --doNotSpawn --prefix unittest ./data/share/splash/splash.json
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
#
# ┏━┓┏┓╻┏━┓╻ ╻ ╻┏━┓╻┏━┓
# ┣━┫┃┗┫┣━┫┃ ┗┳┛┗━┓┃┗━┓
# ╹ ╹╹ ╹╹ ╹┗━╸ ╹ ┗━┛╹┗━┛
#
analysis:coverage:
stage: analysis
image: ${CI_REGISTRY_IMAGE}:ubuntu-22.04-${ARCH}
extends:
- .amd64
- .ubuntu-deps
script:
- DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends lcov zip
- ./make_deps.sh
- rm -rf build && mkdir build
- cmake -B build -DTEST_COVERAGE=ON
- make -sC build -j$(nproc)
- make -sC build check_coverage
- zip -r coverage.zip build/coverage
coverage: '/ lines......: \d+\.\d+/'
artifacts:
name: "splash_coverage_${CI_COMMIT_REF_NAME}"
paths:
- "coverage.zip"
expire_in: 2 week
rules:
- if: $CI_COMMIT_BRANCH == 'develop'
analysis:static-analysis:
stage: analysis
image: ${CI_REGISTRY_IMAGE}:ubuntu-24.04-${ARCH}
extends:
- .amd64
- .ubuntu-deps
script:
- DEBIAN_FRONTEND=noninteractive apt install -y clang-tools
- ./make_deps.sh
- rm -rf build && mkdir build
- scan-build cmake -B build -DCMAKE_BUILD_TYPE=Debug -DPROFILE=ON -DCMAKE_INSTALL_PREFIX=/usr
- scan-build -o ./analysis make -sC build -j$(nproc)
artifacts:
name: "splash_${CI_COMMIT_REF_NAME}_analysis"
paths:
- "analysis"
expire_in: 2 week
rules:
- if: $CI_COMMIT_BRANCH == 'staging'
analysis:thread-sanitizer:
stage: analysis
image: ${CI_REGISTRY_IMAGE}:ubuntu-22.04-${ARCH}
extends:
- .amd64
- .ubuntu-deps
allow_failure: true
script:
- DEBIAN_FRONTEND=noninteractive apt install -y clang
- ./make_deps.sh
- rm -rf build && mkdir build
- CC=clang CXX=clang++ cmake -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fsanitize=thread" -DPROFILE=ON -DCMAKE_INSTALL_PREFIX=/usr
- make -sC build -j$(nproc)
- make check -sC build
- ./build/src/splash --info
- ./build/src/splash --child --prefix unittest local &
- ./build/src/splash --doNotSpawn --prefix unittest ./data/share/splash/splash.json
rules:
- if: $CI_COMMIT_BRANCH == 'staging'
analysis:address-sanitizer:
stage: analysis
image: ${CI_REGISTRY_IMAGE}:ubuntu-22.04-${ARCH}
extends:
- .amd64
- .ubuntu-deps
allow_failure: true
script:
- DEBIAN_FRONTEND=noninteractive apt install -y clang
- ./make_deps.sh
- rm -rf build && mkdir build
- CC=clang CXX=clang++ cmake -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fsanitize=address" -DPROFILE=ON -DCMAKE_INSTALL_PREFIX=/usr
- make -sC build -j$(nproc)
- make check -sC build
- ./build/src/splash --info
- ./build/src/splash --child --prefix unittest local &
- ./build/src/splash --doNotSpawn --prefix unittest ./data/share/splash/splash.json
rules:
- if: $CI_COMMIT_BRANCH == 'staging'
#
# ┏━┓╺┳╸┏━┓┏━╸╻┏┓╻┏━╸
# ┗━┓ ┃ ┣━┫┃╺┓┃┃┗┫┃╺┓
# ┗━┛ ╹ ╹ ╹┗━┛╹╹ ╹┗━┛
#
staging:22.04:gcc-arm64-bundled-libs:
stage: staging
image: ${CI_REGISTRY_IMAGE}:ubuntu-22.04-${ARCH}
extends:
- .arm64
- .ubuntu-deps
allow_failure: true
script:
- ./make_deps.sh
- rm -rf build && mkdir build
- cmake -B build -DCMAKE_BUILD_TYPE=Debug -DPROFILE=ON -DCMAKE_INSTALL_PREFIX=/usr
- make -sC build -j$(nproc)
- make check -sC build
- make package -sC build
- ./build/src/splash --info
- ./build/src/splash --child --prefix unittest local &
- ./build/src/splash --doNotSpawn --prefix unittest ./data/share/splash/splash.json
rules:
- if: $CI_COMMIT_BRANCH == 'staging'
staging:24.04:gcc-amd64-system-libs:
stage: staging
image: ${CI_REGISTRY_IMAGE}:ubuntu-24.04-${ARCH}
extends:
- .amd64
- .ubuntu-deps
script:
- rm -rf build && mkdir build
- cmake -B build -DCMAKE_BUILD_TYPE=Debug -DPROFILE=ON -DWITH_SANITIZE=ON -DUSE_SYSTEM_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr
- make -sC build -j$(nproc)
- make check -sC build
- make package -sC build
- ./build/src/splash --info
- ./build/src/splash --child --prefix unittest local &
- ./build/src/splash --doNotSpawn --prefix unittest ./data/share/splash/splash.json
rules:
- if: $CI_COMMIT_BRANCH == 'staging'
staging:24.04:clang-amd64-system-libs:
stage: staging
image: ${CI_REGISTRY_IMAGE}:ubuntu-24.04-${ARCH}
extends:
- .amd64
- .ubuntu-deps
script:
- rm -rf build && mkdir build
- CC=clang CXX=clang++ cmake -B build -DCMAKE_BUILD_TYPE=Debug -DPROFILE=ON -DUSE_SYSTEM_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr
- make -sC build -j$(nproc)
- make check -sC build
- make package -sC build
- ./build/src/splash --info
- ./build/src/splash --child --prefix unittest local &
- ./build/src/splash --doNotSpawn --prefix unittest ./data/share/splash/splash.json
rules:
- if: $CI_COMMIT_BRANCH == 'staging'
staging:fedora:gcc-amd64-system-libs:
stage: staging
extends:
- .amd64
image: fedora:latest
allow_failure: true
before_script:
# We need a few additional dependencies from the RPM Fusion repository
- dnf install --assumeyes https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
- dnf update --assumeyes
- dnf install --assumeyes gcc g++ cmake gsl-devel atlas-devel libgphoto2-devel python3-devel
yasm portaudio-devel python3-numpy opencv-devel jsoncpp-devel libuuid-devel libX11-devel
libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel mesa-libGL-devel ccache
libavcodec-free-devel libavformat-free-devel libavutil-free-devel libswscale-free-devel
libasan libubsan wayland-devel libxkbcommon-devel ninja-build
- mkdir -p ccache
- export CCACHE_BASEDIR=${PWD}
- export CCACHE_DIR=${PWD}/ccache
- export PATH="/usr/lib/ccache:${PATH}"
- ./make_deps.sh
- rm -rf build && mkdir build && cd build
script:
- cmake -DCMAKE_BUILD_TYPE=Debug -DPROFILE=ON -DWITH_SANITIZE=ON -DCMAKE_INSTALL_PREFIX=/usr ..
- make -j$(nproc)
- make check
rules:
- if: $CI_COMMIT_BRANCH == 'staging' || $CI_COMMIT_BRANCH == 'fedora'
staging:archlinux:gcc-amd64-bundled-libs:
stage: staging
extends:
- .amd64
image: archlinux:latest
allow_failure: true
before_script:
- pacman -Syyu --noconfirm --disable-download-timeout
- pacman -Sy --noconfirm --disable-download-timeout git cmake ninja gcc yasm pkgconfig
libxi libxinerama libxrandr libxcursor jsoncpp mesa glm gsl libgphoto2 python3
portaudio zip zlib ffmpeg opencv qt6-base vtk hdf5 glew libxkbcommon fmt make
- mkdir -p ccache
- export CCACHE_BASEDIR=${PWD}
- export CCACHE_DIR=${PWD}/ccache
- export PATH="/usr/lib/ccache:${PATH}"
- ./make_deps.sh
- rm -rf build && mkdir build && cd build
script:
- cmake -DCMAKE_BUILD_TYPE=Debug -DPROFILE=ON -DWITH_SANITIZE=ON -DCMAKE_INSTALL_PREFIX=/usr ..
- make -j$(nproc)
- make check
rules:
- if: $CI_COMMIT_BRANCH == 'staging' || $CI_COMMIT_BRANCH == 'archlinux'
staging:flatpak:
# Note: to run flatpak-builder inside docker, it needs to be configured as privileged
# in the Gitlab configuration file (usually in /etc/gitlab-runner/config.toml)
stage: staging
tags:
- privileged
image: ubuntu:22.04
allow_failure: false
before_script:
- apt update -qq
- DEBIAN_FRONTEND=noninteractive apt install -y flatpak-builder
- flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- flatpak install -y flathub org.freedesktop.Platform//22.08 org.freedesktop.Sdk//22.08
script:
- rm -rf splash.tar.gz && touch splash.tar.gz
- tar --exclude='.git' --exclude='ccache' --exclude='splash.tar.gz' -cvzf splash.tar.gz .
- cd tests/packaging
- flatpak-builder --ccache --repo=flatpak_repo build --force-clean xyz.splashmapper.Splash.json
- flatpak build-bundle flatpak_repo splash.flatpak xyz.splashmapper.Splash
- mv splash.flatpak ../../
rules:
- if: $CI_COMMIT_BRANCH == 'staging' || $CI_COMMIT_BRANCH == 'flatpak'
artifacts:
name: "splash-flatpak"
paths:
- "splash.flatpak"
expire_in: 2 weeks
staging:windows:
# Note: this job works on Windows with MSYS2 / MINGW64 already installed
# See the README.md file or the manual compilation guide on the website
# for more information
stage: staging
tags:
- windows
variables:
MSYSTEM: 'UCRT64'
CHERE_INVOKING: 'yes'
script:
- C:\msys64\usr\bin\bash -lc 'pacman -Syuu --noconfirm'
- C:\msys64\usr\bin\bash -lc 'pacman -Syuu --noconfirm --needed zip git'
- C:\msys64\usr\bin\bash -lc 'pacman -Syuu --noconfirm --needed mingw-w64-ucrt-x86_64-{cmake,make,gcc,yasm,pkgconf,jsoncpp,glm,gsl,python3,portaudio,zlib,ffmpeg,zeromq,cppzmq,snappy,opencv,gphoto2}'
- C:\msys64\usr\bin\bash -lc 'bash -x ./tools/build_windows'
artifacts:
name: "splash_windows_installer"
paths:
- "splash-*-win64.exe"
expire_in: 2 weeks
rules:
- if: $CI_COMMIT_BRANCH == 'staging'
#
# ┏━┓┏━┓┏━╸╻┏ ┏━┓┏━╸┏━╸
# ┣━┛┣━┫┃ ┣┻┓┣━┫┃╺┓┣╸
# ╹ ╹ ╹┗━╸╹ ╹╹ ╹┗━┛┗━╸
#
.package:debian:22.04:
stage: package
image: ${CI_REGISTRY_IMAGE}:ubuntu-22.04-${ARCH}
extends:
- .ubuntu-deps
script:
# Build package
- ./make_deps.sh
- rm -rf build && mkdir build && cd build
- cmake -DBUILD_GENERIC_ARCH=ON -DWITH_LTO=ON -DCMAKE_INSTALL_PREFIX=/usr ..
- make -j$(nproc)
- make package
- mv *.deb ../
artifacts:
name: "splash_${CI_COMMIT_REF_NAME}"
paths:
- "*.deb"
expire_in: never
rules:
- if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/
- if: $CI_COMMIT_BRANCH == 'master'
package:debian:22.04:amd64:
extends:
- .package:debian:22.04
- .amd64
package:debian:22.04:arm64:
extends:
- .package:debian:22.04
- .arm64
.package:debian:24.04:
stage: package
image: ${CI_REGISTRY_IMAGE}:ubuntu-24.04-${ARCH}
extends:
- .ubuntu-deps
script:
# Build package
- ./make_deps.sh
- rm -rf build && mkdir build && cd build
- cmake -DBUILD_GENERIC_ARCH=ON -DWITH_LTO=ON -DCMAKE_INSTALL_PREFIX=/usr ..
- make -j$(nproc)
- make package
- mv *.deb ../
artifacts:
name: "splash_${CI_COMMIT_REF_NAME}"
paths:
- "*.deb"
expire_in: never
rules:
- if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/
- if: $CI_COMMIT_BRANCH == 'master'
package:debian:24.04:amd64:
extends:
- .package:debian:24.04
- .amd64
package:debian:24.04:arm64:
extends:
- .package:debian:24.04
- .arm64
package:blender_addon:
stage: package
image: ${CI_REGISTRY_IMAGE}:ubuntu-22.04-${ARCH}
extends:
- .amd64
- .ubuntu-deps
before_script:
- apt update -qq
- DEBIAN_FRONTEND=noninteractive apt install -y git git-lfs zip cmake build-essential pkg-config
script:
# Build the Blender addon
- rm -rf build && mkdir build && cd build
- cmake -DBUILD_CODE=OFF ..
- make blenderSplash
- mv addons/blender/*.tar.bz2 ../
artifacts:
name: "splash_blender_addon_${CI_COMMIT_REF_NAME}"
paths:
- "*.tar.bz2"
expire_in: never
rules:
- if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/
- if: $CI_COMMIT_BRANCH == 'master'
package:fullsources:
stage: package
image: alpine
before_script:
- apk update && apk upgrade
script:
# This job packages the whole sources, including the submodules
- rm -rf splash.tar.gz && touch splash.tar.gz
- tar --exclude='.git' --exclude='ccache' --exclude='splash.tar.gz' -cvzf splash.tar.gz .
artifacts:
paths:
- splash.tar.gz
expire_in: never
rules:
- if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/
- if: $CI_COMMIT_BRANCH == 'master'
package:windows:
# Note: this job works on Windows with MSYS2 / MINGW64 already installed
# See the README.md file or the manual compilation guide on the website
# for more information
stage: package
tags:
- windows
variables:
MSYSTEM: 'UCRT64'
CHERE_INVOKING: 'yes'
script:
- C:\msys64\usr\bin\bash -lc 'pacman -Syuu --noconfirm'
- C:\msys64\usr\bin\bash -lc 'pacman -Syuu --noconfirm --needed zip git'
- C:\msys64\usr\bin\bash -lc 'pacman -Syuu --noconfirm --needed mingw-w64-ucrt-x86_64-{cmake,make,gcc,yasm,pkgconf,jsoncpp,glm,gsl,python3,portaudio,zlib,ffmpeg,zeromq,cppzmq,snappy,opencv,gphoto2}'
- C:\msys64\usr\bin\bash -lc 'bash -x ./tools/build_windows'
artifacts:
name: "splash_windows_installer"
paths:
- "splash-*-win64.exe"
expire_in: never
rules:
- if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/
- if: $CI_COMMIT_BRANCH == 'master'
#
# ╺┳┓┏━╸┏━┓╻ ┏━┓╻ ╻
# ┃┃┣╸ ┣━┛┃ ┃ ┃┗┳┛
# ╺┻┛┗━╸╹ ┗━╸┗━┛ ╹
#
pages:
stage: deploy
image: ${CI_REGISTRY_IMAGE}:ubuntu-22.04-${ARCH}
extends:
- .amd64
- .ubuntu-deps
variables:
GIT_SUBMODULE_STRATEGY: recursive
script:
# Here we build only the API doc, for testing purposes
- DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends doxygen
- mkdir -p build && pushd build
- cmake -DBUILD_CODE=OFF .. && make doc && cp -r docs/html ../public
rules:
- if: $CI_COMMIT_BRANCH == 'develop'
- if: $CI_COMMIT_BRANCH == 'master'
artifacts:
paths:
- public
expire_in: 2 week