loom
/
.gitlab-ci.yml
455 строк · 13.7 Кб
1# Перечень этапов
2stages:
3- build
4- test
5- coverage
6- delivery
7- deploy
8
9variables:
10WINDOWS_SUPPORT_URL: "https://gitlab.com/mfetisov_lsx/simodo/deploy-windows.git"
11
12.save_dir_to_env_var: &save_dir_to_env_var
13- __GITLAB_CI_last_location_dir__=$PWD
14
15.return_to_saved_dir: &return_to_saved_dir
16- cd $__GITLAB_CI_last_location_dir__
17
18# Шаблон Alt p10
19
20## Устанавливаем общие программы для сборки
21
22.download_build_programs_alt_p10: &download_build_programs_alt_p10
23# Обновляем список пакетов в репозиториях
24- apt-get update -y
25# Ставим пакеты для сборки
26- apt-get install -y cmake make gcc gcc-c++ qt5-base-devel qt5-charts-devel qt5-datavis3d-devel qt5-svg-devel boost-devel boost-filesystem-devel boost-asio-devel boost-interprocess-devel qt5-tools
27
28.before_alt: &before_alt
29- *download_build_programs_alt_p10
30# Создаём рабочие каталоги
31- ./configure
32
33.alt_p10_template:
34image: alt:p10
35before_script: *before_alt
36
37# Шаблон Ubuntu jammy
38
39## Устанавливаем общие программы для сборки
40
41.download_build_programs_ubuntu: &download_build_programs_ubuntu_jammy
42# Обновляем список пакетов в репозиториях
43- apt -y update
44# Ставим пакеты для сборки
45## qttools5-dev-tools зависит от tzdata
46- DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends tzdata
47- apt -y install cmake g++ qt5-qmake qtbase5-dev libqt5charts5-dev libqt5datavisualization5-dev libqt5svg5-dev wget qttools5-dev-tools
48- wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz
49- tar -zxf boost_1_82_0.tar.gz
50- cd boost_1_82_0
51- ./bootstrap.sh --with-libraries=filesystem
52- ./b2 install
53- cd ..
54
55.make_translator_aliases: &make_translator_aliases
56- lrelease-qt5() { lrelease $@; }
57- export -f lrelease-qt5
58- lupdate-qt5() { lupdate $@; }
59- export -f lupdate-qt5
60
61.before_ubuntu: &before_ubuntu
62- *download_build_programs_ubuntu_jammy
63- *make_translator_aliases
64# Создаём рабочие каталоги
65- ./configure
66
67.ubuntu_jammy_template:
68image: ubuntu:jammy
69before_script: *before_ubuntu
70
71# Windows
72
73.download_cross_compile_programs_ubuntu_jammy: &download_cross_compile_programs_ubuntu_jammy
74# Устанавливаем пакеты
75- apt -y update
76- apt -y install git make libxcb-glx0 libx11-xcb1 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxkbcommon-x11-0 libegl1 libpcre2-16-0 libgl1 libjpeg-dev wget
77
78# Build
79# Собираем проект
80
81.build_template:
82stage: build
83script:
84# Собираем
85- go/make
86# Автотесты
87- test/libs
88
89artifacts:
90paths:
91- bin/*
92expire_in: 30 minutes
93
94except:
95- prod
96- test-prod
97
98build alt p10:
99extends:
100- .build_template
101- .alt_p10_template
102
103build ubuntu jammy:
104extends:
105- .build_template
106- .ubuntu_jammy_template
107
108build windows 10:
109stage: build
110image: ubuntu:jammy
111variables:
112__support_url__: "$WINDOWS_SUPPORT_URL"
113script:
114- *download_cross_compile_programs_ubuntu_jammy
115
116# Скачивание утилит и фреймворков
117- git clone --depth 1 $__support_url__ cross
118- __support_dir__=$PWD/cross
119- *save_dir_to_env_var
120
121# Распаковка mxe
122- cd /opt
123# - cat $__support_dir__/mxe.tar.gz.* | tar -zxf -
124- tar -zxf $__support_dir__/mxe.tar.gz
125- chmod -R +x .
126- export PATH=$PWD/mxe/usr/bin:$PWD/mxe/usr/x86_64-w64-mingw32.shared/qt5/bin:$PATH
127- *make_translator_aliases
128- *return_to_saved_dir
129
130# Сборка проекта
131- ./configure
132- go/crossmake
133
134only:
135- merge_requests
136
137# Coverage
138## Получение информации о покрытии тестами для код-ревью
139
140# Получение информации о покрытии тестами для код-ревью
141
142coverage-for-merge-requests:
143stage: coverage
144extends: .ubuntu_jammy_template
145script:
146# Устанавливаем пакеты
147- apt-get -y install gcovr
148# Собираем
149- go/makec
150# Прогоняем тест
151- test/libs
152# Получаем и сохраняем отчёт XML
153- export PATH="$PWD/cov-support:$PATH"
154- gcovr --xml-pretty --exclude-unreachable-branches --print-summary -o coverage.xml --root ${CI_PROJECT_DIR}
155
156# Начиная с 14 версии GitLab
157artifacts:
158expire_in: 30 days
159reports:
160coverage_report:
161coverage_format: cobertura
162path: ./coverage.xml
163
164# Для старых версий GitLab (дло 14)
165# artifacts:
166# name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
167# expire_in: 30 days
168# reports:
169# cobertura: ./coverage.xml
170
171only:
172- merge_requests
173
174# Delivery
175
176.delivery_template:
177stage: delivery
178dependencies: []
179
180# Установка gitlab-release-cli
181# - apt-get -y install curl
182# - curl --location --output /usr/local/bin/release-cli "https://gitlab.com/api/v4/projects/gitlab-org%2Frelease-cli/packages/generic/release-cli/latest/release-cli-linux-amd64"
183# - sudo chmod +x /usr/local/bin/release-cli
184# - release-cli -v
185# release:
186# tag_name: '0.2.0'
187# name: 'Release 0.2.0'
188# description: 'Release created using the release-cli.'
189
190artifacts:
191paths:
192- packages/*
193expire_in: 120 days
194
195only:
196- prod
197- test-prod
198
199.download_linux_support: &download_linux_support
200- __last_loc_dir__=$PWD
201- git clone --depth 1 $__support_url__ support
202- __support__=$PWD/support
203
204.unpack_deploylinuxqt: &unpack_deploylinuxqt
205- mkdir linuxdeployqt
206- cd linuxdeployqt
207- tar -zxf $__support__/linuxdeployqt.tar.gz
208- export PATH=$PWD/bin:$PATH
209- cd $__last_loc_dir__
210
211.unpack_ifw_with_static_qt: &unpack_ifw_with_static_qt
212- mkdir -p Qt/QtIFW
213- cd Qt/QtIFW
214- tar -zxf $__support__/QtIFW.tar.gz
215- cd $__last_loc_dir__
216
217.do_deploy: &do_deploy
218- go/make
219- go/deploy
220
221.download_servers: &download_servers
222- mkdir -p data/servers
223- rm -rf data/servers/*
224- cd data/servers
225- SERVER_HOST_URL=http://simodo.ru/distros/stars
226- wget $SERVER_HOST_URL/$__servers_url__/simodo-server.tar.gz
227- wget $SERVER_HOST_URL/$__servers_url__/language-server.tar.gz
228- tar -zxf simodo-server.tar.gz
229- tar -zxf language-server.tar.gz
230- rm -f simodo-server.tar.gz language-server.tar.gz
231- cd ../..
232
233delivery alt:
234extends:
235- .delivery_template
236- .alt_p10_template
237
238variables:
239__support_url__: "https://gitlab.com/mfetisov_lsx/simodo/deploy-alt.git"
240__servers_url__: "alt/p10/0.4.5-UTC_2024.04.12_18.56.x86_64/bin"
241script:
242# Устанавливаем пакеты
243## support зависит от git, linuxdeployqt
244## libqxcb.so зависит от libpango, libgdk-pixbuf
245## libopenglrenderer.so зависит от qt5-3d
246## platformthemes, platforminputcontext, iconengines, platforms, xcbglintegrations зависит от plasma5-integration
247## styles зависит от plasma5-breeze
248## kio зависит от kf5-kio
249- apt-get -y install git linuxdeployqt libpango libgdk-pixbuf plasma5-integration plasma5-breeze kf5-kio wget
250
251- *download_linux_support
252- *unpack_ifw_with_static_qt
253
254- *download_servers
255
256- *do_deploy
257
258delivery ubuntu:
259extends:
260- .delivery_template
261- .ubuntu_jammy_template
262
263variables:
264__support_url__: "https://gitlab.com/mfetisov_lsx/simodo/deploy-ubuntu.git"
265__servers_url__: "ubuntu/jammy/0.4.5-UTC_2024.04.12_18.57.x86_64/bin"
266script:
267# Устанавливаем пакеты
268## support зависит от git
269## linuxdeployqt зависит от patchelf
270## platformthemes, platforminputcontext, iconengines, platforms, xcbglintegrations, styles, kio зависит от plasma-integration
271## geometryloaders зависит от qt3d-defaultgeometryloader-plugin, qt3d-gltfsceneio-plugin
272- apt -y install git patchelf plasma-integration wget
273
274- *download_linux_support
275- *unpack_deploylinuxqt
276- *unpack_ifw_with_static_qt
277
278- *download_servers
279
280- *do_deploy
281
282delivery windows:
283extends: .delivery_template
284
285image: ubuntu:jammy
286
287variables:
288__support_url__: "$WINDOWS_SUPPORT_URL"
289__servers_url__: "windows/10/0.4.5-UTC_2024.04.12_17.12.x86_64/bin"
290script:
291- *download_cross_compile_programs_ubuntu_jammy
292
293# Скачивание утилит и фреймворков
294- git clone --depth 1 $__support_url__ cross
295- __support_dir__=$PWD/cross
296- *save_dir_to_env_var
297
298# Распаковка mxe
299- cd /opt
300# - cat $__support_dir__/mxe.tar.gz.* | tar -zxf -
301- tar -zxf $__support_dir__/mxe.tar.gz
302- chmod -R +x .
303- export PATH=$PWD/mxe/usr/bin:$PWD/mxe/usr/x86_64-w64-mingw32.shared/qt5/bin:$PATH
304- *make_translator_aliases
305- *return_to_saved_dir
306
307# Установка QtIFW
308- mkdir -p Qt/QtIFW/bin
309- cd Qt/QtIFW/bin
310- echo \#\!/bin/bash > binarycreator
311- echo /opt/mxe/usr/bin/x86_64-pc-linux-gnu-binarycreator -t /opt/mxe/usr/x86_64-w64-mingw32.static/qt5/bin/installerbase.exe \$\@ >> binarycreator
312- chmod +rwx binarycreator
313- *return_to_saved_dir
314
315- *download_servers
316- mkdir -p data/servers/lsp/bin
317- cp data/servers/language-server/bin/*dll data/servers/lsp/bin/
318
319# Сборка проекта
320- ./configure
321- go/crossmake
322
323# Распаковка зависимостей редактора
324- cd bin
325- tar -zxf $__support_dir__/qt_runtime.tar.gz
326- tar -zxf $__support_dir__/boost_runtime.tar.gz
327- *return_to_saved_dir
328
329# Развёртывание проекта
330- go/deploy
331
332# Переименовываем расширения дистрибутивов
333- cd packages
334- for i in *; do mv "$i" "${i/run/exe}"; done;
335
336# Pages
337## Используем GitLab Pages для публикации Doxygen-документации и отчёта покрытия тестами
338
339pages:
340stage: delivery
341extends: .alt_p10_template
342dependencies: []
343script:
344# Устанавливаем пакеты
345- apt-get -y install doxygen graphviz lcov
346- apt-get install -y fonts-ttf-dejavu
347# Прогоняем Doxygen
348- go/doxy
349# Собираем
350- go/makec
351# Прогоняем тест
352- test/libs
353# Получаем и сохраняем отчёт HTML
354- export PATH="$PWD/cov-support:$PATH"
355- lcov -t "SIMODO shell" -o sidmodo-shell.info -c -d . --no-external
356- genhtml -o coverage sidmodo-shell.info
357# Деплоим
358- mv doc/html/ public/
359- mv coverage/ public/coverage/
360
361coverage: /^\s*lines\.*:\s+\d+\.\d+%/
362
363artifacts:
364paths:
365- public
366expire_in: 120 days
367only:
368- dev
369
370# Deploy
371
372.deploy_template:
373stage: deploy
374image: alt:p10
375script:
376- apt-get -y update
377- apt-get -y install openssh sshpass zip
378- ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
379- DISTRO_FILENAME=$(ls packages)
380- VERSION_STRING=$(echo $DISTRO_FILENAME | sed -e 's/simodo-shell-//' | sed -e "s/$__deploy_ext__//")
381- mkdir $VERSION_STRING
382- cd packages
383- tar -zcf $DISTRO_FILENAME.tar.gz $DISTRO_FILENAME
384- zip $DISTRO_FILENAME.zip $DISTRO_FILENAME
385- cd ..
386- cp packages/* $VERSION_STRING/
387- sshpass -f "$SSH_EXTERNAL_SERVER_PASSWORD" scp -o StrictHostKeyChecking=no -P $SSH_EXTERNAL_SERVER_PORT -r ./$VERSION_STRING $SSH_EXTERNAL_SERVER_USERNAME@$SSH_EXTERNAL_SERVER_HOST:~/simodo.ru/htdocs/www/distros/simodo-shell/$__deploy_url__
388only:
389- prod
390
391deploy alt:
392extends: .deploy_template
393dependencies:
394- delivery alt
395variables:
396__deploy_ext__: ".run"
397__deploy_url__: "alt/p10/"
398
399deploy ubuntu:
400extends: .deploy_template
401dependencies:
402- delivery ubuntu
403variables:
404__deploy_ext__: ".run"
405__deploy_url__: "ubuntu/jammy/"
406
407deploy windows:
408extends: .deploy_template
409dependencies:
410- delivery windows
411variables:
412__deploy_ext__: ".exe"
413__deploy_url__: "windows/10/"
414
415# Other
416## Пригодится при отладке непрерывной доставки
417
418.remove_utils: &remove_utils
419- rm -rf ../../Qt ../../linuxdeployqt ../../cross /opt/mxe ../../support
420
421.build_deploylinuxqt: &build_deploylinuxqt
422# Сборка linuxdeployqt
423- git clone https://github.com/probonopd/linuxdeployqt.git
424- cd linuxdeployqt
425- qmake && make
426- export PATH=$PWD/bin:$PATH
427- cd ..
428
429.build_ifw_with_static_qt: &build_ifw_with_static_qt
430# Сборка Qt5 из исходников
431- mkdir Qt
432- cd Qt
433- mkdir Qt5-static
434- git clone git://code.qt.io/qt/qt5.git Qt5-source
435- cd Qt5-source
436- git checkout ifw-5.15.2
437- ./init-repository --module-subset=qtbase,qtdeclarative,qttools,qttranslations,qtwayland,qtx11extras
438- sed -i 's/#ifdef __cplusplus/#ifdef __cplusplus\n# include <limits>/' qtbase/src/corelib/global/qglobal.h
439- ./configure -prefix $PWD/../Qt5-static -opensource -confirm-license -release -static -static-runtime -platform linux-clang -accessibility -qt-zlib -qt-libpng -qt-libjpeg -qt-pcre -no-glib -no-cups -no-sql-sqlite -no-qml-debug -no-opengl -no-egl -no-sm -no-icu -nomake examples -nomake tests -no-libudev
440- make -j8 module-qtbase module-qtdeclarative module-qttools module-qttranslations module-qtwayland module-qtx11extras
441- make install
442- cd ../Qt5-static
443- export PATH=$PWD/bin:$PATH
444- cd ../..
445# Сборка IFW из исходников
446- cd Qt
447- git clone https://github.com/qtproject/installer-framework.git QtIFW
448- cd QtIFW
449- echo "CONFIG += libarchive"$'\n' > installerfw.pri.tmp
450- cat installerfw.pri >> installerfw.pri.tmp
451- rm -f installerfw.pri
452- cp installerfw.pri.tmp installerfw.pri
453- qmake && make -j8
454- cd ../..
455- PATH=$(echo $PATH | sed 's/.*Qt5-static\/bin://')
456