forked from GNOME/gnome-control-center
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
387 lines (339 loc) · 9.94 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
include:
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/145b1bc7ef1702d2bd71584010d7113c6786a506/templates/fedora.yml'
variables:
FDO_UPSTREAM_REPO: gnome/gnome-control-center
stages:
- prepare
- build
- test
- manual
- deploy
.Build Logs: &build_logs
name: build_logs
when: always
paths:
- ./*.log
- _build/meson-logs/
.Build Output: &build_output
artifacts:
name: build_output
when: always
paths:
- ./*.log
- _build/
expire_in: 3h30min
.Show Info: &environment_information
build-aux/ci/ci-helper.sh "INFO" &&
build-aux/ci/ci-helper.sh "GIT_INFO"
.Build Procedure: &build_procedure
echo "== Building ==" &&
meson setup _build ${BUILD_OPTS} -Dprofile=development &&
meson compile -C _build 2>&1 | tee compilation.log
.Run Tests: &run_tests
export GSK_RENDERER=ngl &&
echo "== Testing ==" &&
meson test -C _build --verbose --no-stdsplit --no-rebuild
.fedora.container.common:
variables:
# When branching a stable release, change 'main' to the
# release branch name to ensure that a new image will
# be created, tailored for the stable branch.
# Should probably also switch away from 'rawhide',
# to stable fedora branch as well.
BRANCH_NAME: 'main'
CONTAINER_TAG: '2024-07-09.0'
FEDORA_VERSION: rawhide
# Derive FDO variables from this automatically.
# DO NOT edit, instead change the variables above
FDO_REPO_SUFFIX: '${BRANCH_NAME}'
FDO_DISTRIBUTION_TAG: '${CONTAINER_TAG}-fedora-${FEDORA_VERSION}'
FDO_DISTRIBUTION_VERSION: '${FEDORA_VERSION}'
#############################################
# Create CI Docker Images #
#############################################
# See also https://gitlab.freedesktop.org/freedesktop/ci-templates
build.container.fedora@x86_64:
extends:
- '.fdo.container-build@fedora'
- '.fedora.container.common'
stage: 'prepare'
variables:
# no need to pull the whole tree for rebuilding the image
GIT_STRATEGY: none
# Expiry sets fdo.expires on the image
FDO_EXPIRES_AFTER: 8w
# NOTES:
# - most packages are needed for testing
# - glibc-langpack-en is needed for sorting in run-style-check-diff.sh
# - libsass-devel, sassc are often needed for building libadwaita, gtk, etc.
FDO_DISTRIBUTION_PACKAGES: >-
dnf5-plugins
git
llvm clang libasan libtsan libubsan compiler-rt gcovr
meson
clang-tools-extra
glibc-langpack-en
python3-dbusmock
xorg-x11-server-Xvfb
mesa-dri-drivers
libsass-devel sassc
FDO_DISTRIBUTION_EXEC: |-
dnf builddep -y gnome-control-center && \
dnf builddep -y gsettings-desktop-schemas && \
git clone --depth 1 https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas.git && \
cd gsettings-desktop-schemas && \
meson setup _build --prefix=/usr && \
meson compile -C _build && \
meson install -C _build && \
cd .. && \
dnf builddep -y gnome-settings-daemon && \
git clone --depth 1 https://gitlab.gnome.org/GNOME/gnome-settings-daemon.git && \
cd gnome-settings-daemon && \
meson setup _build --prefix=/usr && \
meson compile -C _build && \
meson install -C _build && \
cd .. && \
dnf builddep -y gtk4 && \
git clone --depth 1 https://gitlab.gnome.org/GNOME/gtk.git && \
cd gtk && \
meson setup _build --prefix=/usr && \
meson compile -C _build && \
meson install -C _build && \
cd .. && \
dnf builddep -y libadwaita && \
git clone --depth 1 https://gitlab.gnome.org/GNOME/libadwaita.git && \
cd libadwaita && \
meson setup _build --prefix=/usr -Dtests=false -Dexamples=false && \
meson compile -C _build && \
meson install -C _build && \
cd .. && \
git clone --depth 1 https://gitlab.gnome.org/GNOME/gnome-online-accounts.git && \
cd gnome-online-accounts && \
meson setup _build --prefix=/usr -Dfedora=true && \
meson compile -C _build && \
meson install -C _build && \
cd .. && \
dnf remove -y systemtap-runtime
##
# Stage: Build
#
# Checks if GNOME Control Center is properly building and installing. This is the
# most important stage of the CI, and no MR should ever be merged if it breaks
# any of them.
##
build:
extends:
- '.fdo.suffixed-image@fedora'
- '.fedora.container.common'
stage: build
script:
- *environment_information
- *build_procedure
- echo "== Installing =="
- meson install -C _build
- echo "== Report =="
- build-aux/ci/ci-helper.sh "WARNINGS"
<<: *build_output
except:
variables:
- $CI_PIPELINE_SOURCE == "schedule"
# Same as build but with various off-by-default options enabled
conditional builds:
extends:
- build
artifacts:
# Only save build logs for these
<<: *build_logs
parallel:
matrix:
- BUILD_OPTS: '-Dmalcontent=true'
- BUILD_OPTS: '-Ddocumentation=true'
##
# Stage: Test
#
# Runs static checks.
# Runs the unit tests.
##
style-check-diff:
extends:
- '.fdo.suffixed-image@fedora'
- '.fedora.container.common'
needs:
- build.container.fedora@x86_64
stage: test
when: always
allow_failure: true
script:
- .gitlab-ci/run-style-check-diff.sh
check-potfiles:
extends:
- '.fdo.suffixed-image@fedora'
- '.fedora.container.common'
needs:
- build.container.fedora@x86_64
stage: test
when: always
variables:
GIT_SUBMODULE_STRATEGY: normal
script:
- .gitlab-ci/check-potfiles.sh
test:
extends:
- '.fdo.suffixed-image@fedora'
- '.fedora.container.common'
stage: test
needs:
- build
script:
- *environment_information
- *run_tests
- |
if [[ -n "${CI_COMMIT_TAG}" ]]; then
echo "== Distro Test =="
meson dist -C _build
fi
artifacts:
<<: *build_logs
reports:
junit: '_build/meson-logs/testlog.junit.xml'
except:
variables:
- $CI_PIPELINE_SOURCE == "schedule"
- $CI_COMMIT_TITLE =~ /^Update.*translation$/
# Runs the coverage test.
coverage:
extends:
- '.fdo.suffixed-image@fedora'
- '.fedora.container.common'
dependencies:
- build.container.fedora@x86_64
stage: test
variables:
BUILD_OPTS: "-Db_coverage=true"
coverage: '/^Lines:.\d+.\d+.(\d+\.\d+\%)/'
only:
- main@GNOME/gnome-control-center
script:
- *environment_information
- *build_procedure
- *run_tests
- ninja -C _build coverage-html
# Parse the report to get the coverage result
- |
echo == Coverage ==
sed -e 's/<[^>]*>//g' _build/meson-logs/coveragereport/index.html | tr -d ' \t' | grep -A3 -P '^Lines:$' | tr '\n' ' '; echo
artifacts:
<<: *build_logs
except:
variables:
- $CI_PIPELINE_SOURCE == "schedule"
- $CI_COMMIT_TITLE =~ /^Update.*translation$/
##
# Stage: Deploy
#
# Publishes the Coverage Report generated above
##
pages:
extends:
- '.fdo.suffixed-image@fedora'
- '.fedora.container.common'
stage: deploy
dependencies:
- coverage
script:
- mv _build/meson-logs/coveragereport/ public/
artifacts:
paths:
- public
only:
- main@GNOME/gnome-control-center
except:
variables:
- $CRON_TASK == "BUILD_CI_IMAGES"
- $CI_COMMIT_TITLE =~ /^Update.*translation$/
##
# Stage: Manual
#
# Creates a flatpak
##
flatpak:
stage: manual
image: quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master
artifacts:
name: package
paths:
- $(pwd)/*.flatpak
expire_in: 7 days
variables:
OLD_APPID: "org.gnome.Settings"
APPID: "org.gnome.Settings.Devel"
BUNDLE: "org.gnome.Settings.Devel.flatpak"
MANIFEST_PATH: "build-aux/flatpak/org.gnome.Settings.Devel.json"
PROJECT_ID: "org.gnome.Settings"
PROJECT_NAME: "gnome-control-center.git"
RUNTIME_REPO: "https://sdk.gnome.org/gnome-nightly.flatpakrepo"
script:
- echo "== Flatpak packaging =="
# Make it a develoment manifest
- sed -i -n "p; s/$PROJECT_NAME//p" ${MANIFEST_PATH}
- >
sed -i "s,\"app-id\" : \"$PROJECT_ID\",\"app-id\" : \"<<ID>>\",g" ${MANIFEST_PATH}
- >
sed -i "s,\"url\" : \"https://gitlab.gnome.org/GNOME/$PROJECT_NAME\",\"branch\" : \"<<current>>\"\,,g" ${MANIFEST_PATH}
- >
sed -i "s,\"url\" : \"https://gitlab.gnome.org/GNOME/\",\"path\" : \".\",g" ${MANIFEST_PATH}
# Adjust the manifest to HEAD
- sed -i "s,<<ID>>,$APPID,g" ${MANIFEST_PATH}
- sed -i "s,<<current>>,origin/$CI_COMMIT_REF_NAME,g" ${MANIFEST_PATH}
# Update the icon name
- mv data/icons/hicolor/scalable/apps/$OLD_APPID.svg data/icons/hicolor/scalable/apps/$APPID.svg
- mv data/icons/hicolor/symbolic/apps/$OLD_APPID-symbolic.svg data/icons/hicolor/symbolic/apps/$APPID-symbolic.svg
- flatpak-builder --bundle-sources --disable-rofiles-fuse --repo=devel build ${MANIFEST_PATH}
- flatpak build-bundle devel ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APPID}
cache:
paths:
- .flatpak-builder/cache
when: manual
except:
- tags
- gnome-3-.*
- main@GNOME/gnome-control-center
# Runs the sanitizers [address, thread, undefined, and memory].
.sanitizer: &sanitizer
extends:
- '.fdo.suffixed-image@fedora'
- '.fedora.container.common'
dependencies:
- build.container.fedora@x86_64
stage: manual
when: manual
script:
- *environment_information
- *build_procedure
- *run_tests
artifacts:
<<: *build_logs
except:
variables:
- $CI_PIPELINE_SOURCE == "schedule"
- $CI_COMMIT_TITLE =~ /^Update.*translation$/
asan:
<<: *sanitizer
# ASAN requires debugging capabilities
tags: [ asan ]
variables:
BUILD_OPTS: "-Db_sanitize=address"
LSAN_OPTIONS: "suppressions=${CI_PROJECT_DIR}/build-aux/ci/lsan.supp"
tsan:
<<: *sanitizer
variables:
BUILD_OPTS: "-Db_sanitize=thread"
ubsan:
<<: *sanitizer
variables:
BUILD_OPTS: "-Db_sanitize=undefined"
msan:
<<: *sanitizer
variables:
BUILD_OPTS: "-Db_sanitize=memory"
CC: "clang"