14 FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v20"
15 COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v7"
16 DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v14"
17 MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v10"
18 MESON_TEST_TIMEOUT_MULTIPLIER: 4
20 MESON_COMMON_OPTIONS: "--buildtype debug --wrap-mode=nodownload --fatal-meson-warnings"
22 # Default CI job setup; contrast with `.only-origin`.
24 # Don’t execute the pipeline when a merge request is merged into `main`, as it
25 # will have already been tested
33 - $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
35 # Some jobs run on CI runners which don’t have good isolation between CI jobs,
36 # and don’t have much available resource. Limit those jobs to only ones on the
37 # origin repository (GNOME/glib), rather than people’s forks. Code in the origin
38 # repository can be trusted.
45 # Some jobs take a long time and are unlikely to find failures (or will find
46 # failures which are not merge-blockers to fix), so they’re executed on a weekly
47 # schedule in order to save CI resources and speed up branch pipelines.
56 - bash .gitlab-ci/show-execution-environment.sh
57 - cp -r $HOME/subprojects/* subprojects/
59 # FIXME: Work around https://gitlab.com/gitlab-org/gitlab/-/issues/391756
60 .only-default-with-git:
61 extends: .only-default
63 - rm -rf subprojects/gvdb
64 - git submodule update --init --depth 1
66 GIT_SUBMODULE_STRATEGY: "none"
67 GIT_SUBMODULE_DEPTH: 1
70 extends: .only-default-with-git
75 - .gitlab-ci/run-style-check-diff.sh
76 - .gitlab-ci/run-check-todos.sh
79 extends: .only-default
84 - .gitlab-ci/run-shellcheck.sh
85 - .gitlab-ci/run-black.sh
86 - .gitlab-ci/run-flake8.sh
92 style-check-mandatory:
93 extends: .only-default-with-git
98 - .gitlab-ci/run-reuse.sh
108 CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
110 - meson setup ${MESON_COMMON_OPTIONS}
112 --default-library=both
113 --prefix=$HOME/glib-installed
118 -Dinstalled_tests=true
121 - meson compile -C _build
123 - lcov --config-file .lcovrc --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
124 - .gitlab-ci/run-tests.sh
125 - lcov --config-file .lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
129 - _build/meson-logs/testlog.junit.xml
130 - _build/meson-logs/testlog-*.junit.xml
131 name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
136 - "_build/glib/glibconfig.h"
137 - "_build/meson-logs"
138 - "_build/docs/reference/glib/glib-undeclared.txt"
139 - "_build/docs/reference/glib/glib-undocumented.txt"
140 - "_build/docs/reference/glib/glib-unused.txt"
141 - "_build/docs/reference/gobject/gobject-undeclared.txt"
142 - "_build/docs/reference/gobject/gobject-undocumented.txt"
143 - "_build/docs/reference/gobject/gobject-unused.txt"
144 - "_build/docs/reference/gio/gio-undeclared.txt"
145 - "_build/docs/reference/gio/gio-undocumented.txt"
146 - "_build/docs/reference/gio/gio-unused.txt"
149 debian-stable-x86_64:
157 - meson setup ${MESON_COMMON_OPTIONS}
159 --default-library=both
160 --prefix=$HOME/glib-installed
166 - meson compile -C _build
167 - .gitlab-ci/run-tests.sh
171 - _build/meson-logs/testlog.junit.xml
172 - _build/meson-logs/testlog-*.junit.xml
173 name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
178 - "_build/glib/glibconfig.h"
179 - "_build/meson-logs"
189 # dtrace is disabled because it breaks the static-link.py test
190 - meson setup ${MESON_COMMON_OPTIONS}
192 --prefix=/usr --libdir=/usr/lib64
193 -Dinstalled_tests=true
194 -Ddefault_library=both
197 - meson compile -C _build
198 - sudo meson install -C _build
199 # Remove old headers, possibly present in current installation
200 - sudo rm -f /usr/include/glib-2.0/glib/gurifuncs.h
201 - sudo chown -R `id -un`:`id -gn` _build/
202 # Work-around https://gitlab.gnome.org/GNOME/gnome-desktop-testing/merge_requests/2
203 - mkdir -p _build/installed-tests-report/logs/
204 - GLIB_TEST_COMPILATION=1 gnome-desktop-testing-runner
205 --report-directory=_build/installed-tests-report/failed/
206 --log-directory=_build/installed-tests-report/logs/
210 name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
215 - "_build/glib/glibconfig.h"
216 - "_build/meson-logs"
217 - "_build/installed-tests-report/"
227 - meson setup ${MESON_COMMON_OPTIONS}
231 -Dinstalled_tests=true
234 - meson compile -C _build
235 - bash -x ./.gitlab-ci/run-tests.sh
239 - _build/meson-logs/testlog.junit.xml
240 - _build/meson-logs/testlog-*.junit.xml
241 name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
246 - "_build/glib/glibconfig.h"
247 - "_build/meson-logs"
257 MESON_TEST_TIMEOUT_MULTIPLIER: 15
259 - meson setup ${MESON_COMMON_OPTIONS}
263 -Dinstalled_tests=true
265 - meson compile -C _build
266 # Valgrind doesn’t work when the soft FD limit is set too high
267 # See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2710
269 - bash -x ./.gitlab-ci/run-tests.sh
274 junit: "_build/meson-logs/testlog-valgrind.junit.xml"
275 name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
280 - "_build/glib/glibconfig.h"
281 - "_build/meson-logs"
284 extends: .build-linux
288 name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
292 - "_build/meson-logs"
300 # FIXME: add --werror
301 - meson setup ${MESON_COMMON_OPTIONS} --cross-file=.gitlab-ci/cross_file_android_arm64_31.txt _build
302 - meson compile -C _build
312 # FIXME: Add --werror
313 - meson setup ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_mingw64.txt _build
314 - meson compile -C _build
318 - _build/meson-logs/testlog.junit.xml
319 - _build/meson-logs/testlog-*.junit.xml
320 name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
325 - _build/glib/libglib-2.0-0.dll
326 - _build/gio/libgio-2.0-0.dll
327 - _build/gmodule/libgmodule-2.0-0.dll
328 - _build/gthread/libgthread-2.0-0.dll
329 - _build/gobject/libgobject-2.0-0.dll
332 extends: .only-default
339 CHERE_INVOKING: "yes"
340 CFLAGS: -coverage -ftest-coverage -fprofile-arcs
342 # FIXME: For some reason enabling jit debugging "fixes" random python crashes
343 # see https://github.com/msys2/MINGW-packages/issues/11864 and
344 # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3280#note_1678973
347 - C:\msys64\usr\bin\pacman --noconfirm -Syyuu --ask 20
348 - C:\msys64\usr\bin\bash .gitlab-ci/show-execution-environment.sh
349 - C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
353 - _build/meson-logs/testlog.junit.xml
354 - _build/meson-logs/testlog-*.junit.xml
355 name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
363 extends: .only-schedules
370 CHERE_INVOKING: "yes"
372 # FIXME: For some reason enabling jit debugging "fixes" random python crashes
373 # see https://github.com/msys2/MINGW-packages/issues/11864 and
374 # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3280#note_1678973
377 - C:\msys64\usr\bin\pacman --noconfirm -Syyuu --ask 20
378 - C:\msys64\usr\bin\bash .gitlab-ci/show-execution-environment.sh
379 - C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
382 junit: "_build/meson-logs/testlog.junit.xml"
383 name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
390 extends: .only-default
398 # FIXME: These should use --wrap-mode=nodownload but the Windows CI machines
399 # aren’t currently set up for that.
400 - .gitlab-ci/test-msvc.bat ${MESON_COMMON_OPTIONS}
402 --python.platlibdir=C:\Python37\site-packages
403 --python.purelibdir=C:\Python37\site-packages
407 - _build/meson-logs/testlog.junit.xml
408 - _build/meson-logs/testlog-*.junit.xml
409 name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
414 - _build/glib/libglib-2.0-0.dll
415 - _build/gio/libgio-2.0-0.dll
416 - _build/gmodule/libgmodule-2.0-0.dll
417 - _build/gthread/libgthread-2.0-0.dll
418 - _build/gobject/libgobject-2.0-0.dll
421 extends: .only-default
429 # FIXME: These should use --wrap-mode=nodownload but the Windows CI machines
430 # aren’t currently set up for that.
431 - .gitlab-ci/test-msvc.bat ${MESON_COMMON_OPTIONS}
433 --default-library=static
434 --python.platlibdir=C:\Python37\site-packages
435 --python.purelibdir=C:\Python37\site-packages
439 - _build/meson-logs/testlog.junit.xml
440 - _build/meson-logs/testlog-*.junit.xml
441 name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
448 # The FreeBSD 13 build is run on each commit, so the FreeBSD 12 build can be
449 # run less regularly to save CI resources. The chance of a regression on
450 # FreeBSD 12 and not FreeBSD 13 is tiny.
451 extends: .only-schedules
454 # To run a FreeBSD builder, install gitlab-runner package and start both
455 # gitlab-runner and dbus service because we need /var/lib/dbus/machine-id.
456 # To compile GLib, you still have to install the following packages:
457 # desktop-file-utils gettext libiconv meson pkgconf python3 shared-mime-info
461 # CPPFLAGS is required because libintl doesn't use pkg-config.
462 CPPFLAGS: -I/usr/local/include
463 # FIXME: Workaround meson inability to set LD_LIBRARY_PATH.
464 # https://github.com/mesonbuild/meson/issues/1383
465 # https://github.com/mesonbuild/meson/issues/1635
466 # https://github.com/mesonbuild/meson/issues/2881
467 LDFLAGS: -L/usr/local/lib -Wl,--disable-new-dtags
468 # FreeBSD supports C.UTF-8 locale since 12.1.
471 - bash .gitlab-ci/show-execution-environment.sh
473 # We cannot use -Wl,--no-undefined because GLib uses 'environ' variable.
474 # FreeBSD supports xattr, but its API is different from Linux xattr.
475 # FIXME: extattr(2) support: https://gitlab.gnome.org/GNOME/glib/issues/1404
476 # localstatedir is needed for access to /var/lib/dbus/machine-id
477 - meson setup ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Dxattr=false _build
478 - meson compile -C _build
479 - bash -x ./.gitlab-ci/run-tests.sh
483 - _build/meson-logs/testlog.junit.xml
484 - _build/meson-logs/testlog-*.junit.xml
485 name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
490 - "_build/glib/glibconfig.h"
491 - "_build/meson-logs"
494 extends: .only-origin
500 CPPFLAGS: -I/usr/local/include
501 LDFLAGS: -L/usr/local/lib -Wl,--disable-new-dtags
504 - bash .gitlab-ci/show-execution-environment.sh
506 - meson setup ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Dxattr=false _build
507 - meson compile -C _build
508 - bash -x ./.gitlab-ci/run-tests.sh
512 - _build/meson-logs/testlog.junit.xml
513 - _build/meson-logs/testlog-*.junit.xml
514 name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
519 - "_build/glib/glibconfig.h"
520 - "_build/meson-logs"
523 extends: .only-origin
530 GIT_SUBMODULE_STRATEGY: normal
531 # -Wno-overlength-strings
532 # libpcre2 gets built as a subproject, but the default Clang options on
533 # macOS limit string lengths to 4095B — pcre2_error.c has a string of length
535 CFLAGS: "-Wno-overlength-strings"
536 # redirect to the runner's volatile temporary directory
537 TMPDIR: /Users/Shared/work/tmp
538 # keep the user profile clean
539 PIP_CACHE_DIR: /Users/Shared/build/cache
540 PIPENV_CACHE_DIR: $PIP_CACHE_DIR
541 PYTHONPYCACHEPREFIX: $PIP_CACHE_DIR
542 # target OS X 10.9 Mavericks for backward compatibility
543 SDKROOT: /opt/sdks/MacOSX10.9.sdk
544 # use the runner's ccache directory
545 CCACHE_DIR: /Users/Shared/work/ccache
547 - bash .gitlab-ci/show-execution-environment.sh
548 - python3 -m venv .venv
549 - ln -s /opt/cmake/CMake.app/Contents/bin/cmake .venv/bin
550 - ln -s /opt/ccache/ccache .venv/bin
551 - source .venv/bin/activate
552 - pip3 install meson==1.2.0
553 - pip3 install ninja==1.11.1
555 # FIXME: Use --wrap-mode=default so we download dependencies each time,
556 # until the macOS runner is a VM where we can use a pre-made image which
557 # already contains the dependencies. See:
558 # - https://gitlab.gnome.org/GNOME/glib/merge_requests/388
559 # - https://gitlab.gnome.org/Infrastructure/Infrastructure/issues/225
560 - meson setup ${MESON_COMMON_OPTIONS}
564 - meson compile -C _build
565 - .gitlab-ci/run-tests.sh
569 - _build/meson-logs/testlog.junit.xml
570 - _build/meson-logs/testlog-*.junit.xml
571 name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
576 - "_build/glib/glibconfig.h"
577 - "_build/meson-logs"
580 extends: .only-default
583 needs: ['fedora-x86_64', 'msys2-mingw32']
585 name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
587 expose_as: 'Coverage Report'
589 - _coverage/coverage/index.html
593 coverage_format: cobertura
594 path: _coverage/*-cobertura/cobertura-*.xml
596 - bash .gitlab-ci/show-execution-environment.sh
598 - bash -x ./.gitlab-ci/coverage-docker.sh
599 coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
609 - meson setup ${MESON_COMMON_OPTIONS}
611 --default-library=both
612 --prefix=$HOME/glib-installed
617 -Dinstalled_tests=true
619 - ninja -C _scan_build scan-build
621 name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
625 - "_scan_build/meson-logs/scanbuild"
631 image: $COVERITY_IMAGE
635 # cov-build doesn’t like GLIB_DEPRECATED_ENUMERATOR
636 CFLAGS: '-DGLIB_DISABLE_DEPRECATION_WARNINGS'
638 - meson setup ${MESON_COMMON_OPTIONS}
640 --default-library=both
641 --prefix=$HOME/glib-installed
646 -Dinstalled_tests=true
648 - $HOME/cov-analysis-linux64-*/bin/cov-build --dir cov-int meson compile -C _coverity_build
649 - tar cfz cov-int.tar.gz cov-int
650 - curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
651 --form token=$COVERITY_SCAN_TOKEN --form email=$GITLAB_USER_EMAIL
652 --form file=@cov-int.tar.gz --form version="$CI_COMMIT_SHA"
653 --form description="$CI_COMMIT_SHA / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID"
655 name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
659 - "cov-int/build-log.txt"
662 extends: .only-schedules
664 needs: ['coverage', 'style-check-advisory']
666 - mv _coverage/ public/
677 # Ignore extra git security checks as we don't care in CI.
678 - git config --global --add safe.directory "${PWD}"
679 - git submodule update --init
680 - for m in $(git submodule foreach -q 'echo $path'); do git config --global --add safe.directory "${PWD}/${m}"; done
681 - meson subprojects download
682 - meson setup ${MESON_COMMON_OPTIONS} --buildtype release -Dgtk_doc=true -Dman=true _build
683 - meson dist -C _build
684 - ninja -C _build glib-doc gobject-doc gio-doc
685 - tar -c -J -f "glib-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/glib html
686 - tar -c -J -f "gobject-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gobject html
687 - tar -c -J -f "gio-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gio html
690 - "${CI_PROJECT_DIR}/_build/glib-docs-$CI_COMMIT_TAG.tar.xz"
691 - "${CI_PROJECT_DIR}/_build/gobject-docs-$CI_COMMIT_TAG.tar.xz"
692 - "${CI_PROJECT_DIR}/_build/gio-docs-$CI_COMMIT_TAG.tar.xz"
693 - "${CI_PROJECT_DIR}/_build/meson-dist/glib-*.tar.xz"
697 image: registry.gitlab.com/gitlab-org/distribution/issue-bot:latest
700 - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule"