-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
272 lines (252 loc) · 7.4 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
image: registry.gitlab.com/technic93/e2designer:latest
# To run tests with local image use
# gitlab-runner exec docker --docker-pull-policy="if-not-present" --docker-privileged <command>
variables:
UBUNTU_IMAGE: registry.gitlab.com/technic93/e2designer:latest
FLATPAK_IMAGE: registry.gitlab.com/technic93/e2designer:flatpak
BINTRAY_USER: technic
BINTRAY_REPO: e2designer
BINTRAY_PACKAGE: e2designer
BINTRAY_URL: https://api.bintray.com/content/technic/e2designer/e2designer
APP_NAME: io.github.technic.e2designer
CODE_CHECKER_VER: v6.14.0
CLAZY_VER: "1.6"
stages:
- images
- build
- tasks
- deploy
.docker:
stage: images
image: docker:git
services:
- docker:dind
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
image:qt:
extends: .docker
script:
- docker build docker/qt --pull -t $UBUNTU_IMAGE
- docker push $UBUNTU_IMAGE
only:
changes:
- docker/qt/**/*
image:flatpak:
extends: .docker
script:
- docker build docker/flatpak --pull -t $FLATPAK_IMAGE
- docker push $FLATPAK_IMAGE
only:
changes:
- docker/flatpak/**/*
format:
stage: build
before_script:
- apt-get update && apt-get install -y python3-pip
- pip3 install cmakelint
- clang-format --version
- cmakelint --version
script:
- clang-format -style=file -i
$(find . \( -path './Qt-Color-Widgets' -o -path './AppImageUpdaterBridge' \) -prune -o
\( -name '*.hpp' -o -name '*.cpp' \) -print)
- git diff --exit-code
- cmakelint --linelength=100 CMakeLists.txt
doxygen:
stage: build
before_script:
- doxygen --version
script:
- doxygen
artifacts:
paths:
- doxygen/html/
before_script:
- . /opt/qt${Qt}/bin/qt${Qt}-env.sh
- which qmake
- qmake --version
- which cmake
- cmake --version
- gcc --version
- g++ --version
- clang++ --version
- mkdir -p ccache
- export CCACHE_BASEDIR=${PWD}
- export CCACHE_DIR=${PWD}/ccache
- ccache -sz
- export VERSION=$(git describe)
- cat /proc/cpuinfo
build:release:
stage: build
script:
- mkdir -p build && pushd build
- cmake -DCMAKE_BUILD_TYPE=Release ..
- cmake --build .
- cmake --install . --prefix $(pwd)/appdir/usr
- ccache -s
artifacts:
paths:
- build/
cache:
key: ${CI_JOB_NAME}
paths:
- ccache/
build:debug:
stage: build
script:
- mkdir -p build && pushd build
- CXXFLAGS="--coverage" cmake -DCMAKE_BUILD_TYPE=Debug ..
- cmake --build .
- ccache -s
artifacts:
paths:
- build/
cache:
key: ${CI_JOB_NAME}
paths:
- ccache/
build:clang:
stage: build
script:
- mkdir -p build && pushd build
- CXX="clang++" CXXFLAGS="-fcolor-diagnostics" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
- cmake --build .
- sed -e 's/"c++ /"clang++ /' -i compile_commands.json
- ccache -s
artifacts:
paths:
- build/
cache:
key: ${CI_JOB_NAME}
paths:
- ccache/
CodeChecker:
stage: tasks
needs:
- job: build:clang
artifacts: true
script:
- add-apt-repository -y ppa:deadsnakes/ppa
- apt-get update && apt-get install -y python3.7 python3.7-venv python3.7-dev
- update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 100
- apt-get install -y build-essential thrift-compiler virtualenv python3-setuptools python3-virtualenv
- curl -sL https://deb.nodesource.com/setup_12.x | bash
- apt-get install -y nodejs
- git clone https://github.com/Ericsson/CodeChecker.git -b "$CODE_CHECKER_VER" --depth 1 ~/codechecker
- cd ~/codechecker && make venv && source "$PWD/venv/bin/activate"
- BUILD_LOGGER_64_BIT_ONLY=YES make package && export PATH="$PWD/build/CodeChecker/bin:$PATH"
- cd "$CI_PROJECT_DIR" && pushd build
- CodeChecker analyze compile_commands.json -o ./reports
- CodeChecker parse ./reports -e html -o ../reports_html
artifacts:
paths:
- reports_html/
AppImage:
stage: tasks
needs:
- job: build:release
artifacts: true
script:
- pushd build
- find appdir
- curl -fsSL -o linuxdeployqt https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
- chmod a+x linuxdeployqt
- curl -fsSL -o appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
- chmod a+x appimagetool
- ./linuxdeployqt appdir/usr/share/applications/e2designer.desktop -bundle-non-qt-libs
-extra-plugins=iconengines,imageformats
- ./appimagetool -n --bintray-user $BINTRAY_USER --bintray-repo $BINTRAY_REPO -v appdir
artifacts:
paths:
- build/*.AppImage
- build/*.AppImage.zsync
clazy:
stage: tasks
needs:
- job: build:clang
artifacts: true
script:
- curl -L -o /usr/local/bin/clazy "https://downloads.kdab.com/clazy/$CLAZY_VER/Clazy-x86_64-$CLAZY_VER.AppImage"
- chmod a+x /usr/local/bin/clazy
- pushd build
- export CLAZY_IGNORE_DIRS="/opt/qt${Qt}|.*/Qt-Color-Widgets"
- find .. -name '*.hpp' -o -name '*.cpp' | xargs clazy --standalone -p compile_commands.json
when: manual
PVS-Studio:
stage: tasks
needs:
- job: build:clang
artifacts: true
script:
- pushd build
- pvs-studio-analyzer credentials $PVS_NAME $PVS_KEY
- pvs-studio-analyzer analyze -o PVS-Studio.log
- plog-converter -t fullhtml PVS-Studio.log -o ../PVS-Studio.html
artifacts:
paths:
- PVS-Studio.html
when: manual
test:
stage: tasks
needs:
- job: build:release
artifacts: true
script:
- pushd build
- QT_QPA_PLATFORM=offscreen ctest
coverage:
stage: tasks
needs:
- job: build:debug
artifacts: true
script:
- pushd build
- QT_QPA_PLATFORM=offscreen ctest
- popd
- lcov --no-external --directory . --capture --output-file coverage.info
- lcov --remove coverage.info "moc_*" "*.moc" "qrc_*" "tests/*" --output-file coverage.info
- lcov --list coverage.info
- genhtml coverage.info --output-directory coverage-report
- bash <(curl -s https://codecov.io/bash) -f coverage.info
coverage: '/Total:\|(\d+\.?\d+\%)/'
artifacts:
paths:
- coverage-report/
flatpak:
image: $FLATPAK_IMAGE
stage: build
only:
- master
before_script:
- flatpak --version
- flatpak-builder --version
script:
- flatpak run org.freedesktop.appstream-glib validate misc/e2designer.appdata.xml
- desktop-file-validate misc/e2designer.desktop
- cat $APP_NAME.yaml | yaml2json.py > $APP_NAME.json
- flatpak-builder --ccache --repo=flatpak-repo flatpak-build $APP_NAME.json
- flatpak-builder --env=QT_QPA_PLATFORM=offscreen --run flatpak-build $APP_NAME.json e2designer -h
- flatpak build-bundle flatpak-repo e2designer.flatpak $APP_NAME
artifacts:
paths:
- "*.flatpak"
deploy:
stage: deploy
only:
- master
needs:
- job: AppImage
artifacts: true
- job: flatpak
artifacts: true
- test
- coverage
script:
- curl -T build/e2designer-$VERSION-x86_64.AppImage -u technic:$BINTRAY_API_KEY
$BINTRAY_URL/$VERSION/e2designer-$VERSION-x86_64.AppImage
- curl -T build/e2designer-$VERSION-x86_64.AppImage.zsync -u technic:$BINTRAY_API_KEY
$BINTRAY_URL/$VERSION/e2designer-$VERSION-x86_64.AppImage.zsync
- curl -T e2designer.flatpak -u technic:$BINTRAY_API_KEY
$BINTRAY_URL/$VERSION/e2designer-$VERSION.flatpak
- python3 bintray.py