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