-
Notifications
You must be signed in to change notification settings - Fork 203
/
.gitlab-ci.yml
473 lines (446 loc) · 16.6 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
stages:
- build
- sign
- deploy
variables:
CCACHE_COMPILERCHECK: content
CCACHE_DIR: "${CI_PROJECT_DIR}/.ccache"
# prevent configure tzdata hanging apt install commands
DEBIAN_FRONTEND: noninteractive
FF_SCRIPT_SECTIONS: 1
FF_USE_FASTZIP: 1
build-windows:
stage: build
image: win10-base
tags: [libvirt,powershell]
rules:
- if : '$CI_PIPELINE_TRIGGERED == null'
variables:
APPVEYOR_REPO_BRANCH: "${CI_COMMIT_REF_NAME}"
APPVEYOR_REPO_COMMIT: "${CI_COMMIT_SHORT_SHA}"
CMAKE_BUILD_PARALLEL_LEVEL: 8
before_script:
- mkdir -p hunter -f
- Move-Item -Path hunter -Destination C:/hunter
script:
- ./.ci/windows/build.bat
after_script:
- ./.ci/upload-nightly.ps1
- Move-Item -Path C:/hunter -Destination hunter -Force
cache:
key: "$CI_JOB_NAME"
paths:
- hunter/
- build/_deps
artifacts:
paths:
- nheko.msix
- nheko_win_64.zip
name: nheko-${CI_COMMIT_SHORT_SHA}-windows-unsigned
expose_as: 'windows-app-unsigned'
codesign-windows:
stage: sign
image: win10-base
tags: [libvirt,powershell]
rules:
- if : '$CI_PIPELINE_TRIGGERED == null && $CI_COMMIT_REF_PROTECTED == "true"'
resource_group: windows_signing
environment:
name: windows_signing
#variables:
# GIT_STRATEGY: none
script:
- Get-ChildItem -Path Cert:CurrentUser\My
- ./.ci/windows/sign.bat
- mkdir -p artifacts
- mv nheko.msix artifacts/nheko.msix
needs:
- job: build-windows
artifacts:
paths:
- artifacts/nheko.msix
name: nheko-${CI_COMMIT_SHORT_SHA}-windows
expose_as: 'windows-app'
upload-windows:
stage: deploy
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest
tags: [docker]
rules:
- if: '$CI_PIPELINE_TRIGGERED == null && $CI_COMMIT_REF_PROTECTED == "true" && $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/'
variables:
PACKAGE_NAME: "windows"
- if: '$CI_PIPELINE_TRIGGERED == null && $CI_COMMIT_REF_PROTECTED == "true"'
variables:
GIT_STRATEGY: none
PACKAGE_NAME: "windows-nightly"
before_script:
- apk add curl unzip
script:
- export VERSION=$(unzip -p artifacts/nheko.msix AppxManifest.xml | sed -n 's/.* Version="\([0-9.]*\)".*/\1/p')
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file artifacts/nheko.msix "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${VERSION}/nheko.msix"'
needs:
- job: codesign-windows
pages:
stage: deploy
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest
tags: [docker]
rules:
- if: '$CI_PIPELINE_TRIGGERED == null && $CI_COMMIT_REF_PROTECTED == "true"'
interruptible: true
before_script:
- apk add curl jq
script:
- export LATEST_WINDOWS_NIGHTLY=$(curl "https://nheko.im/api/v4/projects/2/packages?package_name=windows-nightly&order_by=version&sort=desc" | jq -r '.[0].version')
#- export LATEST_WINDOWS=$(curl "https://nheko.im/api/v4/projects/2/packages?package_name=windows&order_by=version&sort=desc" | jq -r '.[0].version')
# hardcoded to avoid fuzzy matching
- export LATEST_WINDOWS='0.12.0.35798'
- sed "s/0.12.0.0/${LATEST_WINDOWS_NIGHTLY}/g" -i resources/NhekoNightly.appinstaller
- sed "s/0.12.0.0/${LATEST_WINDOWS}/g" -i resources/Nheko.appinstaller
- mkdir public
- mv resources/NhekoNightly.appinstaller public
- mv resources/Nheko.appinstaller public
needs:
- job: upload-windows
optional: true
artifacts: false
artifacts:
paths:
- public
build-clazy:
stage: build
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest
tags: [docker]
variables:
CLAZY_CHECKS: level0,level1,no-non-pod-global-static
TRAVIS_OS_NAME: linux
before_script:
- apk add asciidoctor cmake cmark-dev gst-plugins-bad-dev gst-plugins-base-dev gstreamer-dev lmdb-dev lmdbxx nlohmann-json olm-dev openssl-dev qt6-qtbase-dev qt6-qtdeclarative-dev qt6-qtmultimedia-dev qt6-qtsvg-dev qt6-qttools-dev samurai spdlog-dev xcb-util-wm-dev zlib-dev ccache curl-dev libevent-dev meson clazy clang16 gcc musl-dev git re2-dev libsecret-dev
script:
- export PATH="/usr/lib/ccache:${PATH}"
- export CMAKE_BUILD_PARALLEL_LEVEL=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l)
- export CLANGXX=clang++-16
- cmake -GNinja -H. -Bbuild
-DCMAKE_INSTALL_PREFIX=.deps/usr
-DHUNTER_ENABLED=OFF -DBUILD_SHARED_LIBS=OFF -DUSE_BUNDLED_OPENSSL=ON -DUSE_BUNDLED_MTXCLIENT=ON -DUSE_BUNDLED_COEURL=ON -DUSE_BUNDLED_OLM=ON -DUSE_BUNDLED_QTKEYCHAIN=ON -DUSE_BUNDLED_KDSINGLEAPPLICATION=ON
-DVOIP=OFF
-DCMAKE_BUILD_TYPE=Release
-DCI_BUILD=ON -DFETCHCONTENT_QUIET=OFF -DCMAKE_CXX_COMPILER=clazy
- cmake --build build
rules:
- if : '$CI_PIPELINE_TRIGGERED == null'
cache:
key: "$CI_JOB_NAME"
paths:
- .ccache
# disabled until I find a qt6.5 ppa
.build-gcc11:
stage: build
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/ubuntu:22.04
tags: [docker]
variables:
TRAVIS_OS_NAME: linux
before_script:
- apt-get update
- apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev
libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev
qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev
qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts
qt5keychain-dev ccache libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc time # libolm-dev
# need recommended deps for wget
- apt-get -y install wget
- /usr/sbin/update-ccache-symlinks
- rm -rf ../.hunter && mv .hunter ../.hunter || true
script:
- export PATH="/usr/lib/ccache:${PATH}"
- cmake -GNinja -H. -Bbuild
-DCMAKE_INSTALL_PREFIX=.deps/usr
-DHUNTER_ROOT="../.hunter"
-DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF -DUSE_BUNDLED_OPENSSL=ON -DUSE_BUNDLED_LMDB=OFF -DUSE_BUNDLED_QTKEYCHAIN=OFF -DUSE_BUNDLED_KDSINGLEAPPLICATION=ON
-DVOIP=OFF
-DCMAKE_BUILD_TYPE=Release -DHUNTER_CONFIGURATION_TYPES=Release
-DCI_BUILD=ON -DFETCHCONTENT_QUIET=OFF
-DJSON_ImplicitConversions=OFF
- /usr/bin/time cmake --build build
after_script:
- mv ../.hunter .hunter
rules:
- if : '$CI_PIPELINE_TRIGGERED == null'
cache:
key: "$CI_JOB_NAME"
paths:
- .hunter/
- .ccache
build-tw:
stage: build
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/opensuse/tumbleweed
tags: [docker]
variables:
TRAVIS_OS_NAME: linux
before_script:
- >
zypper --non-interactive install
"appstream-glib"
"asciidoc"
"ccache"
"cmake"
"cmark-devel"
"desktop-file-utils"
"gcc-c++"
"git"
"libappstream-glib8"
"lmdb-devel"
"memory-constraints"
"ninja"
"nlohmann_json-devel"
"olm-devel"
"openssl-devel"
"pkgconfig"
"spdlog-devel"
"zlib-devel"
"cmake(re2)"
"cmake(Qt6Core)"
"cmake(Qt6DBus)"
"cmake(Qt6Keychain)"
"cmake(Qt6LinguistTools)"
"cmake(Qt6Multimedia)"
"cmake(Qt6QuickControls2)"
"cmake(Qt6Svg)"
"cmake(Qt6Widgets)"
"cmake(Qt6Gui)"
"qt6-qml-private-devel"
"qt6-gui-private-devel"
"pkgconfig(libcurl)"
"pkgconfig(libevent)"
"pkgconfig(gstreamer-webrtc-1.0)"
"pkgconfig(xcb)"
"pkgconfig(xcb-ewmh)"
"time"
script:
- export PATH="/usr/lib64/ccache:${PATH}"
- cmake -GNinja -H. -Bbuild
-DCMAKE_INSTALL_PREFIX=.deps/usr
-DUSE_BUNDLED_MTXCLIENT=ON -DUSE_BUNDLED_COEURL=ON -DUSE_BUNDLED_LMDBXX=ON -DUSE_BUNDLED_KDSINGLEAPPLICATION=ON
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_CXX_FLAGS="-Wno-error=array-bounds"
-DCI_BUILD=ON -DFETCHCONTENT_QUIET=OFF
# temporarily disabled because of mtxclient failures
#-DJSON_ImplicitConversions=OFF
- /usr/bin/time cmake --build build
rules:
- if : '$CI_PIPELINE_TRIGGERED == null'
cache:
key: "$CI_JOB_NAME"
paths:
- .ccache
build-macos:
stage: build
tags: [macos]
before_script:
- rm -rf ../.hunter && mv .hunter ../.hunter || true
script:
- ./.ci/macos/build.sh
after_script:
- mv ../.hunter .hunter
rules:
- if : '$CI_PIPELINE_TRIGGERED == null'
artifacts:
paths:
- nheko.app # not putting this in 'artifacts' subdir because we don't want to put it on releases
name: nheko-${CI_COMMIT_SHORT_SHA}-macos-app
expose_as: 'macos-app'
public: false
cache:
key: "${CI_JOB_NAME}"
paths:
- .hunter/
- "${CCACHE_DIR}"
build-macos-as:
extends: build-macos
image: ghcr.io/cirruslabs/macos-sequoia-xcode:16.1
tags: [macos-tart]
before_script:
- brew bundle --file .ci/macos/Brewfile
- pipx install aqtinstall
- pipx ensurepath
- . ~/.zshrc
- mkdir $HOME/Qt
- aqt install-qt --outputdir $HOME/qt mac desktop 6.8 clang_64 -m qtlocation qtimageformats qtmultimedia qtpositioning qtshadertools
script:
- export QTPATH=($HOME/qt/6.*/macos/bin)
- export PATH="$QTPATH:${PATH}"
- ./.ci/macos/build.sh
.codesign-macos: &codesign_macos
stage: sign
before_script:
- pipx install dmgbuild
- pipx ensurepath
tags: [macos]
script:
- export QTPATH=(/Users/jdonof/Qt/6.*/macos/bin)
- export PATH=${QTPATH}:${PATH}
- ./.ci/macos/notarize.sh
after_script:
- ./.ci/upload-nightly-gitlab.sh artifacts/nheko-${CI_COMMIT_SHORT_SHA}-${PLAT}.dmg
artifacts:
paths:
- artifacts/nheko-${CI_COMMIT_SHORT_SHA}-${PLAT}.dmg
name: nheko-${CI_COMMIT_SHORT_SHA}-macos
codesign-macos-intel:
<<: *codesign_macos
variables:
PLAT: "intel"
needs:
- job: build-macos
rules:
- if : '$CI_COMMIT_BRANCH == "master"'
- if : $CI_COMMIT_TAG
codesign-macos-as:
<<: *codesign_macos
tags: [macos]
variables:
PLAT: "apple_silicon"
needs:
- job: build-macos-as
optional: true # optional since we want to be able to also trigger this job from cirrus ci for apple silicon builds.
rules:
- if : '$CI_PIPELINE_TRIGGERED && $CI_COMMIT_REF_PROTECTED == "true"'
variables:
PLAT: "apple_silicon"
- if : '$CI_COMMIT_BRANCH == "master"'
- if : $CI_COMMIT_TAG
build-flatpak:
stage: build
image:
name: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/ubuntu:latest
#docker:
# platform: ${ARCH}
#image: 'registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master'
tags:
- docker-amd64
parallel:
matrix:
- ARCH: amd64
AARCH: x86_64
JOBS: 0
- ARCH: arm64
AARCH: aarch64
JOBS: 3
before_script:
- apt-get update && apt-get -y install flatpak-builder git python3 curl python3-aiohttp python3-tenacity gir1.2-ostree-1.0
- flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
# see https://github.com/flatpak/flatpak-builder/issues/495
- git config --global protocol.file.allow always
script:
- export VERSION=$(git describe)
# workaround for https://github.com/flatpak/flatpak/issues/5076
- dbus-send --system /org/freedesktop/DBus org.freedesktop.DBus || dbus-daemon --system --fork
- mkdir -p build-flatpak
- cd build-flatpak
- flatpak-builder --arch=${AARCH} --install-deps-from=flathub --user --disable-rofiles-fuse --ccache --repo=repo --default-branch=${CI_COMMIT_REF_NAME//\//_} --subject="Build of Nheko ${VERSION} `date` for ${ARCH}" app ../im.nheko.Nheko.yaml --jobs=$JOBS
- flatpak install --user -y flathub org.flatpak.Builder
- flatpak run --command=flatpak-builder-lint org.flatpak.Builder appstream app/files/share/app-info/xmls/im.nheko.Nheko.xml.gz
- flatpak --arch=${AARCH} build-bundle repo nheko-${ARCH}.flatpak im.nheko.Nheko ${CI_COMMIT_REF_NAME//\//_}
after_script:
- bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-${ARCH}.flatpak
- (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || exit_code=$?
rules:
- if : '$CI_PIPELINE_TRIGGERED == null'
cache:
key: "$CI_JOB_NAME"
paths:
- build-flatpak/.flatpak-builder/
when: always # because the arm runner is slow and ooms often otherwise!
artifacts:
expose_as: 'flatpak'
paths: ['build-flatpak/nheko-${ARCH}.flatpak']
name: flatpak-${CI_COMMIT_REF_NAME}-${VERSION}-${ARCH}
# disabled until I find a qt6.5 ppa for Ubuntu
.appimage-amd64:
stage: build
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/ubuntu:22.04
tags: [docker]
allow_failure: true
before_script:
# Installing the packages needed to download and install third-party tools
- apt-get update && apt-get install -y software-properties-common git wget curl python3 python3-pip python3-setuptools
# Installing the packages needed to compile nheko and third-party tools
- apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev
libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev
qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev
qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts
qt5keychain-dev ccache libcurl4-openssl-dev libevent-dev libspdlog-dev nlohmann-json3-dev libcmark-dev asciidoc libre2-dev libgtest-dev libgl1-mesa-dev qml-module-qtquick-particles2
# Installing the packages needed to build AppImage
- apt-get -yq install breeze-icon-theme desktop-file-utils elfutils fakeroot file gnupg2 gtk-update-icon-cache libgdk-pixbuf2.0-dev libgdk-pixbuf2.0-0 libglib2.0-bin librsvg2-dev libyaml-dev strace zsync squashfs-tools
- wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /usr/local/bin/appimagetool && \
- chmod +x /usr/local/bin/appimagetool
- export HOME_DIR=$(pwd)
# Workaround for https://github.com/AppImageCrafters/appimage-builder/issues/280
- cd /tmp
- git clone https://github.com/AppImageCrafters/appimage-builder
- cd appimage-builder
- git checkout 9733877eed75aea0fa8e9a1cd26c22d77a10aa4a
- pip3 install .
- pip3 install cffi
- cd $HOME_DIR
- /usr/sbin/update-ccache-symlinks
- rm -rf ../.hunter && mv .hunter ../.hunter || true
script:
- export PATH="/usr/local/bin/:/usr/lib/ccache:${PATH}"
- cmake -GNinja -H. -Bbuild
-DCMAKE_INSTALL_PREFIX=/usr
-DHUNTER_ROOT=".hunter"
-DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF -DUSE_BUNDLED_OPENSSL=ON -DUSE_BUNDLED_LMDB=OFF -DUSE_BUNDLED_QTKEYCHAIN=OFF -DUSE_BUNDLED_LIBEVENT=OFF -DUSE_BUNDLED_KDSINGLEAPPLICATION=ON
-DVOIP=OFF -DMAN=OFF
-DCMAKE_BUILD_TYPE=Release -DHUNTER_CONFIGURATION_TYPES=Release
-DCI_BUILD=ON -DFETCHCONTENT_QUIET=OFF
-DJSON_ImplicitConversions=OFF
- DESTDIR=`pwd`/AppDir ninja -C build install/local
- DESTDIR=`pwd`/AppDir ninja -C build _deps/cmark-build/src/install
- mkdir -p AppDir/usr/lib/x86_64-linux-gnu AppDir/lib/x86_64-linux-gnu
- appimage-builder --skip-test
after_script:
- mkdir -p artifacts && cp nheko-latest-x86_64.AppImage artifacts/
- bash ./.ci/upload-nightly-gitlab.sh nheko-latest-x86_64.AppImage
rules:
- if : '$CI_PIPELINE_TRIGGERED == null'
artifacts:
paths:
- 'artifacts/nheko-latest-x86_64.AppImage'
expire_in: 1 week
expose_as: 'appimage-amd64'
cache:
key: "$CI_JOB_NAME"
paths:
- .hunter/
- .ccache
linting:
stage: build
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest
tags: [docker]
before_script:
- apk update && apk add make git python3 py3-pip qt6-qtdeclarative-dev
# clang18 seems to mess with the emit keyword when using the `->` operator
- apk add clang17-extra-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
- export PATH="$PATH:/usr/lib/llvm17/bin/:/root/.local/bin"
- pip3 install --break-system-packages --user reuse
script:
- make lint
- make license
rules:
- if : '$CI_PIPELINE_TRIGGERED == null'
github-release:
stage: deploy
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest
tags: [docker]
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/'
dependencies:
#- appimage-amd64 <- disabled because of missing packages
- build-flatpak
- codesign-macos-intel
- codesign-macos-as
- codesign-windows
before_script:
- apk update && apk add jq curl perl
script:
- ./.ci/update-github-release.sh