glib/.gitlab-ci.yml

566 lines
18 KiB
YAML
Raw Normal View History

stages:
- style-check
- build
- coverage
- analysis
- deploy
cache:
paths:
- _ccache/
variables:
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v12"
COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v2"
DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v9"
ANDROID_IMAGE: "registry.gitlab.gnome.org/gnome/glib/android-ndk:v5"
MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v4"
MESON_TEST_TIMEOUT_MULTIPLIER: 2
G_MESSAGES_DEBUG: all
MESON_COMMON_OPTIONS_NO_WARNING: "--buildtype debug --wrap-mode=nodownload"
MESON_COMMON_OPTIONS: "${MESON_COMMON_OPTIONS_NO_WARNING} --fatal-meson-warnings"
.only-default:
only:
- branches
except:
- tags
2020-01-13 18:31:15 +01:00
.build:
extends: .only-default
before_script:
- bash .gitlab-ci/show-execution-environment.sh
2020-01-13 18:31:15 +01:00
- cp -r $HOME/subprojects/* subprojects/
# Some jobs take a long time and are unlikely to find failures (or will find
# failures which are not merge-blockers to fix), so theyre executed on a weekly
# schedule in order to save CI resources and speed up branch pipelines.
.build-only-schedules:
extends: .build
only:
- schedules
style-check-diff:
extends: .only-default
image: $DEBIAN_IMAGE
stage: style-check
allow_failure: true
script:
- .gitlab-ci/run-style-check-diff.sh
- .gitlab-ci/run-shellcheck.sh
- .gitlab-ci/run-black.sh
- .gitlab-ci/run-flake8.sh
2019-11-11 21:21:25 +01:00
check-todos:
extends: .only-default
image: $DEBIAN_IMAGE
stage: style-check
allow_failure: true
script:
- .gitlab-ci/run-check-todos.sh
fedora-x86_64:
2020-01-13 18:31:15 +01:00
extends: .build
2020-01-13 18:45:00 +01:00
image: $FEDORA_IMAGE
stage: build
needs: []
variables:
CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
script:
# FIXME: Cannot use MESON_COMMON_OPTIONS here because meson warns about gtkdoc
# feature fully functional in 0.54, but we only depend on 0.52. So we cannot build
# with --fatal-meson-warnings.
- meson ${MESON_COMMON_OPTIONS_NO_WARNING}
--werror
--default-library=both
--prefix=$HOME/glib-installed
--localstatedir=/var
--libdir=lib
-Dsystemtap=true
-Ddtrace=true
-Dfam=true
-Dinstalled_tests=true
-Dgtk_doc=true
_build
- ninja -C _build
- mkdir -p _coverage
- lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
- .gitlab-ci/run-tests.sh
- lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
artifacts:
reports:
junit: "_build/${CI_JOB_NAME}-report.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
2018-06-05 20:01:53 +02:00
- "_build/meson-logs"
- "_build/docs/reference/glib/glib-undeclared.txt"
- "_build/docs/reference/glib/glib-undocumented.txt"
- "_build/docs/reference/glib/glib-unused.txt"
- "_build/docs/reference/gobject/gobject-undeclared.txt"
- "_build/docs/reference/gobject/gobject-undocumented.txt"
- "_build/docs/reference/gobject/gobject-unused.txt"
- "_build/docs/reference/gio/gio-undeclared.txt"
- "_build/docs/reference/gio/gio-undocumented.txt"
- "_build/docs/reference/gio/gio-unused.txt"
- "_build/${CI_JOB_NAME}-report.xml"
2018-06-05 20:01:53 +02:00
- "_coverage"
debian-stable-x86_64:
2020-01-13 18:31:15 +01:00
extends: .build
2020-01-13 18:45:00 +01:00
image: $DEBIAN_IMAGE
stage: build
needs: []
script:
- meson ${MESON_COMMON_OPTIONS}
--werror
--default-library=both
--prefix=$HOME/glib-installed
--localstatedir=/var
--libdir=lib
-Dsystemtap=true
-Ddtrace=true
-Dfam=true
-Dinstalled_tests=true
_build
- ninja -C _build
- .gitlab-ci/run-tests.sh
artifacts:
reports:
junit: "_build/${CI_JOB_NAME}-report.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
- "_build/${CI_JOB_NAME}-report.xml"
installed-tests:
extends: .build-only-schedules
2020-01-13 18:45:00 +01:00
image: $FEDORA_IMAGE
stage: build
needs: []
script:
# dtrace is disabled because it breaks the static-link.py test
- meson ${MESON_COMMON_OPTIONS}
--werror
--prefix=/usr --libdir=/usr/lib64
-Dfam=true
-Dinstalled_tests=true
-Ddefault_library=both
-Ddtrace=false
_build
- ninja -C _build
- sudo ninja -C _build install
# Remove old headers, possibly present in current installation
- sudo rm -f /usr/include/glib-2.0/glib/gurifuncs.h
- sudo chown -R `id -un`:`id -gn` _build/
# FIXME Install newer xdg-desktop-portal with
# GMemoryMonitor support, see:
# https://github.com/flatpak/xdg-desktop-portal/pull/365
- git clone --branch 1.6.0 --depth 1 --no-tags https://github.com/flatpak/xdg-desktop-portal.git
- cd xdg-desktop-portal
- ./autogen.sh --prefix=/usr --libdir=/usr/lib64 --disable-libportal --disable-dependency-tracking
- make
- sudo make install
- cd ..
# FIXME install newer gobject-introspection
# with GMemoryMonitor support, see:
# https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/193
- git clone --single-branch --depth 1 --no-tags https://gitlab.gnome.org/GNOME/gobject-introspection.git
- cd gobject-introspection
- /usr/bin/meson _build --prefix=/usr --libdir=/usr/lib64
- ninja -C _build
- sudo ninja -C _build install
- cd ..
# Work-around https://gitlab.gnome.org/GNOME/gnome-desktop-testing/merge_requests/2
- mkdir -p _build/installed-tests-report/logs/
- GLIB_TEST_COMPILATION=1 gnome-desktop-testing-runner
--report-directory=_build/installed-tests-report/failed/
--log-directory=_build/installed-tests-report/logs/
--parallel=0
glib
artifacts:
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
- "_build/installed-tests-report/"
G_DISABLE_ASSERT:
extends: .build-only-schedules
2020-01-13 18:45:00 +01:00
image: $FEDORA_IMAGE
stage: build
needs: []
script:
- meson ${MESON_COMMON_OPTIONS}
--werror
-Dsystemtap=true
-Ddtrace=true
-Dfam=true
-Dinstalled_tests=true
-Dglib_assert=false
_build
- ninja -C _build
- bash -x ./.gitlab-ci/run-tests.sh
artifacts:
reports:
junit: "_build/${CI_JOB_NAME}-report.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
- "_build/${CI_JOB_NAME}-report.xml"
valgrind:
extends: .build-only-schedules
2020-01-13 18:45:00 +01:00
image: $FEDORA_IMAGE
stage: analysis
needs: []
variables:
MESON_TEST_TIMEOUT_MULTIPLIER: 10
script:
- meson ${MESON_COMMON_OPTIONS}
--werror
-Dsystemtap=true
-Ddtrace=true
-Dfam=true
-Dinstalled_tests=true
_build
- ninja -C _build
- bash -x ./.gitlab-ci/run-tests.sh
--log-file _build/meson-logs/testlog-valgrind.json
--wrap "valgrind --tool=memcheck --error-exitcode=1 --track-origins=yes --leak-check=full --leak-resolution=high --num-callers=50 --show-leak-kinds=definite,possible --show-error-list=yes --suppressions=${CI_PROJECT_DIR}/glib.supp"
--no-suite no-valgrind
--no-suite slow
# FIXME: Remove this when we have zero valgrind leaks.
# https://gitlab.gnome.org/GNOME/glib/issues/333
allow_failure: true
artifacts:
reports:
junit: "_build/${CI_JOB_NAME}-report.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
.cross-template: &cross-template
2020-01-13 18:31:15 +01:00
extends: .build
stage: build
needs: []
artifacts:
2018-06-05 20:01:53 +02:00
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
2018-06-05 20:01:53 +02:00
- "_build/meson-logs"
cross-android_api21_arm64:
<<: *cross-template
2020-01-13 18:45:00 +01:00
image: $ANDROID_IMAGE
script:
# FIXME: add --werror
# We use -Diconv=auto to test that we successfully detect that iconv is not
# provided by android api 21, and detect the external iconv instead.
- meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_21.txt -Diconv=auto _build
- ninja -C _build
cross-android_api28_arm64:
<<: *cross-template
2020-01-13 18:45:00 +01:00
image: $ANDROID_IMAGE
script:
# FIXME: add --werror
- meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_android_arm64_28.txt _build
- ninja -C _build
cross-mingw64:
<<: *cross-template
2020-01-13 18:45:00 +01:00
image: $MINGW_IMAGE
script:
# FIXME: Add --werror
- meson ${MESON_COMMON_OPTIONS} --cross-file=/opt/cross_file_mingw64.txt _build
- ninja -C _build
artifacts:
reports:
junit: "_build/${env:CI_JOB_NAME}-report.xml"
name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always
paths:
- _build/meson-logs
- "_build/${env:CI_JOB_NAME}-report.xml"
- _build/glib/libglib-2.0-0.dll
- _build/gio/libgio-2.0-0.dll
- _build/gmodule/libgmodule-2.0-0.dll
- _build/gthread/libgthread-2.0-0.dll
- _build/gobject/libgobject-2.0-0.dll
msys2-mingw32:
extends: .only-default
stage: build
tags:
- win32-ps
needs: []
variables:
MSYSTEM: "MINGW32"
CHERE_INVOKING: "yes"
script:
- C:\msys64\usr\bin\pacman --noconfirm -Syyuu --ask 20
- C:\msys64\usr\bin\bash .gitlab-ci/show-execution-environment.sh
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
artifacts:
2019-04-06 16:22:04 +02:00
reports:
junit: "_build/${env:CI_JOB_NAME}-report.xml"
name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always
paths:
- _build/meson-logs
- "_build/${env:CI_JOB_NAME}-report.xml"
- _coverage/
vs2017-x64:
extends: .only-default
stage: build
tags:
- win32-ps
needs: []
script:
- .gitlab-ci/test-msvc.bat
artifacts:
reports:
junit: "_build/${env:CI_JOB_NAME}-report.xml"
name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
when: always
paths:
- _build/meson-logs
- "_build/${env:CI_JOB_NAME}-report.xml"
- _build/glib/libglib-2.0-0.dll
- _build/gio/libgio-2.0-0.dll
- _build/gmodule/libgmodule-2.0-0.dll
- _build/gthread/libgthread-2.0-0.dll
- _build/gobject/libgobject-2.0-0.dll
freebsd-12-x86_64:
stage: build
only:
- branches@GNOME/glib
tags:
# To run a FreeBSD builder, install gitlab-runner package and start both
# gitlab-runner and dbus service because we need /var/lib/dbus/machine-id.
# To compile GLib, you still have to install the following packages:
# desktop-file-utils gettext libiconv meson pkgconf python3 shared-mime-info
- freebsd-12
needs: []
variables:
# CPPFLAGS is required because libintl doesn't use pkg-config.
CPPFLAGS: -I/usr/local/include
# FIXME: Workaround meson inability to set LD_LIBRARY_PATH.
# https://github.com/mesonbuild/meson/issues/1383
# https://github.com/mesonbuild/meson/issues/1635
# https://github.com/mesonbuild/meson/issues/2881
LDFLAGS: -L/usr/local/lib -Wl,--disable-new-dtags
# FreeBSD supports C.UTF-8 locale since 12.1.
LANG: C.UTF-8
before_script:
- bash .gitlab-ci/show-execution-environment.sh
script:
# We cannot use -Wl,--no-undefined because GLib uses 'environ' variable.
# FreeBSD iconv doesn't handle transliteration, so we use (external) GNU libiconv here.
# FreeBSD supports xattr, but its API is different from Linux xattr.
# FIXME: extattr(2) support: https://gitlab.gnome.org/GNOME/glib/issues/1404
# localstatedir is needed for access to /var/lib/dbus/machine-id
- meson ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Diconv=external -Dxattr=false _build
- ninja -C _build
- bash -x ./.gitlab-ci/run-tests.sh
except:
- tags
artifacts:
2019-06-24 16:55:36 +02:00
reports:
junit: "_build/${CI_JOB_NAME}-report.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
- "_build/${CI_JOB_NAME}-report.xml"
freebsd-13-x86_64:
2019-06-24 16:55:36 +02:00
stage: build
only:
- branches@GNOME/glib
tags:
- freebsd-13
needs: []
2019-06-24 16:55:36 +02:00
variables:
CPPFLAGS: -I/usr/local/include
LDFLAGS: -L/usr/local/lib -Wl,--disable-new-dtags
2021-09-02 18:51:14 +02:00
LANG: C.UTF-8
before_script:
- bash .gitlab-ci/show-execution-environment.sh
2019-06-24 16:55:36 +02:00
script:
- meson ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Diconv=external -Dxattr=false _build
2019-06-24 16:55:36 +02:00
- ninja -C _build
- bash -x ./.gitlab-ci/run-tests.sh
except:
- tags
artifacts:
reports:
junit: "_build/${CI_JOB_NAME}-report.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
- "_build/${CI_JOB_NAME}-report.xml"
macos:
extends: .only-default
stage: build
only:
- branches@GNOME/glib
tags:
- macos
needs: []
before_script:
- bash .gitlab-ci/show-execution-environment.sh
- pip3 install --user meson==0.60.1
- pip3 install --user ninja
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
script:
# FIXME: Add --werror
# FIXME: Use --wrap-mode=default so we download dependencies each time,
# until the macOS runner is a VM where we can use a pre-made image which
# already contains the dependencies. See:
# - https://gitlab.gnome.org/GNOME/glib/merge_requests/388
# - https://gitlab.gnome.org/Infrastructure/Infrastructure/issues/225
- meson ${MESON_COMMON_OPTIONS}
--wrap-mode=default
_build
- ninja -C _build
# FIXME: Multiple unit tests currently fails
- .gitlab-ci/run-tests.sh || true
2019-06-24 16:55:36 +02:00
artifacts:
reports:
junit: "_build/${CI_JOB_NAME}-report.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
2018-09-28 19:01:12 +02:00
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
- "_build/${CI_JOB_NAME}-report.xml"
coverage:
extends: .only-default
2020-01-13 18:45:00 +01:00
image: $FEDORA_IMAGE
stage: coverage
needs: ['fedora-x86_64', 'msys2-mingw32']
artifacts:
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
paths:
- _coverage/
before_script:
- bash .gitlab-ci/show-execution-environment.sh
script:
- bash -x ./.gitlab-ci/coverage-docker.sh
coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
scan-build:
extends: .build-only-schedules
2020-01-13 18:45:00 +01:00
image: $FEDORA_IMAGE
stage: analysis
needs: []
script:
- meson ${MESON_COMMON_OPTIONS}
--werror
--default-library=both
--prefix=$HOME/glib-installed
--localstatedir=/var
--libdir=lib
-Dsystemtap=true
-Ddtrace=true
-Dfam=true
-Dinstalled_tests=true
_scan_build
- ninja -C _scan_build scan-build
artifacts:
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "_scan_build/meson-logs/scanbuild"
coverity:
extends: .build-only-schedules
image: $COVERITY_IMAGE
stage: analysis
needs: []
variables:
# cov-build doesnt like GLIB_DEPRECATED_ENUMERATOR
CFLAGS: '-DGLIB_DISABLE_DEPRECATION_WARNINGS'
script:
- meson ${MESON_COMMON_OPTIONS}
--werror
--default-library=both
--prefix=$HOME/glib-installed
--localstatedir=/var
--libdir=lib
-Dsystemtap=true
-Ddtrace=true
-Dfam=true
-Dinstalled_tests=true
_coverity_build
- $HOME/cov-analysis-linux64-*/bin/cov-build --dir cov-int ninja -C _coverity_build
- tar cfz cov-int.tar.gz cov-int
- curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
--form token=$COVERITY_SCAN_TOKEN --form email=$GITLAB_USER_EMAIL
--form file=@cov-int.tar.gz --form version="$CI_COMMIT_SHA"
--form description="$CI_COMMIT_SHA / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID"
artifacts:
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
paths:
- "cov-int/build-log.txt"
pages:
stage: deploy
2018-06-05 19:39:26 +02:00
only:
- main
needs: ['coverage', 'style-check-diff']
script:
- mv _coverage/ public/
artifacts:
paths:
- public
dist-job:
2020-01-13 18:45:00 +01:00
image: $FEDORA_IMAGE
stage: build
only:
- tags
script:
# FIXME: Cannot use MESON_COMMON_OPTIONS here because meson warns about gtkdoc
# feature fully functional in 0.54, but we only depend on 0.52. So we cannot build
# with --fatal-meson-warnings.
- meson ${MESON_COMMON_OPTIONS_NO_WARNING} --buildtype release -Dgtk_doc=true -Dman=true _build
- cd _build
- ninja dist
- ninja glib-doc gobject-doc gio-doc
- tar -c -J -f "glib-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/glib html
- tar -c -J -f "gobject-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gobject html
- tar -c -J -f "gio-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gio html
artifacts:
paths:
- "${CI_PROJECT_DIR}/_build/glib-docs-$CI_COMMIT_TAG.tar.xz"
- "${CI_PROJECT_DIR}/_build/gobject-docs-$CI_COMMIT_TAG.tar.xz"
- "${CI_PROJECT_DIR}/_build/gio-docs-$CI_COMMIT_TAG.tar.xz"
- "${CI_PROJECT_DIR}/_build/meson-dist/glib-*.tar.xz"