-
Notifications
You must be signed in to change notification settings - Fork 27
/
.gitlab-ci.yml
526 lines (488 loc) · 13.5 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
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
# SPDX-FileCopyrightText: 2017 Claudio André <[email protected]>
---
include:
- remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/b791bd48996e3ced9ca13f1c5ee82be8540b8adb/templates/alpine.yml'
stages:
- prepare
- source_check
- test
- thorough_tests
- manual
- deploy
.gjs-alpine:
variables:
FDO_DISTRIBUTION_TAG: '2024-07-28.0'
FDO_UPSTREAM_REPO: GNOME/gjs
build-alpine-image:
extends:
- .fdo.container-build@alpine@x86_64
- .gjs-alpine
stage: prepare
variables:
FDO_DISTRIBUTION_PACKAGES: |
bash cppcheck git grep npm py3-codespell python3 reuse
FDO_DISTRIBUTION_EXEC: |
mkdir -p /cwd &&
apk add cpplint \
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
.coverage: &coverage
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128-debug
variables:
GIT_SUBMODULE_STRATEGY: normal
coverage: '/^ lines.*(\d+\.\d+\%)/'
script:
- export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
- 'export DISPLAY="${DISPLAY:-:0}"'
# This script runs the build inside its own build tree and generates the
# coverage report
- xvfb-run -a tools/run_coverage.sh
artifacts:
name: log_coverage
when: always
reports:
junit: _coverage_build/meson-logs/testlog*.junit.xml
expose_as: 'Coverage Report'
paths:
- _coverage/html/index.html
- _coverage/html
- _coverage_build/meson-logs
.build: &build
when: on_success
artifacts:
reports:
junit: _build/meson-logs/testlog*.junit.xml
name: log
when: always
paths:
- _build/compile_commands.json
- _build/installed-tests/js/jsunit-resources.c
- _build/installed-tests/js/jsunit-resources.h
- _build/js-resources.c
- _build/js-resources.h
- _build/meson-logs/*log*.txt
- _build/test/mock-js-resources.c
- _build/test/mock-js-resources.h
script:
- test/test-ci.sh SETUP
- test/test-ci.sh BUILD
#############################################
# Regular tests #
#############################################
# Test despite any changes in the Docker image
# SpiderMonkey has been configured with --enable-debug
build_recommended:
<<: *build
stage: source_check
image: registry.gitlab.gnome.org/gnome/gjs:job-4161430_fedora.mozjs128-debug # pinned on purpose
variables:
GIT_SUBMODULE_STRATEGY: normal
TEST_OPTS: --verbose --no-stdsplit --print-errorlogs --setup=verbose
except:
- schedules
sanitizer_gcc:
<<: *build
stage: test
tags:
- asan # LSAN needs CAP_SYS_PTRACE
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128-debug
variables:
GIT_SUBMODULE_STRATEGY: normal
CONFIG_OPTS: -Db_sanitize=address,undefined
TEST_OPTS: --timeout-multiplier=3
# Override these during build, but they are overridden by meson anyways
ASAN_OPTIONS: start_deactivated=true,detect_leaks=0
except:
- schedules
sanitizer_thread_gcc:
<<: *build
stage: manual
when: manual
allow_failure: true
tags:
- asan # TSAN needs CAP_SYS_PTRACE
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128-debug
variables:
GIT_SUBMODULE_STRATEGY: normal
CONFIG_OPTS: -Db_sanitize=thread
TEST_OPTS: --timeout-multiplier=3 --setup=verbose
except:
- schedules
# There are a lot of debug log statements that are ifdef'd out in normal usage.
# These sometimes get invalid expressions in them, leading to annoyance the
# next time you try to use debug logging.
build_maximal:
when: on_success
stage: test
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128-debug
variables:
GIT_SUBMODULE_STRATEGY: normal
CC: clang
CXX: clang++
CONFIG_OPTS: >-
-Ddtrace=true -Dsystemtap=true -Dverbose_logs=true -Db_pch=false
ENABLE_GTK: "yes"
except:
- schedules
script:
- test/test-ci.sh SETUP
- test/test-ci.sh BUILD
- test/test-ci.sh SH_CHECKS
artifacts:
reports:
junit: _build/meson-logs/testlog*.junit.xml
name: log
when: always
paths:
- _build/compile_commands.json
- _build/meson-logs/*log*.txt
- scripts.log
build_minimal:
<<: *build
stage: test
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128
variables:
GIT_SUBMODULE_STRATEGY: normal
CONFIG_OPTS: -Dbuildtype=release -Dreadline=disabled -Dprofiler=disabled
TEST_OPTS: --setup=verbose
except:
- schedules
build_unity:
<<: *build
stage: test
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128
variables:
GIT_SUBMODULE_STRATEGY: normal
# unity-size here is forced to use an high number to check whether we can
# join all the sources together, but should not be used in real world to
# not to break multi-jobs compilation
CONFIG_OPTS: >-
-Dprofiler=disabled
--unity on --unity-size=10000
TEST_OPTS: --setup=verbose
except:
- schedules
# Generates
# The Code Coverage Report
coverage-automatic:
<<: *coverage
when: on_success
stage: source_check
except:
- schedules
only:
refs:
- master@GNOME/gjs
# Publishes
# The code coverage report
pages:
stage: deploy
dependencies:
- coverage-automatic
script:
- mv $(pwd)/_coverage/html/ public/ || true
artifacts:
paths:
- public
only:
refs:
- master@GNOME/gjs
except:
variables:
- $CRON_TASK == "BUILD_CI_IMAGES"
#############################################
# Static Analyzers #
#############################################
cppcheck:
when: on_success
extends:
- .fdo.distribution-image@alpine
- .gjs-alpine
stage: test # so that we have compile_commands.json and generated C files
script:
- cppcheck --version
# Create fake g-i test files, we are not analyzing them anyway
- mkdir -p subprojects/gobject-introspection-tests
- |
touch \
subprojects/gobject-introspection-tests/annotation.{c,h} \
subprojects/gobject-introspection-tests/drawable.{c,h} \
subprojects/gobject-introspection-tests/foo.{c,h} \
subprojects/gobject-introspection-tests/gimarshallingtests.{c,h} \
subprojects/gobject-introspection-tests/regress.{c,h} \
subprojects/gobject-introspection-tests/regress-unix.{c,h} \
subprojects/gobject-introspection-tests/warnlib.{c,h} \
subprojects/gobject-introspection-tests/utility.{c,h}
- ./tools/run_cppcheck.sh -q
except:
refs:
- schedules
- tags
variables:
- $CI_COMMIT_MESSAGE =~ /\[skip cppcheck\]/
only:
changes:
- "**/*.c"
- "**/*.cpp"
- "**/*.h"
- "**/*.hh"
cpplint:
when: on_success
stage: source_check
extends:
- .fdo.distribution-image@alpine
- .gjs-alpine
script:
- cpplint --version
- test/test-ci.sh CPPLINT
except:
refs:
- schedules
- tags
variables:
- $CI_COMMIT_MESSAGE =~ /\[skip cpplint\]/
only:
changes:
- "**/*.cpp"
- "**/*.h"
- "**/*.hh"
eslint:
when: on_success
extends:
- .fdo.distribution-image@alpine
- .gjs-alpine
stage: source_check
script:
- ./tools/run_eslint.sh --version
- ./tools/run_eslint.sh
except:
refs:
- schedules
- tags
variables:
- $CI_COMMIT_MESSAGE =~ /\[skip eslint\]/
only:
changes:
- "**/*.js"
- .eslintignore
- .eslintrc.yml
- '**/.eslintrc.yml'
headers_check:
when: on_success
stage: source_check
extends:
- .fdo.distribution-image@alpine
- .gjs-alpine
script:
- env SELFTEST=1 test/check-pch.sh
- env SELFTEST=1 test/check-headers.sh
- test/check-pch.sh
- test/check-headers.sh
except:
refs:
- schedules
- tags
variables:
- $CI_COMMIT_MESSAGE =~ /\[skip headers_check\]/
only:
changes:
- "**/*.c"
- "**/*.cpp"
- "**/*.h"
- "**/*.hh"
- test/check-pch.sh
- test/check-headers.sh
iwyu:
when: on_success
stage: source_check
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128-debug
variables:
GIT_SUBMODULE_STRATEGY: normal
script:
- test/test-ci.sh UPSTREAM_BASE
- meson setup _build -Db_pch=false
- include-what-you-use --version
- ./tools/run_iwyu.sh ci-upstream-base
only:
refs:
- branches
except:
refs:
- schedules
- /^gnome-[-\d]+$/
variables:
- $CI_COMMIT_MESSAGE =~ /\[skip iwyu\]/
codespell:
when: on_success
extends:
- .fdo.distribution-image@alpine
- .gjs-alpine
stage: source_check
script:
- codespell --version
- |
codespell -S "*.png,*.po,*.jpg,*.wrap,.git,LICENSES" -f \
--builtin "code,usage,clear" \
--skip="./build/maintainer-upload-release.sh,./installed-tests/js/jasmine.js,./README.md,./build/flatpak/*.json,./tools/package-lock.json,./modules/internal/source-map/*" \
--ignore-words-list="aas,afterall,deque,falsy,files',filetest,gir,inout,musl,nmake,stdio,uint,upto,ws,xdescribe"
except:
- schedules
license-check:
when: on_success
stage: source_check
extends:
- .fdo.distribution-image@alpine
- .gjs-alpine
script:
- reuse --version
- reuse lint
except:
- schedules
#############################################
# Manual Jobs #
#############################################
# Planned as daily
coverage:
<<: *coverage
stage: manual
when: manual
except:
- schedules
iwyu-full:
when: manual
stage: manual
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128-debug
variables:
GIT_SUBMODULE_STRATEGY: normal
script:
- meson setup _build
- ./tools/run_iwyu.sh
except:
- schedules
sanitizer_clang:
<<: *build
stage: manual
tags:
- asan # LSAN needs CAP_SYS_PTRACE
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128-debug
variables:
GIT_SUBMODULE_STRATEGY: normal
CC: clang
CXX: clang++
# Override these during build, but they are overridden by meson anyways
ASAN_OPTIONS: start_deactivated=true,detect_leaks=0
CONFIG_OPTS: -Db_sanitize=address,undefined -Db_lundef=false
TEST_OPTS: --timeout-multiplier=3 --setup=verbose
when: manual
except:
- schedules
installed_tests:
<<: *build
stage: manual
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128-debug
variables:
GIT_SUBMODULE_STRATEGY: normal
CONFIG_OPTS: -Dinstalled_tests=true -Dprefix=/usr
TEST: skip
when: manual
except:
- schedules
script:
- test/test-ci.sh SETUP
- test/test-ci.sh BUILD
- sudo ninja -C _build install
- xvfb-run -a dbus-run-session -- gnome-desktop-testing-runner gjs
valgrind:
<<: *build
stage: manual
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128-debug
variables:
GIT_SUBMODULE_STRATEGY: normal
TEST_OPTS: --setup=valgrind
allow_failure: true
when: manual
except:
- schedules
# SpiderMonkey GC Tests (weekly)
zeal_2:
<<: *build
stage: manual
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128-debug
variables:
GIT_SUBMODULE_STRATEGY: normal
TEST_OPTS: --setup=extra_gc
when: manual
except:
- schedules
zeal_4:
<<: *build
stage: manual
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128-debug
variables:
GIT_SUBMODULE_STRATEGY: normal
TEST_OPTS: --setup=pre_verify
when: manual
except:
- schedules
zeal_11:
<<: *build
stage: manual
image: registry.gitlab.gnome.org/gnome/gjs:fedora.mozjs128-debug
variables:
GIT_SUBMODULE_STRATEGY: normal
TEST_OPTS: --setup=post_verify
when: manual
except:
- schedules
#############################################
# Create CI Docker Images #
#############################################
.Docker image template: &create_docker_image
image: quay.io/freedesktop.org/ci-templates:container-build-base-2023-06-27.1
stage: deploy
only:
variables:
- $CRON_TASK == "BUILD_CI_IMAGES"
script:
# Newer versions of podman/buildah try to set overlayfs mount options when
# using the vfs driver, and this causes errors.
- sed -i '/^mountopt =.*/d' /etc/containers/storage.conf
# Where the real magic happens
- buildah bud -f $DOCKERFILE -t "$CI_REGISTRY_IMAGE:$CI_JOB_NAME" $ARGS
# Prepare to publish
- buildah tag "$CI_REGISTRY_IMAGE:$CI_JOB_NAME" "$CI_REGISTRY_IMAGE:job-${CI_JOB_ID}_$CI_JOB_NAME"
- buildah images
- buildah login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# Publish (if running on a schedule)
- |
if [[ "$CI_PIPELINE_SOURCE" == "schedule" ]]; then
buildah push "$CI_REGISTRY_IMAGE:$CI_JOB_NAME"
buildah push "$CI_REGISTRY_IMAGE:job-${CI_JOB_ID}_$CI_JOB_NAME"
fi
.Docker variables: &docker_variables
STORAGE_DRIVER: vfs
BUILDAH_FORMAT: docker
BUILDAH_ISOLATION: chroot
fedora.mozjs115:
<<: *create_docker_image
variables:
<<: *docker_variables
DOCKERFILE: test/extra/Dockerfile
fedora.mozjs115-debug:
<<: *create_docker_image
variables:
<<: *docker_variables
DOCKERFILE: test/extra/Dockerfile.debug
fedora.mozjs128:
<<: *create_docker_image
variables:
<<: *docker_variables
DOCKERFILE: test/extra/Dockerfile
ARGS: --build-arg MOZJS_BRANCH=mozjs128 --build-arg MOZJS_BUILDDEPS=mozjs115
fedora.mozjs128-debug:
<<: *create_docker_image
variables:
<<: *docker_variables
DOCKERFILE: test/extra/Dockerfile.debug
ARGS: --build-arg MOZJS_BRANCH=mozjs128 --build-arg MOZJS_BUILDDEPS=mozjs115