Modify a ttrace macro name TRACE_BEGIN to TRACE_INPUT_BEGIN
[platform/upstream/libinput.git] / .gitlab-ci.yml
1 # vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:
2
3 ########################################
4 #                                      #
5 # THIS FILE IS GENERATED, DO NOT EDIT  #
6 #                                      #
7 ########################################
8
9 # To change the gitlab CI, edit .gitlab-ci/ci.template and/or .gitlab-ci/config.yaml
10 # and run ci-fairy generate-template. For details, see
11 # https://freedesktop.pages.freedesktop.org/ci-templates/ci-fairy.html#templating-gitlab-ci-yml
12
13 # This is a bit complicated for two reasons:
14 # - we really want to run dnf/apt/... only once, updating on the test runner for
15 #   each job takes forever. So we create a container image for each distribution
16 #   tested, then run the tests on this container image.
17 #
18 #   This is handled by the ci-templates, ensuring containers are only rebuilt
19 #   when the TAG changes.
20 #
21 # - GitLab only allows one script: set per job but we have a bunch of commands
22 #   we need to re-run for each build (meson && ninja && etc). YAML cannot merge
23 #   arrays so we're screwed.
24 #
25 #   So instead we use a default_build template and override everything with
26 #   variables. The only two variables that matter:
27 #     MESON_ARGS=-Denable-something=true
28 #     NINJA_ARGS=dist ... to run 'ninja -C builddir dist'
29 #   Note that you cannot use scripts: in any target if you expect default_build
30 #   to work.
31 #
32 #
33 # All jobs must follow the naming scheme of
34 # <distribution>:<version>@activity:
35 #  e.g. fedora:31@build-default
36
37 .templates_sha: &template_sha 25459a8d343961918a7398e4b3c147e450926569
38
39 include:
40   - project: 'freedesktop/ci-templates'
41     ref: *template_sha
42     file:
43       - '/templates/ci-fairy.yml'
44       # Alpine container builder template
45       - '/templates/alpine.yml'
46       # Arch container builder template
47       - '/templates/arch.yml'
48       # Debian container builder template
49       - '/templates/debian.yml'
50       # Fedora container builder template
51       - '/templates/fedora.yml'
52       # Freebsd container builder template
53       - '/templates/freebsd.yml'
54       # Ubuntu container builder template
55       - '/templates/ubuntu.yml'
56
57 stages:
58   - sanity check     # CI/commit checks
59   - prep             # prep work like rebuilding the container images if there is a change
60   - build            # for actually building and testing things in a container
61   - test-suite       # for running the test suite in a VM
62   - test-suite-no-libwacom # for running the test suite in a VM (libwacom disabled)
63   - valgrind         # for running the test suite under valgrind in a VM
64   - distro           # distribs test
65   - deploy           # trigger wayland's website generation
66   - container_clean  # clean up unused container images (scheduled jobs only)
67
68 variables:
69   ###############################################################################
70   # This is the list of packages required to build libinput with the default    #
71   # configuration.                                                              #
72   #                                                                             #
73   # Run dnf install/apt-get install/.. with the list of packages for your       #
74   # distribution                                                                #
75   #                                                                             #
76   # See the documentation here:                                                 #
77   # https://wayland.freedesktop.org/libinput/doc/latest/building_libinput.html  #
78   ###############################################################################
79   FEDORA_PACKAGES:  'git-core gcc gcc-c++ pkgconf-pkg-config meson check-devel libudev-devel libevdev-devel doxygen graphviz python3-sphinx python3-recommonmark python3-sphinx_rtd_theme python3-pytest-xdist libwacom-devel cairo-devel gtk4-devel glib2-devel mtdev-devel diffutils wayland-protocols-devel black clang-analyzer jq rpmdevtools valgrind systemd-udev qemu-img qemu-system-x86-core qemu-system-aarch64-core jq python3-click python3-rich'
80   DEBIAN_PACKAGES:  'git gcc g++ pkg-config meson check libudev-dev libevdev-dev doxygen graphviz python3-sphinx python3-recommonmark python3-sphinx-rtd-theme python3-pytest-xdist libwacom-dev libcairo2-dev libgtk-3-dev libglib2.0-dev libmtdev-dev curl'
81   UBUNTU_PACKAGES:  'git gcc g++ pkg-config meson check libudev-dev libevdev-dev doxygen graphviz python3-sphinx python3-recommonmark python3-sphinx-rtd-theme python3-pytest-xdist libwacom-dev libcairo2-dev libgtk-3-dev libglib2.0-dev libmtdev-dev'
82   ARCH_PACKAGES:    'git gcc pkgconfig meson check libsystemd libevdev doxygen graphviz python-sphinx python-recommonmark python-sphinx_rtd_theme python-pytest-xdist libwacom gtk4 mtdev diffutils wayland-protocols'
83   ALPINE_PACKAGES:  'git gcc build-base pkgconfig meson check-dev eudev-dev libevdev-dev libwacom-dev cairo-dev gtk4.0-dev mtdev-dev bash'
84   FREEBSD_PACKAGES: 'git pkgconf meson libepoll-shim libudev-devd libevdev libwacom gtk3 libmtdev bash wayland'
85   ############################ end of package lists #############################
86
87   # these tags should be updated each time the list of packages is updated
88   # changing these will force rebuilding the associated image
89   # Note: these tags have no meaning and are not tied to a particular
90   # libinput version
91   FEDORA_TAG:  '2022-11-16.2'
92   DEBIAN_TAG:  '2022-11-16.2'
93   UBUNTU_TAG:  '2022-11-16.2'
94   ARCH_TAG:    '2022-11-16.2'
95   ALPINE_TAG:  '2022-11-16.2'
96   FREEBSD_TAG: '2022-11-16.2'
97
98   FDO_UPSTREAM_REPO: libinput/libinput
99
100   MESON_BUILDDIR: "build dir"
101   NINJA_ARGS: ''
102   MESON_ARGS: ''
103   MESON_TEST_ARGS: '--no-suite=hardware'
104
105   # udev isn't available/working properly in the containers
106   UDEV_NOT_AVAILABLE: 1
107   GIT_DEPTH: 1
108
109 .policy:
110   retry:
111     max: 2
112     when:
113       - runner_system_failure
114       - stuck_or_timeout_failure
115   # cancel run when a newer version is pushed to the branch
116   interruptible: true
117   dependencies: []
118
119 .default_artifacts:
120   artifacts:
121     name: "meson-logs-$CI_JOB_NAME"
122     when: always
123     expire_in: 1 week
124     paths:
125       - $MESON_BUILDDIR/meson-logs
126     reports:
127       junit: $MESON_BUILDDIR/*junit*.xml
128
129
130 #################################################################
131 #                                                               #
132 #                     sanity check stage                        #
133 #                                                               #
134 #################################################################
135
136 fail-if-fork-is-not-public:
137   stage: sanity check
138   script:
139     - |
140       if [ $CI_PROJECT_VISIBILITY != "public" ]; then
141            echo "*************************************************************************************"
142            echo "Project visibility must be set to 'public'"
143            echo "Change this in $CI_PROJECT_URL/edit under 'Visibility, project features, permissions'"
144            echo "*************************************************************************************"
145            exit 1
146       fi
147   except:
148     - main@libinput/libinput
149
150 # Re-generate the CI script and make sure it's the one currently checked in
151 # If this job fails, re-generate the gitlab-ci.yml script, see
152 # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
153 #
154 check-ci-script:
155   extends:
156     - .fdo.ci-fairy
157   stage: sanity check
158   script:
159     - ci-fairy generate-template --verify && exit 0 || true
160     - >
161       printf "%s\n" \
162         "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify" \
163         "https://wayland.freedesktop.org/libinput/doc/latest/contributing.html"
164     - exit 1
165
166 #
167 # Verify that commit messages are as expected, signed-off, etc.
168 #
169
170 check-commit:
171   extends:
172     - .fdo.ci-fairy
173   stage: sanity check
174   script:
175     - ci-fairy check-commits --signed-off-by --junit-xml=results.xml && exit 0 || true
176     - >
177       printf "%s\n" \
178         "Error checking commit format. Please verify" \
179         "https://wayland.freedesktop.org/libinput/doc/latest/contributing.html"
180     - exit 1
181   except:
182     - main@libinput/libinput
183   variables:
184     GIT_DEPTH: 100
185   artifacts:
186     reports:
187       junit: results.xml
188
189 #################################################################
190 #                                                               #
191 #                          prep stage                           #
192 #                                                               #
193 #################################################################
194
195 #
196 # Note: images are rebuilt weekly with a scheduled pipeline with FDO_FORCE_REBUILD set
197 #
198 #
199 fedora:35@container-prep:
200   extends:
201     - .fdo.container-build@fedora
202     - .policy
203   stage: prep
204   variables:
205     GIT_STRATEGY: none
206     FDO_DISTRIBUTION_VERSION: '35'
207     FDO_DISTRIBUTION_PACKAGES: $FEDORA_PACKAGES
208     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
209
210 fedora:36@container-prep:
211   extends:
212     - .fdo.container-build@fedora
213     - .policy
214   stage: prep
215   variables:
216     GIT_STRATEGY: none
217     FDO_DISTRIBUTION_VERSION: '36'
218     FDO_DISTRIBUTION_PACKAGES: $FEDORA_PACKAGES
219     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
220
221 debian:stable@container-prep:
222   extends:
223     - .fdo.container-build@debian
224     - .policy
225   stage: prep
226   variables:
227     GIT_STRATEGY: none
228     FDO_DISTRIBUTION_VERSION: 'stable'
229     FDO_DISTRIBUTION_PACKAGES: $DEBIAN_PACKAGES
230     FDO_DISTRIBUTION_TAG: $DEBIAN_TAG
231
232 ubuntu:22.04@container-prep:
233   extends:
234     - .fdo.container-build@ubuntu
235     - .policy
236   stage: prep
237   variables:
238     GIT_STRATEGY: none
239     FDO_DISTRIBUTION_VERSION: '22.04'
240     FDO_DISTRIBUTION_PACKAGES: $UBUNTU_PACKAGES
241     FDO_DISTRIBUTION_TAG: $UBUNTU_TAG
242
243 arch:rolling@container-prep:
244   extends:
245     - .fdo.container-build@arch
246     - .policy
247   stage: prep
248   variables:
249     GIT_STRATEGY: none
250     FDO_DISTRIBUTION_VERSION: 'rolling'
251     FDO_DISTRIBUTION_PACKAGES: $ARCH_PACKAGES
252     FDO_DISTRIBUTION_TAG: $ARCH_TAG
253
254 alpine:latest@container-prep:
255   extends:
256     - .fdo.container-build@alpine
257     - .policy
258   stage: prep
259   variables:
260     GIT_STRATEGY: none
261     FDO_DISTRIBUTION_VERSION: 'latest'
262     FDO_DISTRIBUTION_PACKAGES: $ALPINE_PACKAGES
263     FDO_DISTRIBUTION_TAG: $ALPINE_TAG
264
265 freebsd:13.1@container-prep:
266   extends:
267     - .fdo.qemu-build@freebsd
268     - .policy
269   tags:
270     - kvm
271   stage: prep
272   variables:
273     GIT_STRATEGY: none
274     FDO_DISTRIBUTION_VERSION: '13.1'
275     FDO_DISTRIBUTION_PACKAGES: $FREEBSD_PACKAGES
276     FDO_DISTRIBUTION_TAG: $FREEBSD_TAG
277
278
279
280 #################################################################
281 #                                                               #
282 #                   container clean stage                       #
283 #                 run during the clean stage                    #
284 #                                                               #
285 #################################################################
286
287 #
288 # This stage will look for the container images we currently have in
289 # the registry and will remove any that are not tagged with the provided
290 # $container_image:$tag
291 #
292 .container-clean:
293   extends:
294     - .policy
295     - .fdo.ci-fairy
296   stage: container_clean
297   script:
298     # Go to your Profile, Settings, Access Tokens
299     # Create a personal token with 'api' scope, copy the value.
300     # Go to CI/CD, Schedules, schedule a new monthly job (or edit the existing one)
301     # Define a variable of type File named AUTHFILE. Content is that token
302     # value.
303     - ci-fairy -v --authfile $AUTHFILE delete-image
304             --repository $FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION
305             --exclude-tag $FDO_DISTRIBUTION_TAG
306   allow_failure: true
307   only:
308     - schedules
309
310 fedora:35@container-clean:
311   extends:
312     - .policy
313     - .container-clean
314   variables:
315     GIT_STRATEGY: none
316     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
317     FDO_DISTRIBUTION_VERSION: '35'
318     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
319
320 fedora:36@container-clean:
321   extends:
322     - .policy
323     - .container-clean
324   variables:
325     GIT_STRATEGY: none
326     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
327     FDO_DISTRIBUTION_VERSION: '36'
328     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
329
330 debian:stable@container-clean:
331   extends:
332     - .policy
333     - .container-clean
334   variables:
335     GIT_STRATEGY: none
336     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/debian/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
337     FDO_DISTRIBUTION_VERSION: 'stable'
338     FDO_DISTRIBUTION_TAG: $DEBIAN_TAG
339
340 ubuntu:22.04@container-clean:
341   extends:
342     - .policy
343     - .container-clean
344   variables:
345     GIT_STRATEGY: none
346     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/ubuntu/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
347     FDO_DISTRIBUTION_VERSION: '22.04'
348     FDO_DISTRIBUTION_TAG: $UBUNTU_TAG
349
350 arch:rolling@container-clean:
351   extends:
352     - .policy
353     - .container-clean
354   variables:
355     GIT_STRATEGY: none
356     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/arch/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
357     FDO_DISTRIBUTION_VERSION: 'rolling'
358     FDO_DISTRIBUTION_TAG: $ARCH_TAG
359
360 alpine:latest@container-clean:
361   extends:
362     - .policy
363     - .container-clean
364   variables:
365     GIT_STRATEGY: none
366     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/alpine/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
367     FDO_DISTRIBUTION_VERSION: 'latest'
368     FDO_DISTRIBUTION_TAG: $ALPINE_TAG
369
370 freebsd:13.1@container-clean:
371   extends:
372     - .policy
373     - .container-clean
374   variables:
375     GIT_STRATEGY: none
376     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/freebsd/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
377     FDO_DISTRIBUTION_VERSION: '13.1'
378     FDO_DISTRIBUTION_TAG: $FREEBSD_TAG
379
380
381 #################################################################
382 #                                                               #
383 #                       build stage                             #
384 #                                                               #
385 #################################################################
386
387 .build@template:
388   extends:
389     - .policy
390     - .default_artifacts
391   stage: build
392   script:
393     - .gitlab-ci/meson-build.sh
394
395
396 # Run meson and meson test in the container image through qemu
397 .build-in-b2c@template:
398   extends:
399     - .policy
400     - .default_artifacts
401   tags:
402     - kvm
403   variables:
404     MESON_BUILDDIR: build_dir
405     B2C_KERNEL: https://gitlab.freedesktop.org/api/v4/projects/libevdev%2Fhid-tools/packages/generic/kernel-x86_64/v5.19/bzImage
406     B2C_VERSION: v0.9.8
407     B2C_IMAGE: $FDO_DISTRIBUTION_IMAGE
408     B2C_COMMAND: .gitlab-ci/start-in-systemd.sh
409   script:
410     # first build in the host container
411     - .gitlab-ci/meson-build.sh --skip-test
412
413     # pull b2c
414     - curl -L -o /app/boot2container https://gitlab.freedesktop.org/mupuf/boot2container/-/raw/v0.9.8/vm2c.py
415     - chmod +x /app/boot2container
416
417     # runs the test suite only
418     - /app/boot2container
419
420 #
421 # Fedora
422 #
423
424 .check_tainted: &check_tainted |
425   # make sure the kernel is not tainted
426   if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
427   then
428     echo tainted kernel ;
429     exit 1 ;
430   fi
431
432 # Run meson and meson test in the qemu image
433 .build-in-qemu@template:
434   extends:
435     - .policy
436     - .fdo.distribution-image@fedora
437   tags:
438     - kvm
439   variables:
440     MESON_BUILDDIR: build_dir
441   script:
442     # start our vm, no args required
443     - /app/vmctl start || (echo "Error - Failed to start the VM." && exit 1)
444
445     - *check_tainted
446
447     - "scp -r $PWD vm:"
448     - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
449     - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
450     - echo "MESON_ARGS=\"$MESON_ARGS\"" >> sshenv
451     - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
452     - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS\"" >> sshenv
453     - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
454     - "scp sshenv vm:~/$CI_PROJECT_NAME/.meson_environment"
455     - /app/vmctl exec "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
456     # no matter the results of the tests, we want to fetch the logs
457     - scp -r vm:$CI_PROJECT_NAME/$MESON_BUILDDIR .
458
459     - *check_tainted
460
461     - /app/vmctl stop
462
463     - if [[ ! -e .success ]] ;
464       then
465         exit 1 ;
466       fi
467   artifacts:
468     name: "qemu-meson-logs-$CI_JOB_NAME"
469     when: always
470     expire_in: 1 week
471     paths:
472       - $MESON_BUILDDIR/meson-logs
473       - console.out
474     reports:
475       junit: $MESON_BUILDDIR/*junit*.xml
476
477
478 # Run in a test suite. Special variables:
479 # - SUITES: the meson test suites to run, or
480 # - SUITE_NAMES: all elements will be expanded to libinput-test-suite-$value
481 # Set one or the other, not both.
482 .test-suite-vm:
483   extends:
484     - .build-in-b2c@template
485   stage: test-suite
486   variables:
487     # remove the global --no-suite=hardware
488     MESON_TEST_ARGS: ''
489   before_script:
490     - if ! [[ -z $SUITE_NAMES ]]; then SUITES=$(echo $SUITE_NAMES | sed 's/\([^ ]*\)/libinput-test-suite-\1/g'); fi
491     - echo "Testing $SUITES"
492     - export MESON_TEST_ARGS="$MESON_TEST_ARGS $SUITES"
493     - export LITEST_JOBS="2"
494
495
496 .fedora:36@test-suite-vm:
497   extends:
498     - .fdo.distribution-image@fedora
499     - .test-suite-vm
500   variables:
501     FDO_DISTRIBUTION_VERSION: 36
502     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
503   needs:
504     - "fedora:36@container-prep"
505
506
507 vm-touchpad:
508   extends:
509     - .fedora:36@test-suite-vm
510   variables:
511     SUITE_NAMES: 'touchpad'
512
513 vm-touchpad-no-libwacom:
514   extends:
515     - vm-touchpad
516   stage: test-suite-no-libwacom
517   variables:
518     MESON_ARGS: '-Dlibwacom=false'
519
520 vm-tap:
521   extends:
522     - .fedora:36@test-suite-vm
523   variables:
524     SUITE_NAMES: 'touchpad-tap'
525
526 vm-tap-no-libwacom:
527   extends:
528     - vm-tap
529   stage: test-suite-no-libwacom
530   variables:
531     MESON_ARGS: '-Dlibwacom=false'
532
533 vm-touchpad-buttons:
534   extends:
535     - .fedora:36@test-suite-vm
536   variables:
537     SUITE_NAMES: 'touchpad-buttons'
538
539 vm-touchpad-buttons-no-libwacom:
540   extends:
541     - vm-touchpad-buttons
542   stage: test-suite-no-libwacom
543   variables:
544     MESON_ARGS: '-Dlibwacom=false'
545
546 vm-tablet:
547   extends:
548     - .fedora:36@test-suite-vm
549   variables:
550     SUITE_NAMES: 'tablet'
551
552 vm-tablet-no-libwacom:
553   extends:
554     - vm-tablet
555   stage: test-suite-no-libwacom
556   variables:
557     MESON_ARGS: '-Dlibwacom=false'
558
559 vm-gestures-device:
560   extends:
561     - .fedora:36@test-suite-vm
562   variables:
563     SUITE_NAMES: 'gestures device'
564
565 vm-gestures-device-no-libwacom:
566   extends:
567     - vm-gestures-device
568   stage: test-suite-no-libwacom
569   variables:
570     MESON_ARGS: '-Dlibwacom=false'
571
572 vm-backends:
573   extends:
574     - .fedora:36@test-suite-vm
575   variables:
576     SUITE_NAMES: 'path udev'
577
578 vm-backends-no-libwacom:
579   extends:
580     - vm-backends
581   stage: test-suite-no-libwacom
582   variables:
583     MESON_ARGS: '-Dlibwacom=false'
584
585 vm-misc:
586   extends:
587     - .fedora:36@test-suite-vm
588   variables:
589     SUITE_NAMES: 'log misc quirks'
590
591 vm-misc-no-libwacom:
592   extends:
593     - vm-misc
594   stage: test-suite-no-libwacom
595   variables:
596     MESON_ARGS: '-Dlibwacom=false'
597
598 vm-other devices:
599   extends:
600     - .fedora:36@test-suite-vm
601   variables:
602     SUITE_NAMES: 'keyboard pad switch trackball trackpoint totem touch'
603
604 vm-other devices-no-libwacom:
605   extends:
606     - vm-other devices
607   stage: test-suite-no-libwacom
608   variables:
609     MESON_ARGS: '-Dlibwacom=false'
610
611 vm-pointer:
612   extends:
613     - .fedora:36@test-suite-vm
614   variables:
615     SUITE_NAMES: 'pointer'
616
617 vm-pointer-no-libwacom:
618   extends:
619     - vm-pointer
620   stage: test-suite-no-libwacom
621   variables:
622     MESON_ARGS: '-Dlibwacom=false'
623
624
625 vm-valgrind-touchpad:
626   stage: valgrind
627   extends:
628     - vm-touchpad
629   variables:
630     MESON_TEST_ARGS: '--setup=valgrind'
631     LITEST_JOBS: 4
632
633 vm-valgrind-tap:
634   stage: valgrind
635   extends:
636     - vm-tap
637   variables:
638     MESON_TEST_ARGS: '--setup=valgrind'
639     LITEST_JOBS: 4
640
641 vm-valgrind-touchpad-buttons:
642   stage: valgrind
643   extends:
644     - vm-touchpad-buttons
645   variables:
646     MESON_TEST_ARGS: '--setup=valgrind'
647     LITEST_JOBS: 4
648
649 vm-valgrind-tablet:
650   stage: valgrind
651   extends:
652     - vm-tablet
653   variables:
654     MESON_TEST_ARGS: '--setup=valgrind'
655     LITEST_JOBS: 4
656
657 vm-valgrind-gestures-device:
658   stage: valgrind
659   extends:
660     - vm-gestures-device
661   variables:
662     MESON_TEST_ARGS: '--setup=valgrind'
663     LITEST_JOBS: 4
664
665 vm-valgrind-backends:
666   stage: valgrind
667   extends:
668     - vm-backends
669   variables:
670     MESON_TEST_ARGS: '--setup=valgrind'
671     LITEST_JOBS: 4
672
673 vm-valgrind-misc:
674   stage: valgrind
675   extends:
676     - vm-misc
677   variables:
678     MESON_TEST_ARGS: '--setup=valgrind'
679     LITEST_JOBS: 4
680
681 vm-valgrind-other devices:
682   stage: valgrind
683   extends:
684     - vm-other devices
685   variables:
686     MESON_TEST_ARGS: '--setup=valgrind'
687     LITEST_JOBS: 4
688
689 vm-valgrind-pointer:
690   stage: valgrind
691   extends:
692     - vm-pointer
693   variables:
694     MESON_TEST_ARGS: '--setup=valgrind'
695     LITEST_JOBS: 4
696
697
698 .fedora-build@template:
699   extends:
700     - .fdo.distribution-image@fedora
701     - .build@template
702   variables:
703     FDO_DISTRIBUTION_VERSION: '36'
704     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
705   needs:
706     - "fedora:36@container-prep"
707
708 default-build-release@fedora:36:
709   stage: distro
710   extends:
711     - .fedora-build@template
712   variables:
713     MESON_ARGS: "-Dbuildtype=release"
714     CFLAGS: "-Werror"
715
716 scan-build@fedora:36:
717   extends:
718     - .fedora-build@template
719   variables:
720     NINJA_ARGS: ''
721     MESON_TEST_ARGS: ''
722   script:
723     - .gitlab-ci/meson-build.sh
724     - export SCANBUILD="$PWD/.gitlab-ci/scanbuild-wrapper.sh"
725     - ninja -C "$MESON_BUILDDIR" scan-build
726   after_script:
727     - .gitlab-ci/scanbuild-plist-to-junit.py "$MESON_BUILDDIR"/meson-logs/scanbuild/ > "$MESON_BUILDDIR"/junit-scan-build.xml
728
729 # Below jobs are build option combinations. We only
730 # run them on one image, they shouldn't fail on one distro
731 # when they succeed on another.
732
733 build-no-libwacom@fedora:36:
734   extends:
735     - .fedora-build@template
736   variables:
737     MESON_ARGS: "-Dlibwacom=false"
738
739 build-no-libwacom-nodeps@fedora:36:
740   extends:
741     - .fedora-build@template
742   variables:
743     MESON_ARGS: "-Dlibwacom=false"
744   before_script:
745     - dnf remove -y libwacom libwacom-devel
746
747 build-docs@fedora:36:
748   extends:
749     - .fedora-build@template
750   variables:
751     MESON_ARGS: "-Ddocumentation=true"
752
753 build-no-docs-nodeps@fedora:36:
754   extends:
755     - .fedora-build@template
756   variables:
757     MESON_ARGS: "-Ddocumentation=false"
758   before_script:
759     - dnf remove -y doxygen graphviz
760
761 build-no-debuggui@fedora:36:
762   extends:
763     - .fedora-build@template
764   variables:
765     MESON_ARGS: "-Ddebug-gui=false"
766
767 build-no-debuggui-nodeps@fedora:36:
768   extends:
769     - .fedora-build@template
770   variables:
771     MESON_ARGS: "-Ddebug-gui=false"
772   before_script:
773     - dnf remove -y gtk3-devel gtk4-devel
774
775 build-no-tests@fedora:36:
776   extends:
777     - .fedora-build@template
778   variables:
779     MESON_ARGS: "-Dtests=false"
780
781 build-no-tests-nodeps@fedora:36:
782   extends:
783     - .fedora-build@template
784   variables:
785     MESON_ARGS: "-Dtests=false"
786   before_script:
787     - dnf remove -y check-devel
788
789 valgrind@fedora:36:
790   extends:
791     - .fedora-build@template
792   variables:
793     MESON_TEST_ARGS: '--suite=valgrind --no-suite=hardware --setup=valgrind'
794
795 # Python checks, only run on Fedora
796
797 usr-bin-env-python@fedora:36:
798   extends:
799     - .fedora-build@template
800   script:
801     - |
802       if git grep -l '^#!/usr/bin/python'; then
803         echo "Use '/usr/bin/env python3' in the above files";
804         /bin/false
805       fi
806
807 python-format@fedora:36:
808   extends:
809     - .fedora-build@template
810   script:
811     - black $(git grep -l '^#!/usr/bin/env python3')
812     - git diff --exit-code || (echo "Please run Black against all Python files" && false)
813
814 # A job to check we're actually running all test suites in the CI
815 check-test-suites:
816   extends:
817     - .fedora-build@template
818   script:
819     - meson builddir
820     - meson introspect builddir --test | jq -r '.[].name' | grep 'libinput-test-suite' | sort > meson-testsuites
821     - |
822       cat <<EOF > ci-testsuites ;
823         libinput-test-suite-touchpad
824         libinput-test-suite-touchpad-tap
825         libinput-test-suite-touchpad-buttons
826         libinput-test-suite-tablet
827         libinput-test-suite-gestures
828         libinput-test-suite-device
829         libinput-test-suite-path
830         libinput-test-suite-udev
831         libinput-test-suite-log
832         libinput-test-suite-misc
833         libinput-test-suite-quirks
834         libinput-test-suite-keyboard
835         libinput-test-suite-pad
836         libinput-test-suite-switch
837         libinput-test-suite-trackball
838         libinput-test-suite-trackpoint
839         libinput-test-suite-totem
840         libinput-test-suite-touch
841         libinput-test-suite-pointer
842       EOF
843     - sort -o ci-testsuites ci-testsuites
844     - diff -u8 -w ci-testsuites meson-testsuites || (echo "Some test suites are not run in the CI" && false)
845   only:
846     changes:
847       - "meson.build"
848       - ".gitlab-ci.yml"
849
850 #
851 # coverity run
852 #
853 # This requires the COVERITY_SCAN_TOKEN. Log into scan.coverity.com and get
854 # the token from the respective project settings page.
855 # Schedule a pipeline and set a variable COVERITY_SCAN_TOKEN with the token value.
856 # https://gitlab.freedesktop.org/$CI_PROJECT_PATH/-/pipeline_schedules
857 # Email from coverity will be sent to the GITLAB_USER_EMAIL that scheduled the
858 # job.
859 #
860 # Coverity ratelimits submissions and the coverity tools download is about
861 # 700M, do not run this too often.
862 #
863 coverity:
864   extends:
865     - .fdo.distribution-image@debian
866     - .policy
867   stage: build
868   variables:
869     FDO_DISTRIBUTION_VERSION: 'stable'
870     FDO_DISTRIBUTION_TAG: $DEBIAN_TAG
871     # so git-describe works, or should work
872     GIT_DEPTH: 200
873   only:
874     variables:
875       - $COVERITY_SCAN_TOKEN
876   script:
877     - curl https://scan.coverity.com/download/linux64
878         -o /tmp/cov-analysis-linux64.tgz
879         --form project=$CI_PROJECT_NAME
880         --form token=$COVERITY_SCAN_TOKEN
881     - tar xfz /tmp/cov-analysis-linux64.tgz
882     # coverity has special build options in meson, make sure we enable those
883     - meson coverity-build -Ddocumentation=false -Dcoverity=true
884     - cov-analysis-linux64-*/bin/cov-build --dir cov-int  ninja -C coverity-build
885     - tar cfz cov-int.tar.gz cov-int
886     - curl https://scan.coverity.com/builds?project=$CI_PROJECT_NAME
887         --form token=$COVERITY_SCAN_TOKEN --form email=$GITLAB_USER_EMAIL
888         --form file=@cov-int.tar.gz --form version="$(git describe --tags)"
889         --form description="$(git describe --tags) / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID"
890   artifacts:
891     name: "coverity-submit-data"
892     when: always
893     expire_in: 1 week
894     paths:
895       - cov-int.tar.gz
896   needs:
897     - "debian:stable@container-prep"
898
899 #################################################################
900 #                                                               #
901 #                        distro stage                           #
902 #                                                               #
903 #################################################################
904
905 fedora:35@default-build:
906   stage: distro
907   extends:
908     - .build@template
909     - .fdo.distribution-image@fedora
910   variables:
911     FDO_DISTRIBUTION_VERSION: '35'
912     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
913   needs:
914     - "fedora:35@container-prep"
915
916
917 fedora:36@default-build:
918   stage: distro
919   extends:
920     - .build@template
921     - .fdo.distribution-image@fedora
922   variables:
923     FDO_DISTRIBUTION_VERSION: '36'
924     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
925   needs:
926     - "fedora:36@container-prep"
927
928
929 debian:stable@default-build:
930   stage: distro
931   extends:
932     - .build@template
933     - .fdo.distribution-image@debian
934   variables:
935     FDO_DISTRIBUTION_VERSION: 'stable'
936     FDO_DISTRIBUTION_TAG: $DEBIAN_TAG
937   needs:
938     - "debian:stable@container-prep"
939
940
941 ubuntu:22.04@default-build:
942   stage: distro
943   extends:
944     - .build@template
945     - .fdo.distribution-image@ubuntu
946   variables:
947     FDO_DISTRIBUTION_VERSION: '22.04'
948     FDO_DISTRIBUTION_TAG: $UBUNTU_TAG
949   needs:
950     - "ubuntu:22.04@container-prep"
951
952
953 arch:rolling@default-build:
954   stage: distro
955   extends:
956     - .build@template
957     - .fdo.distribution-image@arch
958   variables:
959     FDO_DISTRIBUTION_VERSION: 'rolling'
960     FDO_DISTRIBUTION_TAG: $ARCH_TAG
961   needs:
962     - "arch:rolling@container-prep"
963
964
965 alpine:latest@default-build:
966   stage: distro
967   extends:
968     - .build@template
969     - .fdo.distribution-image@alpine
970   variables:
971     FDO_DISTRIBUTION_VERSION: 'latest'
972     FDO_DISTRIBUTION_TAG: $ALPINE_TAG
973     MESON_ARGS: '-Ddocumentation=false' # alpine does not have python-recommonmark
974     MESON_TEST_ARGS: '' # litest-selftest fails on musl
975   needs:
976     - "alpine:latest@container-prep"
977
978
979 freebsd:13.1@default-build:
980   stage: distro
981   extends:
982     - .build-in-qemu@template
983     - .fdo.distribution-image@freebsd
984   variables:
985     FDO_DISTRIBUTION_VERSION: '13.1'
986     FDO_DISTRIBUTION_TAG: $FREEBSD_TAG
987     MESON_ARGS: '-Dtests=false -Ddocumentation=false' # doxygen drags down too many deps
988     MESON_TEST_ARGS: '' # test suite doesn't work on BSD yet
989   needs:
990     - "freebsd:13.1@container-prep"
991
992
993 #################################################################
994 #                                                               #
995 #                        deploy stage                           #
996 #                                                               #
997 #################################################################
998
999 #
1000 # Verify that the merge request has the allow-collaboration checkbox ticked
1001 #
1002
1003 check-merge-request:
1004   extends:
1005     - .fdo.ci-fairy
1006     - .policy
1007   stage: deploy
1008   script:
1009     - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
1010   artifacts:
1011     when: on_failure
1012     reports:
1013       junit: results.xml
1014   allow_failure: true
1015
1016 build rpm:
1017   extends:
1018     - .fdo.distribution-image@fedora
1019     - .policy
1020   stage: deploy
1021   variables:
1022     FDO_DISTRIBUTION_VERSION: '36'
1023     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
1024   needs:
1025     - "fedora:36@container-prep"
1026   script:
1027     - meson "$MESON_BUILDDIR"
1028     - VERSION=$(meson introspect "$MESON_BUILDDIR" --projectinfo | jq -r .version)
1029     - sed -e "s/@PIPELINEID@/${CI_PIPELINE_ID}/"
1030           -e "s/@GITVERSION@/${CI_COMMIT_SHA}/"
1031           -e "s/@VERSION@/${VERSION}/" .gitlab-ci/libinput.spec.in > libinput.spec
1032     - git config --local user.name 'gitlab CI'
1033     - git config --local user.email 'noreply@nowhere'
1034     - git add libinput.spec && git commit -m 'Add libinput.spec for build testing' libinput.spec
1035     - cd "$MESON_BUILDDIR"
1036     - meson dist --no-test
1037     - rpmbuild -ta meson-dist/libinput*.tar.xz
1038
1039
1040 wayland-web:
1041   stage: deploy
1042   trigger: wayland/wayland.freedesktop.org
1043   except:
1044     refs:
1045       - schedules
1046   variables:
1047     MESON_ARGS: '-Ddocumentation=true -Ddebug-gui=false -Dlibwacom=false -Dtests=false'
1048     MESON_BUILDDIR: 'builddir'
1049   only:
1050     refs:
1051       - main
1052     variables:
1053       - $CI_PROJECT_PATH == "libinput/libinput"