1 # This file uses the freedesktop ci-templates to build Wayland and run our
4 # ci-templates uses a multi-stage build process. First, the base container
5 # image is built which contains the core distribution, the toolchain, and
6 # all our build dependencies. This container is aggressively cached; if a
7 # container image matching $FDO_DISTRIBUTION_TAG is found in either the
8 # upstream repo (wayland/weston) or the user's downstream repo, it is
9 # reused for the build. This gives us predictability of build and far
10 # quicker runtimes, however it means that any changes to the base container
11 # must also change $FDO_DISTRIBUTION_TAG. When changing this, please use
12 # the current date as well as a unique build identifier.
14 # After the container is either rebuilt (tag mismatch) or reused (tag
15 # previously used), the build stage executes within this container.
17 # The final stage is used to expose documentation and coverage information,
18 # including publishing documentation to the public site when built on the
21 # Apart from the 'variables', 'include', and 'stages' top-level anchors,
22 # everything not beginning with a dot ('.') is the name of a job which will
23 # be executed as part of CI, unless the rules specify that it should not be
26 # Variables prefixed with CI_ are generally provided by GitLab itself;
27 # variables prefixed with FDO_ and templates prefixed by .fdo are provided
28 # by the ci-templates.
30 # For more information on GitLab CI, including the YAML syntax, see:
31 # https://docs.gitlab.com/ee/ci/yaml/README.html
33 # Note that freedesktop.org uses the 'Community Edition' of GitLab, so features
34 # marked as 'premium' or 'ultimate' are not available to us.
36 # For more information on ci-templates, see:
37 # - documentation at https://freedesktop.pages.freedesktop.org/ci-templates/
38 # - repo at https://gitlab.freedesktop.org/freedesktop/ci-templates/
40 # Here we use a fixed ref in order to isolate ourselves from ci-templates
41 # API changes. If you need new features from ci-templates you must bump
42 # this to the current SHA you require from the ci-templates repo, however
43 # be aware that you may need to account for API changes when doing so.
44 .templates_sha: &template_sha 567700e483aabed992d0a4fea84994a0472deff6 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
47 - project: 'freedesktop/ci-templates'
50 - '/templates/debian.yml'
51 - '/templates/freebsd.yml'
52 - '/templates/ci-fairy.yml'
55 FDO_UPSTREAM_REPO: wayland/wayland
56 FDO_REPO_SUFFIX: "$BUILD_OS/$BUILD_ARCH"
59 # Define the build stages. These are used for UI grouping as well as
62 - "Merge request checks"
65 - "Other build configurations"
71 # Base variables used for anything using a Debian environment
75 FDO_DISTRIBUTION_VERSION: buster
76 FDO_DISTRIBUTION_PACKAGES: 'build-essential pkg-config libexpat1-dev libffi-dev libxml2-dev doxygen graphviz xmlto xsltproc docbook-xsl python3-pip python3-setuptools ninja-build'
77 FDO_DISTRIBUTION_EXEC: 'pip3 install meson==0.56.0'
78 # bump this tag every time you change something which requires rebuilding the
80 FDO_DISTRIBUTION_TAG: "2022-02-05.0"
101 # Does not inherit .ci-rules as we only want it to run in MR context.
105 stage: "Merge request checks"
107 - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
111 - ci-fairy check-commits --signed-off-by --junit-xml=results.xml
119 # Build our base container image, which contains the core distribution, the
120 # toolchain, and all our build dependencies. This will be reused in the build
122 x86_64-debian-container_prep:
126 - .fdo.container-build@debian
127 stage: "Base container"
131 aarch64-debian-container_prep:
135 - .fdo.container-build@debian
138 stage: "Base container"
142 armv7-debian-container_prep:
146 - .fdo.container-build@debian
149 stage: "Base container"
152 FDO_BASE_IMAGE: "arm32v7/debian:$FDO_DISTRIBUTION_VERSION"
155 # Core build environment.
158 MESON_BUILD_TYPE: "-Dbuildtype=debug -Doptimization=0 -Db_sanitize=address,undefined"
160 - export BUILD_ID="wayland-$CI_JOB_NAME"
161 - export PREFIX="${CI_PROJECT_DIR}/prefix-${BUILD_ID}"
162 - export BUILDDIR="${CI_PROJECT_DIR}/build-${BUILD_ID}"
163 - mkdir "$BUILDDIR" "$PREFIX"
166 # Build variants to be stacked on as required.
168 stage: "Other build configurations"
170 MESON_BUILD_TYPE: "-Dbuildtype=release"
173 # OS/architecture-specific variants
174 .build-env-debian-x86_64:
176 - .fdo.suffixed-image@debian
180 - job: x86_64-debian-container_prep
183 .build-env-debian-aarch64:
185 - .fdo.suffixed-image@debian
189 # At least with the versions we have, the LSan runtime makes fork unusably
190 # slow on AArch64, which is bad news since the test suite decides to fork
191 # for every single subtest. For now, in order to get AArch64 builds and
192 # tests into CI, just assume that we're not going to leak any more on
193 # AArch64 than we would on ARMv7 or x86-64.
194 ASAN_OPTIONS: "detect_leaks=0"
198 - job: aarch64-debian-container_prep
201 .build-env-debian-armv7:
203 - .fdo.suffixed-image@debian
209 - job: armv7-debian-container_prep
213 # Full build and test.
217 stage: "Build and test"
220 - meson --prefix="$PREFIX" -Dicon_directory=/usr/share/X11/icons -Dwerror=true ${MESON_BUILD_TYPE} ..
221 - ninja -k0 -j${FDO_CI_CONCURRENT:-4}
222 - meson test --num-processes ${FDO_CI_CONCURRENT:-4}
225 name: wayland-$CI_JOB_NAME
231 junit: build-*/meson-logs/testlog.junit.xml
233 # Full build and test.
237 stage: "Build and test"
239 # Start the VM and copy our workspace to the VM
242 # The `set +e is needed to ensure that we always copy the meson logs back to
243 # the workspace to see details about the failed tests.
246 /app/vmctl exec "pkg info; cd $CI_PROJECT_NAME ; meson $BUILDDIR --prefix=$PREFIX $MESON_BUILD_TYPE $MESON_ARGS && ninja -C $BUILDDIR -j${FDO_CI_CONCURRENT:-4}"
247 /app/vmctl exec "meson test --print-errorlogs -C $BUILDDIR --num-processes ${FDO_CI_CONCURRENT:-4}" && touch .tests-successful
249 scp -r vm:$BUILDDIR/meson-logs .
250 /app/vmctl exec "ninja -C $BUILDDIR install"
251 mkdir -p $PREFIX && scp -r vm:$PREFIX/ $PREFIX/
252 # Finally, shut down the VM.
254 - test -f .tests-successful || exit 1
256 name: wayland-$CI_JOB_NAME
262 junit: meson-logs/testlog.junit.xml
264 # Full build and test.
267 - .build-env-debian-x86_64
270 x86_64-release-debian-build:
272 - .build-env-debian-x86_64
276 aarch64-debian-build:
278 - .build-env-debian-aarch64
281 aarch64-release-debian-build:
283 - .build-env-debian-aarch64
289 - .build-env-debian-armv7
292 armv7-release-debian-build:
294 - .build-env-debian-armv7
298 # Base variables used for anything using a FreeBSD environment
302 FDO_DISTRIBUTION_VERSION: "13.0"
303 FDO_DISTRIBUTION_PACKAGES: 'libxslt meson ninja pkgconf expat libffi libepoll-shim libxml2'
304 # bump this tag every time you change something which requires rebuilding the
306 FDO_DISTRIBUTION_TAG: "2021-08-05.0"
307 # Don't build documentation since installing the required tools massively
308 # increases the VM image (and therefore container) size.
309 MESON_ARGS: "-Ddocumentation=false"
317 x86_64-freebsd-container_prep:
321 - .fdo.qemu-build@freebsd@x86_64
322 stage: "Base container"
326 .build-env-freebsd-x86_64:
328 # Compiling with ASan+UBSan appears to trigger an infinite loop in the
329 # compiler shipped with FreeBSD 13.0, so we only use UBSan here.
330 # Additionally, sanitizers can't be used with b_lundef on FreeBSD.
331 MESON_BUILD_TYPE: "-Dbuildtype=debug -Db_sanitize=undefined -Db_lundef=false"
333 - .fdo.suffixed-image@freebsd
337 - job: x86_64-freebsd-container_prep
340 # Full build and test.
341 x86_64-freebsd-build:
343 - .build-env-freebsd-x86_64
346 x86_64-release-freebsd-build:
348 - .build-env-freebsd-x86_64