glib/.gitlab-ci.yml
Marco Trevisan (Treviño) 6651b4d541 Do not build all
2023-04-21 15:21:48 +02:00

300 lines
8.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

stages:
- build
- coverage
- analysis
- deploy
- report
cache:
paths:
- _ccache/
variables:
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v20"
COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v7"
DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v14"
MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v10"
MESON_TEST_TIMEOUT_MULTIPLIER: 4
G_MESSAGES_DEBUG: all
MESON_COMMON_OPTIONS: "--buildtype debug --wrap-mode=nodownload --fatal-meson-warnings"
.only-default:
only:
- branches
except:
- tags
# Some jobs run on CI runners which dont have good isolation between CI jobs,
# and dont have much available resource. Limit those jobs to only ones on the
# origin repository (GNOME/glib), rather than peoples forks. Code in the origin
# repository can be trusted.
.only-origin:
only:
- branches@GNOME/glib
except:
- tags
# 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.
.only-schedules:
only:
- schedules
except:
- tags
.build-linux:
before_script:
- bash .gitlab-ci/show-execution-environment.sh
- cp -r $HOME/subprojects/* subprojects/
installed-tests:
extends:
- .build-linux
- .only-schedules
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
-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/
# 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
expire_in: 1 week
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
- "_build/installed-tests-report/"
G_DISABLE_ASSERT:
extends:
- .build-linux
- .only-schedules
image: $FEDORA_IMAGE
stage: build
needs: []
script:
- meson ${MESON_COMMON_OPTIONS}
--werror
-Dsystemtap=true
-Ddtrace=true
-Dinstalled_tests=true
-Dglib_assert=false
_build
- ninja -C _build
- bash -x ./.gitlab-ci/run-tests.sh
artifacts:
reports:
junit:
- _build/meson-logs/testlog.junit.xml
- _build/meson-logs/testlog-*.junit.xml
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
valgrind:
extends:
- .build-linux
- .only-schedules
image: $FEDORA_IMAGE
stage: analysis
needs: []
variables:
MESON_TEST_TIMEOUT_MULTIPLIER: 15
script:
- meson ${MESON_COMMON_OPTIONS}
--werror
-Dsystemtap=true
-Ddtrace=true
-Dinstalled_tests=true
_build
- ninja -C _build
# Valgrind doesnt work when the soft FD limit is set too high
# See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2710
- ulimit -Sn 1024
- bash -x ./.gitlab-ci/run-tests.sh
--setup valgrind
--no-suite slow
artifacts:
reports:
junit: "_build/meson-logs/testlog-valgrind.junit.xml"
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
.cross-build-linux:
extends: .build-linux
stage: build
needs: []
artifacts:
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
paths:
- "_build/meson-logs"
macos:
extends: .only-origin
stage: build
tags:
- macos
needs: []
variables:
GIT_SUBMODULE_STRATEGY: normal
GIT_STRATEGY: clone
# libpcre2 gets built as a subproject, but the default Clang options on
# macOS limit string lengths to 4095B — pcre2_error.c has a string of length
# 4380B
CFLAGS: '-Wno-overlength-strings'
before_script:
- bash .gitlab-ci/show-execution-environment.sh
- pip3 install --user meson==1.0.0
- pip3 install --user ninja
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
script:
# 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
--werror
_build
# - ninja -C _build
- .gitlab-ci/run-tests.sh
artifacts:
reports:
junit:
- _build/meson-logs/testlog.junit.xml
- _build/meson-logs/testlog-*.junit.xml
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
paths:
- "_build/config.h"
- "_build/glib/glibconfig.h"
- "_build/meson-logs"
scan-build:
extends:
- .build-linux
- .only-schedules
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
-Dinstalled_tests=true
_scan_build
- ninja -C _scan_build scan-build
artifacts:
name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
expire_in: 1 week
paths:
- "_scan_build/meson-logs/scanbuild"
coverity:
extends:
- .build-linux
- .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
-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
expire_in: 1 week
paths:
- "cov-int/build-log.txt"
dist-job:
image: $FEDORA_IMAGE
stage: build
only:
- tags
script:
# Ignore extra git security checks as we don't care in CI.
- git config --global --add safe.directory "${PWD}"
- git submodule update --init
- for m in $(git submodule foreach -q 'echo $path'); do git config --global --add safe.directory "${PWD}/${m}"; done
- meson subprojects download
- meson ${MESON_COMMON_OPTIONS} --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"
issue-bot:
stage: report
image: registry.gitlab.com/gitlab-org/distribution/issue-bot:latest
script: /issue-bot
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "schedule"
when: on_failure