-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
378 lines (349 loc) · 10.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
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
---
include:
- project: 'guidog/meta-phosh'
ref: '5e3667e2e4d3f23a5dcadaa2a4aadc8824a9e565'
file: '/ci/phosh-common-jobs.yml'
- project: 'Infrastructure/Mirrors/lorry-mirrors/gitlab_freedesktop_org/freedesktop/ci-templates'
ref: 'b791bd48996e3ced9ca13f1c5ee82be8540b8adb'
file: '/templates/ci-fairy.yml'
stages:
- build
- test+docs
- style-checks
- analyze
- package
- deploy
- triggers
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
# Don't trigger a branch pipeline if there is an open MR
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
default:
# Protect CI infra from rogue jobs
timeout: 15 minutes
# Allow jobs to be caneled on new commits
interruptible: true
# Retry on infra hickups automatically
retry:
max: 1
when:
- 'api_failure'
- 'runner_system_failure'
- 'scheduler_failure'
- 'stuck_or_timeout_failure'
variables:
# For ci-fairy
FDO_UPSTREAM_REPO: World/Phosh/phosh
# screenshot and asan builds on DEBIAN_IMAGE so keep them in sync
IMAGE_VERSION: v0.0.2024-11-04
DEBIAN_IMAGE: $CI_REGISTRY/world/phosh/phosh/debian:$IMAGE_VERSION
SCREENSHOT_IMAGE: $CI_REGISTRY/world/phosh/phosh/screenshot:$IMAGE_VERSION
ASAN_IMAGE: $CI_REGISTRY/world/phosh/phosh/asan:$IMAGE_VERSION
XVFB_RUN: xvfb-run -a -s -noreset
COMMON_BUILD_OPTS: -Db_coverage=true --werror -Dtools=true
ALPINE_EDGE_DEPS: alpine-sdk callaudiod-dev elogind-dev feedbackd-dev gcr-dev git glib-dev gnome-desktop-dev
gtk+3.0-dev libgudev-dev libhandy1-dev gcr-dev libsecret-dev gcovr linux-pam-dev
meson musl-dev networkmanager networkmanager-dev ninja polkit-elogind-dev pulseaudio-dev
upower-dev wayland-dev wayland-protocols ttf-dejavu evolution-data-server-dev evince-dev
libadwaita-dev json-glib-dev gnome-bluetooth-dev modemmanager-dev gmobile-dev gsettings-desktop-schemas
RUST_BINDINGS_BRANCH: main
LIBPHOSH: libphosh-0.44
SID_PKGS: phoc
.trixie_vars: &trixie_vars
variables:
BUILD_OPTS: -Dcallui-i18n=true -Dphoc_tests=enabled ${COMMON_BUILD_OPTS}
.test_before_script: &test_before_script
before_script:
- export DEBIAN_FRONTEND=noninteractive
- |
echo 'ar_AE.UTF-8 UTF-8
de_DE.UTF-8 UTF-8
en_US.UTF-8 UTF-8
ja_JP.UTF-8 UTF-8
uk_UA.UTF-8 UTF-8
' > /etc/locale.gen
- dpkg-reconfigure locales
- apt -y update
- apt -y build-dep .
- if [ -n "$SID_PKGS" ]; then
echo "deb http://deb.debian.org/debian/ sid main" >> /etc/apt/sources.list.d/sid.list;
eatmydata apt-get -y update;
apt -y install $SID_PKGS;
fi
.build_before_script: &build_before_script
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt -y update
- apt -y build-dep .
- if [ -n "$SID_PKGS" ]; then
echo "deb http://deb.debian.org/debian/ sid main" >> /etc/apt/sources.list.d/sid.list;
eatmydata apt-get -y update;
apt -y install $SID_PKGS;
fi
.build_step: &build_step
script:
- 'echo "Build opts: ${BUILD_OPTS}"'
- meson setup ${BUILD_OPTS} _build
- meson compile -C _build
.test_step: &test_step
script:
- export LC_ALL=C.UTF-8
- meson configure ${BUILD_OPTS} _build
- ${XVFB_RUN} meson test --print-errorlogs -C _build --suite tools
- ${XVFB_RUN} meson test --print-errorlogs -C _build --suite unit
- ${XVFB_RUN} meson test --print-errorlogs -C _build --suite lint
- ${XVFB_RUN} meson test --print-errorlogs -C _build --suite integration
after_script:
- gcovr --json --gcov-ignore-errors=no_working_dir_found --output=coverage-${CI_JOB_NAME}.json
# Sanity checks of MR settings and commit logs
commit-log-check:
extends:
- .fdo.ci-fairy
stage: style-checks
variables:
GIT_DEPTH: "100"
needs: []
script: |
ci-fairy check-commits --junit-xml=commit-message-junit-report.xml
artifacts:
reports:
junit: commit-message-junit-report.xml
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH'
build:native-debian-trixie:
stage: build
image: ${DEBIAN_IMAGE}
<<: *build_before_script
<<: *trixie_vars
<<: *build_step
artifacts:
paths:
- _build
build:lib-debian-trixie:
stage: build
image: ${DEBIAN_IMAGE}
variables:
BUILD_OPTS: --werror -Dtests=false -Dtools=false -Dbindings-lib=true
<<: *build_before_script
script:
- meson setup ${BUILD_OPTS} _build
- meson compile -C _build
- meson install -C _build
- "gcc -Wall -O2 $(pkgconf --cflags $LIBPHOSH) .gitlab-ci/libphosh-test.c $(pkgconf --libs $LIBPHOSH)"
artifacts:
paths:
- _build
unit-test:native-debian-trixie:
stage: test+docs
image: ${DEBIAN_IMAGE}
needs:
- build:native-debian-trixie
<<: *trixie_vars
<<: *test_before_script
<<: *test_step
artifacts:
when: always
paths:
- _build
- coverage-*.json
asan-test:native-debian-trixie:
stage: test+docs
image: ${ASAN_IMAGE}
tags: [asan]
needs: []
<<: *trixie_vars
<<: *test_before_script
script:
- meson setup -Dphoc_tests=enabled -Dtools=false -Db_sanitize=address -Dbuildtype=debug _build-asan
- meson compile -C _build-asan ./data/glib-compile-schemas:custom
- ${XVFB_RUN} meson test --print-errorlogs -C _build-asan --suite unit --timeout-multiplier 5
allow_failure: true
screenshot:native-debian-trixie:
stage: test+docs
image: ${SCREENSHOT_IMAGE}
needs:
- build:native-debian-trixie
<<: *test_before_script
<<: *trixie_vars
script:
- export LC_ALL=C.UTF-8
- export G_MESSAGES_DEBUG=all
# Make sure tests can find the plugins and po files
- "meson install -C _build"
- ${XVFB_RUN} meson test -C _build --print-errorlogs --suite screenshots
- tools/montage-screenshots _build/
- mv _build/tests/screenshots/* screenshots/
after_script:
- gcovr --json --gcov-ignore-errors=no_working_dir_found --output=screenshots/coverage-${CI_JOB_NAME}.json
artifacts:
when: always
expose_as: 'Screenshots'
paths:
- screenshots/
- _build/meson-logs/testlog.txt
integration:native-debian-trixie:
stage: test+docs
image: ${DEBIAN_IMAGE}
needs:
- build:native-debian-trixie
<<: *test_before_script
<<: *trixie_vars
script:
- export LC_ALL=C.UTF-8
- export G_MESSAGES_DEBUG=all
- export NO_AT_BRIDGE=1
- export TOPSRCDIR="${PWD}"
- export TOPBUILDDIR="${PWD}/_build"
# Make sure tests can find the plugins and po files
- "meson install -C _build"
- ${XVFB_RUN} dbus-run-session pytest --junitxml=report-integration-${CI_JOB_NAME}.xml -v tests/integration
after_script:
- gcovr --json --gcov-ignore-errors=no_working_dir_found --output=coverage-integration-${CI_JOB_NAME}.json
artifacts:
paths:
- coverage-integration-${CI_JOB_NAME}.json
- report-integration-${CI_JOB_NAME}.xml
reports:
junit: report-integration-${CI_JOB_NAME}.xml
build-doc:
stage: test+docs
image: ${DEBIAN_IMAGE}
variables:
BUILD_OPTS: -Dtools=false -Dtests=false -Dgtk_doc=true
<<: *build_before_script
needs: []
script:
- git clean -dfx
- 'echo "Build opts: ${BUILD_OPTS}"'
- meson setup ${BUILD_OPTS} _build
- meson compile -C _build
- mv _build/docs/phosh-0/ _reference/
artifacts:
paths:
- _reference
check-po:
stage: test+docs
extends: .phosh-check-po
check-license-headers:
stage: test+docs
image: ${DEBIAN_IMAGE}
<<: *trixie_vars
needs: []
script:
# Checks .c and .h files begin with a license header as
# defined in HACKING.md
- ./tools/check-license-headers.py
release-tarball:
stage: test+docs
extends: .phosh-check-dist
variables:
MESON_DIST_OPTIONS: --no-tests
build:native-alpinelinux-edge:
stage: build
image: alpine:edge
allow_failure: true
before_script:
- echo "https://alpine.global.ssl.fastly.net/alpine/edge/testing" >> /etc/apk/repositories
- apk add $ALPINE_EDGE_DEPS
artifacts:
paths:
- _build
script:
- meson setup --werror -Dphoc_tests=disabled _build
- meson compile -C _build
unit-test:native-alpinelinux-edge:
stage: test+docs
image: alpine:edge
allow_failure: true
needs:
- build:native-alpinelinux-edge
before_script:
- echo "https://alpine.global.ssl.fastly.net/alpine/edge/testing" >> /etc/apk/repositories
- apk add xvfb-run $ALPINE_EDGE_DEPS
script:
- export LC_ALL=C.UTF-8
- ${XVFB_RUN} meson test -C _build --suite unit
artifacts:
when: always
paths:
- _build
when: manual
check-consistency:
stage: test+docs
extends: .phosh-check-consistency
check-markdown:
stage: style-checks
extends: .phosh-check-markdown
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
paths:
- "*.md"
- "docs/*.md"
check-style:
stage: style-checks
extends: .phosh-format-check
allow_failure: true
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
coverage:
image: ${DEBIAN_IMAGE}
stage: analyze
script:
- mkdir coverage-report
- gcovr --add-tracefile 'coverage-*.json'
--add-tracefile 'screenshots/coverage-*.json'
--html-details --print-summary --output coverage-report/index.html
- gcovr --add-tracefile 'coverage-*.json'
--add-tracefile 'screenshots/coverage-*.json'
--xml --output coverage-report/coverage.xml
artifacts:
expose_as: 'Coverage Report'
paths:
- coverage-report
- coverage-report/index.html
reports:
coverage_report:
coverage_format: cobertura
path: coverage-report/coverage.xml
coverage: '/^lines: (\d+\.\d+\%)/'
needs:
- unit-test:native-debian-trixie
- screenshot:native-debian-trixie
- integration:native-debian-trixie
package:deb-debian-trixie:arm64:
stage: package
variables:
PHOSH_DOCKER_IMAGE: debian:trixie
DEB_BUILD_PROFILES: "nodoc nocheck"
DEB_BUILD_OPTIONS: nocheck
extends: .phosh-build-debian-package
tags:
- aarch64
pages:
stage: deploy
needs:
- build-doc
script:
- mv _reference/ public/
artifacts:
paths:
- public
only:
- main
rust-bindings:
stage: triggers
variables:
UPSTREAM_BRANCH: $CI_COMMIT_REF_NAME
needs: []
trigger:
project: guidog/libphosh-rs
branch: $RUST_BINDINGS_BRANCH
rules:
- if: $CI_COMMIT_BRANCH == $RUST_BINDINGS_BRANCH
changes:
- src/**/*