wayland-client: fix not to repeat logs regarding errno and display->last_error
[platform/upstream/wayland.git] / .gitlab-ci.yml
1 # This file uses the freedesktop ci-templates to build Wayland and run our
2 # tests in CI.
3 #
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.
13 #
14 # After the container is either rebuilt (tag mismatch) or reused (tag
15 # previously used), the build stage executes within this container.
16 #
17 # The final stage is used to expose documentation and coverage information,
18 # including publishing documentation to the public site when built on the
19 # main branch.
20 #
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
24 # run.
25 #
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.
29 #
30 # For more information on GitLab CI, including the YAML syntax, see:
31 #   https://docs.gitlab.com/ee/ci/yaml/README.html
32 #
33 # Note that freedesktop.org uses the 'Community Edition' of GitLab, so features
34 # marked as 'premium' or 'ultimate' are not available to us.
35 #
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/
39
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
45
46 include:
47   - project: 'freedesktop/ci-templates'
48     ref: *template_sha
49     file:
50       - '/templates/debian.yml'
51       - '/templates/freebsd.yml'
52       - '/templates/ci-fairy.yml'
53
54 variables:
55   FDO_UPSTREAM_REPO: wayland/wayland
56   FDO_REPO_SUFFIX: "$BUILD_OS/$BUILD_ARCH"
57
58
59 # Define the build stages. These are used for UI grouping as well as
60 # dependencies.
61 stages:
62   - "Merge request checks"
63   - "Base container"
64   - "Build and test"
65   - "Other build configurations"
66
67 .ci-rules:
68   rules:
69     - when: on_success
70
71 # Base variables used for anything using a Debian environment
72 .os-debian:
73   variables:
74     BUILD_OS: debian
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
79     # base image
80     FDO_DISTRIBUTION_TAG: "2022-02-05.0"
81
82 .debian-x86_64:
83   extends:
84     - .os-debian
85   variables:
86     BUILD_ARCH: "x86-64"
87
88 .debian-aarch64:
89   extends:
90     - .os-debian
91   variables:
92     BUILD_ARCH: "aarch64"
93
94 .debian-armv7:
95   extends:
96     - .os-debian
97   variables:
98     BUILD_ARCH: "armv7"
99
100
101 # Does not inherit .ci-rules as we only want it to run in MR context.
102 check-commit:
103   extends:
104     - .fdo.ci-fairy
105   stage: "Merge request checks"
106   rules:
107     - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
108       when: always
109     - when: never
110   script:
111     - ci-fairy check-commits --signed-off-by --junit-xml=results.xml
112   variables:
113     GIT_DEPTH: 100
114   artifacts:
115     reports:
116       junit: results.xml
117
118
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
121 # stage.
122 x86_64-debian-container_prep:
123   extends:
124     - .ci-rules
125     - .debian-x86_64
126     - .fdo.container-build@debian
127   stage: "Base container"
128   variables:
129     GIT_STRATEGY: none
130
131 aarch64-debian-container_prep:
132   extends:
133     - .ci-rules
134     - .debian-aarch64
135     - .fdo.container-build@debian
136   tags:
137     - aarch64
138   stage: "Base container"
139   variables:
140     GIT_STRATEGY: none
141
142 armv7-debian-container_prep:
143   extends:
144     - .ci-rules
145     - .debian-armv7
146     - .fdo.container-build@debian
147   tags:
148     - aarch64
149   stage: "Base container"
150   variables:
151     GIT_STRATEGY: none
152     FDO_BASE_IMAGE: "arm32v7/debian:$FDO_DISTRIBUTION_VERSION"
153
154
155 # Core build environment.
156 .build-env:
157   variables:
158     MESON_BUILD_TYPE: "-Dbuildtype=debug -Doptimization=0 -Db_sanitize=address,undefined"
159   before_script:
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"
164
165
166 # Build variants to be stacked on as required.
167 .build-release:
168   stage: "Other build configurations"
169   variables:
170     MESON_BUILD_TYPE: "-Dbuildtype=release"
171
172
173 # OS/architecture-specific variants
174 .build-env-debian-x86_64:
175   extends:
176     - .fdo.suffixed-image@debian
177     - .debian-x86_64
178     - .build-env
179   needs:
180     - job: x86_64-debian-container_prep
181       artifacts: false
182
183 .build-env-debian-aarch64:
184   extends:
185     - .fdo.suffixed-image@debian
186     - .debian-aarch64
187     - .build-env
188   variables:
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"
195   tags:
196     - aarch64
197   needs:
198     - job: aarch64-debian-container_prep
199       artifacts: false
200
201 .build-env-debian-armv7:
202   extends:
203     - .fdo.suffixed-image@debian
204     - .debian-armv7
205     - .build-env
206   tags:
207     - aarch64
208   needs:
209     - job: armv7-debian-container_prep
210       artifacts: false
211
212
213 # Full build and test.
214 .do-build:
215   extends:
216     - .ci-rules
217   stage: "Build and test"
218   script:
219     - cd "$BUILDDIR"
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}
223     - ninja clean
224   artifacts:
225     name: wayland-$CI_JOB_NAME
226     when: always
227     paths:
228       - build-*/meson-logs
229       - prefix-*
230     reports:
231       junit: build-*/meson-logs/testlog.junit.xml
232
233 # Full build and test.
234 .do-build-qemu:
235   extends:
236     - .ci-rules
237   stage: "Build and test"
238   script:
239     # Start the VM and copy our workspace to the VM
240     - /app/vmctl start
241     - scp -r $PWD "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.
244     - |
245       set +e
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
248       set -ex
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.
253     - /app/vmctl stop
254     - test -f .tests-successful || exit 1
255   artifacts:
256     name: wayland-$CI_JOB_NAME
257     when: always
258     paths:
259       - meson-logs
260       - prefix-*
261     reports:
262       junit: meson-logs/testlog.junit.xml
263
264 # Full build and test.
265 x86_64-debian-build:
266   extends:
267     - .build-env-debian-x86_64
268     - .do-build
269
270 x86_64-release-debian-build:
271   extends:
272     - .build-env-debian-x86_64
273     - .do-build
274     - .build-release
275
276 aarch64-debian-build:
277   extends:
278     - .build-env-debian-aarch64
279     - .do-build
280
281 aarch64-release-debian-build:
282   extends:
283     - .build-env-debian-aarch64
284     - .do-build
285     - .build-release
286
287 armv7-debian-build:
288   extends:
289     - .build-env-debian-armv7
290     - .do-build
291
292 armv7-release-debian-build:
293   extends:
294     - .build-env-debian-armv7
295     - .do-build
296     - .build-release
297
298 # Base variables used for anything using a FreeBSD environment
299 .os-freebsd:
300   variables:
301     BUILD_OS: freebsd
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
305     # base image
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"
310
311 .freebsd-x86_64:
312   extends:
313     - .os-freebsd
314   variables:
315     BUILD_ARCH: "x86_64"
316
317 x86_64-freebsd-container_prep:
318   extends:
319     - .ci-rules
320     - .freebsd-x86_64
321     - .fdo.qemu-build@freebsd@x86_64
322   stage: "Base container"
323   variables:
324     GIT_STRATEGY: none
325
326 .build-env-freebsd-x86_64:
327   variables:
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"
332   extends:
333     - .fdo.suffixed-image@freebsd
334     - .freebsd-x86_64
335     - .build-env
336   needs:
337     - job: x86_64-freebsd-container_prep
338       artifacts: false
339
340 # Full build and test.
341 x86_64-freebsd-build:
342   extends:
343     - .build-env-freebsd-x86_64
344     - .do-build-qemu
345
346 x86_64-release-freebsd-build:
347   extends:
348     - .build-env-freebsd-x86_64
349     - .do-build-qemu
350     - .build-release