ci: use ci-fairy to generate the template, not a custom script
[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 #
10 # This is a bit complicated for two reasons:
11 # - we really want to run dnf/apt/... only once, updating on the test runner for
12 #   each job takes forever. So we create a container image for each distribution
13 #   tested, then run the tests on this container image.
14 #
15 #   Creating a container image is time-consuming, so we only do so for pushes to
16 #   libinput directly (not merge requests) and if the current image is 'old'.
17 #
18 # - GitLab only allows one script: set per job but we have a bunch of commands
19 #   we need to re-run for each build (meson && ninja && etc). YAML cannot merge
20 #   arrays templates so we're screwed.
21 #
22 #   So instead we use a default_build template and override everything with
23 #   variables. The only two variables that matter:
24 #     MESON_ARGS=-Denable-something=true
25 #     NINJA_ARGS=dist ... to run 'ninja -C builddir dist'
26 #   Note that you cannot use scripts: in any target if you expect default_build
27 #   to work.
28 #
29 #
30 # All jobs must follow the naming scheme of
31 # <distribution>:<version>@activity:
32 #  e.g. fedora:31@build-default
33
34 .templates_sha: &template_sha 395535ce90eb48e260c0dff12c35d9237e22c539 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
35
36 include:
37   # Alpine container builder template
38   - project: 'freedesktop/ci-templates'
39     ref: *template_sha
40     file: '/templates/alpine.yml'
41   # Arch container builder template
42   - project: 'freedesktop/ci-templates'
43     ref: *template_sha
44     file: '/templates/arch.yml'
45   # Fedora container builder template
46   - project: 'freedesktop/ci-templates'
47     ref: *template_sha
48     file: '/templates/fedora.yml'
49   # Ubuntu container builder template
50   - project: 'freedesktop/ci-templates'
51     ref: *template_sha
52     file: '/templates/ubuntu.yml'
53
54 stages:
55   - prep             # prep work like rebuilding the container images if there is a change
56   - build            # for actually building and testing things in a container
57   - VM               # for running the test suite in a VM
58   - valgrind         # for running the test suite under valgrind in a VM
59   - distro           # distribs test
60   - deploy           # trigger wayland's website generation
61   - container_clean  # clean up unused container images
62
63 variables:
64   ###############################################################################
65   # This is the list of packages required to build libinput with the default    #
66   # configuration.                                                              #
67   #                                                                             #
68   # Run dnf install/apt-get install/.. with the list of packages for your       #
69   # distribution                                                                #
70   #                                                                             #
71   # See the documentation here:                                                 #
72   # https://wayland.freedesktop.org/libinput/doc/latest/building_libinput.html  #
73   ###############################################################################
74   FEDORA_PACKAGES:    'git 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   gtk3-devel   glib2-devel    mtdev-devel diffutils'
75   FEDORA_QEMU_RPMS:   'git 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   gtk3-devel   glib2-devel    mtdev-devel diffutils valgrind'
76   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'
77   ARCH_PACKAGES:      'git gcc         pkgconfig          meson check       libsystemd    libevdev       doxygen graphviz python-sphinx  python-recommonmark  python-sphinx_rtd_theme  python-pytest-xdist  libwacom                     gtk3                        mtdev      diffutils'
78   FREEBSD_BUILD_PKGS: 'meson'
79   FREEBSD_PKGS:       'libepoll-shim                                        libudev-devd  libevdev                                                                                     libwacom                     gtk3                        libmtdev   '
80   ALPINE_PACKAGES:    'git gcc build-base pkgconfig       meson check-dev   eudev-dev     libevdev-dev                                                                                 libwacom-dev   cairo-dev     gtk+3.0-dev  mtdev-dev bash'
81   ############################ end of package lists #############################
82
83   # these tags should be updated each time the list of packages is updated
84   # changing these will force rebuilding the associated image
85   # Note: these tags have no meaning and are not tied to a particular
86   # libinput version
87   FEDORA_TAG:  '2020-03-17.0'
88   UBUNTU_TAG:  '2020-03-17.0'
89   ARCH_TAG:    '2020-03-17.0'
90   ALPINE_TAG:  '2020-03-17.0'
91   FREEBSD_TAG: '2020-03-17.0'
92   QEMU_TAG:    'qemu-vm-2020-03-17.0'
93
94   UBUNTU_EXEC: "bash .gitlab-ci/ubuntu_install.sh $UBUNTU_CUSTOM_DEBS"
95
96   FREEBSD_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/freebsd/11.2:$FREEBSD_TAG
97   FDO_UPSTREAM_REPO: libinput/libinput
98
99   MESON_BUILDDIR: "build dir"
100   NINJA_ARGS: ''
101   MESON_ARGS: ''
102   MESON_TEST_ARGS: '--no-suite=hardware'
103
104   # udev isn't available/working properly in the containers
105   UDEV_NOT_AVAILABLE: 1
106   GIT_DEPTH: 1
107
108 .policy:
109   retry:
110     max: 2
111     when:
112       - runner_system_failure
113       - stuck_or_timeout_failure
114   # cancel run when a newer version is pushed to the branch
115   interruptible: true
116
117 .default_artifacts:
118   artifacts:
119     name: "meson-logs-$CI_JOB_NAME"
120     when: always
121     expire_in: 1 week
122     paths:
123       - $MESON_BUILDDIR/meson-logs
124     reports:
125       junit: $MESON_BUILDDIR/junit-*.xml
126
127 #################################################################
128 #                                                               #
129 #                          prep stage                           #
130 #                                                               #
131 #################################################################
132
133 # Re-generate the CI script and make sure it's the one currently checked in
134 # If this job fails, re-generate the gitlab-ci.yml script, see
135 # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
136 #
137 check-ci-script:
138   image: golang:alpine
139   stage: prep
140   before_script:
141     - apk add python3 git
142     - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
143   script:
144     - ci-fairy generate-template --config .gitlab-ci/config.yml .gitlab-ci/gitlab-ci.tmpl -o .gitlab-ci.yml
145     - git diff --exit-code && exit 0 || true
146     - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
147     - exit 1
148
149 #
150 # Verify that commit messages are as expected, signed-off, etc.
151 #
152
153 check-commit:
154   image: golang:alpine
155   stage: prep
156   before_script:
157     - apk add python3 git
158   script:
159     - pip3 install GitPython
160     - pip3 install pytest
161     - |
162       pytest --junitxml=results.xml \
163              --tb=line \
164              --assert=plain \
165              ./.gitlab-ci/check-commit.py
166   except:
167     - master@libinput/libinput
168   variables:
169     GIT_DEPTH: 100
170   artifacts:
171     reports:
172       junit: results.xml
173
174 #
175 # This stage will recreate the container images only if the image
176 # is too old or if it is missing some dependencies.
177 #
178
179 .rebuild_for_schedule:
180   before_script:
181     # force rebuild if schedule, reuse otherwise
182     - if [[ $CI_PIPELINE_SOURCE == "schedule" ]] ; then export FDO_FORCE_REBUILD=1; fi
183
184 fedora:30@qemu-prep:
185   extends:
186     - .fdo.qemu-build@fedora
187     - .policy
188     - .rebuild_for_schedule
189   stage: prep
190   tags:
191     - kvm
192   variables:
193     GIT_STRATEGY: none
194     FDO_DISTRIBUTION_VERSION: 30
195     FDO_DISTRIBUTION_TAG: $QEMU_TAG
196     FDO_DISTRIBUTION_PACKAGES: $FEDORA_QEMU_RPMS
197   allow_failure: true
198
199 fedora:30@container-prep:
200   extends:
201     - .fdo.container-build@fedora
202     - .policy
203     - .rebuild_for_schedule
204   stage: prep
205   variables:
206     GIT_STRATEGY: none
207     FDO_DISTRIBUTION_VERSION: '30'
208     FDO_DISTRIBUTION_PACKAGES: $FEDORA_PACKAGES
209     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
210
211 fedora:31@container-prep:
212   extends:
213     - .fdo.container-build@fedora
214     - .policy
215     - .rebuild_for_schedule
216   stage: prep
217   variables:
218     GIT_STRATEGY: none
219     FDO_DISTRIBUTION_VERSION: '31'
220     FDO_DISTRIBUTION_PACKAGES: $FEDORA_PACKAGES
221     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
222
223 ubuntu:19.10@container-prep:
224   extends:
225     - .fdo.container-build@ubuntu
226     - .policy
227     - .rebuild_for_schedule
228   stage: prep
229   variables:
230     GIT_STRATEGY: none
231     FDO_DISTRIBUTION_VERSION: '19.10'
232     FDO_DISTRIBUTION_PACKAGES: $UBUNTU_PACKAGES
233     FDO_DISTRIBUTION_TAG: $UBUNTU_TAG
234
235 ubuntu:19.04@container-prep:
236   extends:
237     - .fdo.container-build@ubuntu
238     - .policy
239     - .rebuild_for_schedule
240   stage: prep
241   variables:
242     GIT_STRATEGY: none
243     FDO_DISTRIBUTION_VERSION: '19.04'
244     FDO_DISTRIBUTION_PACKAGES: $UBUNTU_PACKAGES
245     FDO_DISTRIBUTION_TAG: $UBUNTU_TAG
246
247 arch:rolling@container-prep:
248   extends:
249     - .fdo.container-build@arch
250     - .policy
251     - .rebuild_for_schedule
252   stage: prep
253   variables:
254     GIT_STRATEGY: none
255     FDO_DISTRIBUTION_VERSION: 'rolling'
256     FDO_DISTRIBUTION_PACKAGES: $ARCH_PACKAGES
257     FDO_DISTRIBUTION_TAG: $ARCH_TAG
258
259 alpine:latest@container-prep:
260   extends:
261     - .fdo.container-build@alpine
262     - .policy
263     - .rebuild_for_schedule
264   stage: prep
265   variables:
266     GIT_STRATEGY: none
267     FDO_DISTRIBUTION_VERSION: 'latest'
268     FDO_DISTRIBUTION_PACKAGES: $ALPINE_PACKAGES
269     FDO_DISTRIBUTION_TAG: $ALPINE_TAG
270
271
272
273 # Note that we want to use the latest buildah image, and for that
274 # we use one of the .fdo.container-build@distribution by replacing the
275 # `script`.
276 .freebsd@container-prep:
277   extends:
278     - .policy
279     - .fdo.container-build@fedora
280   stage: prep
281   script:
282     # log in to the registry
283     - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
284
285     # get the full container image name
286     - export IMAGE=freebsd/$FREEBSD_VERSION:$FREEBSD_TAG
287
288     # force rebuild if schedule, reuse otherwise
289     - if [[ $CI_PIPELINE_SOURCE == "schedule" ]] ; then touch .scheduled; fi
290
291     # pull the latest upstream image if it exists
292     - test -e .scheduled || skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
293                                  docker://$CI_REGISTRY/$FDO_UPSTREAM_REPO/$IMAGE
294                                  docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
295
296     # check if our image is already in the current registry
297     - test -e .scheduled || skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
298
299     - export BUILDAH_RUN="buildah run --isolation chroot"
300     - export BUILDAH_COMMIT="buildah commit --format docker"
301     - buildcntr=$(buildah from --quiet  myfreeweb/freebsd-cross:latest)
302     - $BUILDAH_RUN $buildcntr apk add --no-cache $FREEBSD_BUILD_PKGS
303     - $BUILDAH_RUN $buildcntr pkg -r /freebsd update -f
304     - $BUILDAH_RUN $buildcntr pkg -r /freebsd install -y $FREEBSD_PKGS
305     - buildah config --workingdir /app $buildcntr
306     # tag the current container
307     - $BUILDAH_COMMIT $buildcntr $FREEBSD_CONTAINER_IMAGE
308     # clean up the working container
309     - buildah rm $buildcntr
310
311     # push the container image to the libinput registry
312     - podman push --quiet $FREEBSD_CONTAINER_IMAGE
313     - skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
314         docker://$FREEBSD_CONTAINER_IMAGE
315         docker://$CI_REGISTRY_IMAGE/freebsd/$FREEBSD_VERSION:$CI_JOB_ID
316
317 freebsd:11.2@container-prep:
318   extends:
319     - .freebsd@container-prep
320   variables:
321     GIT_STRATEGY: none
322     FREEBSD_VERSION: "11.2"
323
324
325 #################################################################
326 #                                                               #
327 #                   container clean stage                       #
328 #                 run during the clean stage                    #
329 #                                                               #
330 #################################################################
331
332 #
333 # This stage will look for the container images we currently have in
334 # the registry and will remove any that are not tagged with the provided
335 # $container_image:$tag
336 #
337 .container-clean:
338   stage: container_clean
339   extends:
340     - .policy
341   image: golang:alpine
342   before_script:
343     - apk add python3 git
344     - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
345   script:
346     # Go to your Profile, Settings, Access Tokens
347     # Create a personal token with 'api' scope, copy the value.
348     # Go to CI/CD, Schedules, schedule a new monthly job (or edit the existing one)
349     # Define a variable of type File named AUTHFILE. Content is that token
350     # value.
351     - ci-fairy -v --authfile $AUTHFILE delete-image
352             --repository $FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION
353             --exclude-tag $FDO_DISTRIBUTION_TAG
354   dependencies: []
355   allow_failure: true
356   only:
357     - schedules
358
359 fedora:30@container-clean:
360   extends:
361     - .container-clean
362   variables:
363     GIT_STRATEGY: none
364     FEDORA_VERSION: '30'
365     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
366     FDO_DISTRIBUTION_VERSION: '30'
367     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
368
369 fedora:31@container-clean:
370   extends:
371     - .container-clean
372   variables:
373     GIT_STRATEGY: none
374     FEDORA_VERSION: '31'
375     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
376     FDO_DISTRIBUTION_VERSION: '31'
377     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
378
379 ubuntu:19.10@container-clean:
380   extends:
381     - .container-clean
382   variables:
383     GIT_STRATEGY: none
384     UBUNTU_VERSION: '19.10'
385     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/ubuntu/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
386     FDO_DISTRIBUTION_VERSION: '19.10'
387     FDO_DISTRIBUTION_TAG: $UBUNTU_TAG
388
389 ubuntu:19.04@container-clean:
390   extends:
391     - .container-clean
392   variables:
393     GIT_STRATEGY: none
394     UBUNTU_VERSION: '19.04'
395     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/ubuntu/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
396     FDO_DISTRIBUTION_VERSION: '19.04'
397     FDO_DISTRIBUTION_TAG: $UBUNTU_TAG
398
399 arch:rolling@container-clean:
400   extends:
401     - .container-clean
402   variables:
403     GIT_STRATEGY: none
404     ARCH_VERSION: 'rolling'
405     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/arch/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
406     FDO_DISTRIBUTION_VERSION: 'rolling'
407     FDO_DISTRIBUTION_TAG: $ARCH_TAG
408
409 alpine:latest@container-clean:
410   extends:
411     - .container-clean
412   variables:
413     GIT_STRATEGY: none
414     ALPINE_VERSION: 'latest'
415     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/alpine/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
416     FDO_DISTRIBUTION_VERSION: 'latest'
417     FDO_DISTRIBUTION_TAG: $ALPINE_TAG
418
419
420 freebsd:11.2@container-clean:
421   extends:
422     - .container-clean
423   variables:
424     GIT_STRATEGY: none
425     CURRENT_CONTAINER_IMAGE: $FREEBSD_CONTAINER_IMAGE
426
427 #################################################################
428 #                                                               #
429 #                       build stage                             #
430 #                                                               #
431 #################################################################
432
433 .build@template:
434   extends:
435     - .policy
436     - .default_artifacts
437   stage: build
438   script:
439     - .gitlab-ci/meson-build.sh
440   dependencies: []
441
442 #
443 # Fedora
444 #
445
446 .check_tainted: &check_tainted |
447   # make sure the kernel is not tainted
448   if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
449   then
450     echo tainted kernel ;
451     exit 1 ;
452   fi
453
454 # Run in a test suite. Special variables:
455 # - SUITES: the meson test suites to run, or
456 # - SUITE_NAMES: all elements will be expanded to libinput-test-suite-$value
457 # Set one or the other, not both.
458 .test-suite-vm:
459   extends:
460     - .policy
461     - .fdo.distribution-image@fedora
462   stage: VM
463   tags:
464     - kvm
465   variables:
466     MESON_BUILDDIR: build_dir
467     # remove the global --no-suite=hardware
468     MESON_TEST_ARGS: ''
469   before_script:
470     - if ! [[ -z $SUITE_NAMES ]]; then SUITES=$(echo $SUITE_NAMES | sed 's/\([^ ]*\)/libinput-test-suite-\1/g'); fi
471     - echo "Testing $SUITES"
472   script:
473     # start our vm, no args required
474     - /app/start_vm.sh || (echo "Error - Failed to start the VM." && exit 1)
475
476     - *check_tainted
477
478     - "scp -P 5555 -r $PWD localhost:"
479     - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
480     - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
481     - echo "MESON_ARGS=\"$MESON_ARGS\"" >> sshenv
482     - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
483     - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS $SUITES\"" >> sshenv
484     - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
485     - "scp -P 5555 sshenv localhost:~/$CI_PROJECT_NAME/.meson_environment"
486     - ssh localhost -p 5555 "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
487     # no matter the results of the tests, we want to fetch the logs
488     - scp -P 5555 -r localhost:$CI_PROJECT_NAME/$MESON_BUILDDIR .
489
490     - *check_tainted
491
492     - ssh localhost -p 5555 halt || true
493     - sleep 2
494     - pkill qemu || true
495
496     - if [[ ! -e .success ]] ;
497       then
498         exit 1 ;
499       fi
500   artifacts:
501     name: "qemu-meson-logs-$CI_JOB_NAME"
502     when: always
503     expire_in: 1 week
504     paths:
505       - $MESON_BUILDDIR/meson-logs
506       - console.out
507     reports:
508       junit: $MESON_BUILDDIR/junit-*.xml
509
510   allow_failure: true
511   retry:
512     max: 2
513     when: script_failure
514
515
516 .fedora:30@test-suite-vm:
517   extends:
518     - .test-suite-vm
519   variables:
520     FDO_DISTRIBUTION_VERSION: 30
521     FDO_DISTRIBUTION_TAG: $QEMU_TAG
522   needs: ['fedora:30@qemu-prep']
523
524
525 vm-touchpad:
526   extends:
527     - .fedora:30@test-suite-vm
528   variables:
529     SUITE_NAMES: 'touchpad'
530
531 vm-touchpad-no-libwacom:
532   extends:
533     - vm-touchpad
534   variables:
535     MESON_ARGS: '-Dlibwacom=false'
536
537 vm-tap:
538   extends:
539     - .fedora:30@test-suite-vm
540   variables:
541     SUITE_NAMES: 'tap'
542
543 vm-tap-no-libwacom:
544   extends:
545     - vm-tap
546   variables:
547     MESON_ARGS: '-Dlibwacom=false'
548
549 vm-tablet:
550   extends:
551     - .fedora:30@test-suite-vm
552   variables:
553     SUITE_NAMES: 'tablet'
554
555 vm-tablet-no-libwacom:
556   extends:
557     - vm-tablet
558   variables:
559     MESON_ARGS: '-Dlibwacom=false'
560
561 vm-gestures-device:
562   extends:
563     - .fedora:30@test-suite-vm
564   variables:
565     SUITE_NAMES: 'gestures device'
566
567 vm-gestures-device-no-libwacom:
568   extends:
569     - vm-gestures-device
570   variables:
571     MESON_ARGS: '-Dlibwacom=false'
572
573 vm-others:
574   extends:
575     - .fedora:30@test-suite-vm
576   variables:
577     SUITE_NAMES: 'context config misc events totem udev lid log timer tablet-mode quirks trackball pad path keyboard switch touch trackpoint'
578
579 vm-others-no-libwacom:
580   extends:
581     - vm-others
582   variables:
583     MESON_ARGS: '-Dlibwacom=false'
584
585 vm-pointer:
586   extends:
587     - .fedora:30@test-suite-vm
588   variables:
589     SUITE_NAMES: 'pointer'
590
591 vm-pointer-no-libwacom:
592   extends:
593     - vm-pointer
594   variables:
595     MESON_ARGS: '-Dlibwacom=false'
596
597
598 vm-valgrind-touchpad:
599   stage: valgrind
600   extends:
601     - vm-touchpad
602   variables:
603     MESON_TEST_ARGS: '--setup=valgrind'
604
605 vm-valgrind-tap:
606   stage: valgrind
607   extends:
608     - vm-tap
609   variables:
610     MESON_TEST_ARGS: '--setup=valgrind'
611
612 vm-valgrind-tablet:
613   stage: valgrind
614   extends:
615     - vm-tablet
616   variables:
617     MESON_TEST_ARGS: '--setup=valgrind'
618
619 vm-valgrind-gestures-device:
620   stage: valgrind
621   extends:
622     - vm-gestures-device
623   variables:
624     MESON_TEST_ARGS: '--setup=valgrind'
625
626 vm-valgrind-others:
627   stage: valgrind
628   extends:
629     - vm-others
630   variables:
631     MESON_TEST_ARGS: '--setup=valgrind'
632
633 vm-valgrind-pointer:
634   stage: valgrind
635   extends:
636     - vm-pointer
637   variables:
638     MESON_TEST_ARGS: '--setup=valgrind'
639
640
641
642 .fedora-build@template:
643   extends:
644     - .fdo.distribution-image@fedora
645     - .build@template
646   variables:
647     FDO_DISTRIBUTION_VERSION: '30'
648     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
649   needs: ['fedora:30@container-prep']
650
651 default-build-release@fedora:30:
652   stage: distro
653   extends:
654     - .fedora-build@template
655   variables:
656     MESON_ARGS: "-Dbuildtype=release"
657     CFLAGS: "-Werror"
658
659 scan-build@fedora:30:
660   extends:
661     - .fedora-build@template
662   variables:
663     NINJA_ARGS: scan-build
664     MESON_TEST_ARGS: ''
665   before_script:
666     - dnf install -y clang-analyzer findutils
667   after_script:
668     - test ! -d "$MESON_BUILDDIR"/meson-logs/scanbuild && exit 0
669     - test $(find "$MESON_BUILDDIR"/meson-logs/scanbuild -maxdepth 0 ! -empty -exec echo "not empty" \; | wc -l) -eq 0 && exit 0
670     - echo "Check scan-build results"
671     - /bin/false
672
673 # Below jobs are build option combinations. We only
674 # run them on one image, they shouldn't fail on one distro
675 # when they succeed on another.
676
677 build-no-libwacom@fedora:30:
678   extends:
679     - .fedora-build@template
680   variables:
681     MESON_ARGS: "-Dlibwacom=false"
682
683 build-no-libwacom-nodeps@fedora:30:
684   extends:
685     - .fedora-build@template
686   variables:
687     MESON_ARGS: "-Dlibwacom=false"
688   before_script:
689     - dnf remove -y libwacom libwacom-devel
690
691 build-no-docs@fedora:30:
692   extends:
693     - .fedora-build@template
694   variables:
695     MESON_ARGS: "-Ddocumentation=false"
696
697 build-no-docs-nodeps@fedora:30:
698   extends:
699     - .fedora-build@template
700   variables:
701     MESON_ARGS: "-Ddocumentation=false"
702   before_script:
703     - dnf remove -y doxygen graphviz
704
705 build-no-debuggui@fedora:30:
706   extends:
707     - .fedora-build@template
708   variables:
709     MESON_ARGS: "-Ddebug-gui=false"
710
711 build-no-debuggui-nodeps@fedora:30:
712   extends:
713     - .fedora-build@template
714   variables:
715     MESON_ARGS: "-Ddebug-gui=false"
716   before_script:
717     - dnf remove -y gtk3-devel
718
719 build-no-tests@fedora:30:
720   extends:
721     - .fedora-build@template
722   variables:
723     MESON_ARGS: "-Dtests=false"
724
725 build-no-tests-nodeps@fedora:30:
726   extends:
727     - .fedora-build@template
728   variables:
729     MESON_ARGS: "-Dtests=false"
730   before_script:
731     - dnf remove -y check-devel
732
733 valgrind@fedora:30:
734   extends:
735     - .fedora-build@template
736   variables:
737     MESON_TEST_ARGS: '--suite=valgrind --no-suite=hardware --setup=valgrind'
738   before_script:
739     - dnf install -y valgrind
740
741 # Python checks, only run on Fedora
742
743 usr-bin-env-python@fedora:30:
744   extends:
745     - .fedora-build@template
746   script:
747     - |
748       if git grep -l '^#!/usr/bin/python'; then
749         echo "Use '/usr/bin/env python3' in the above files";
750         /bin/false
751       fi
752
753 flake8@fedora:30:
754   extends:
755     - .fedora-build@template
756   before_script:
757     - dnf install -y python3-flake8
758   script:
759     - flake8-3 --ignore=W501,E501,W504 $(git grep -l '^#!/usr/bin/env python3')
760
761 #################################################################
762 #                                                               #
763 #                        distro stage                           #
764 #                                                               #
765 #################################################################
766
767 fedora:30@default-build:
768   stage: distro
769   extends:
770     - .build@template
771     - .fdo.distribution-image@fedora
772   variables:
773     FDO_DISTRIBUTION_VERSION: '30'
774     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
775   needs: ['fedora:30@container-prep']
776
777
778 fedora:31@default-build:
779   stage: distro
780   extends:
781     - .build@template
782     - .fdo.distribution-image@fedora
783   variables:
784     FDO_DISTRIBUTION_VERSION: '31'
785     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
786   needs: ['fedora:31@container-prep']
787
788
789 ubuntu:19.10@default-build:
790   stage: distro
791   extends:
792     - .build@template
793     - .fdo.distribution-image@ubuntu
794   variables:
795     FDO_DISTRIBUTION_VERSION: '19.10'
796     FDO_DISTRIBUTION_TAG: $UBUNTU_TAG
797   needs: ['ubuntu:19.10@container-prep']
798
799
800 ubuntu:19.04@default-build:
801   stage: distro
802   extends:
803     - .build@template
804     - .fdo.distribution-image@ubuntu
805   variables:
806     FDO_DISTRIBUTION_VERSION: '19.04'
807     FDO_DISTRIBUTION_TAG: $UBUNTU_TAG
808   needs: ['ubuntu:19.04@container-prep']
809
810
811 arch:rolling@default-build:
812   stage: distro
813   extends:
814     - .build@template
815     - .fdo.distribution-image@arch
816   variables:
817     FDO_DISTRIBUTION_VERSION: 'rolling'
818     FDO_DISTRIBUTION_TAG: $ARCH_TAG
819   needs: ['arch:rolling@container-prep']
820
821
822 alpine:latest@default-build:
823   stage: distro
824   extends:
825     - .build@template
826     - .fdo.distribution-image@alpine
827   variables:
828     FDO_DISTRIBUTION_VERSION: 'latest'
829     FDO_DISTRIBUTION_TAG: $ALPINE_TAG
830     MESON_ARGS: '-Ddocumentation=false' # alpine does not have python-recommonmark
831     MESON_TEST_ARGS: '' # litest-selftest fails on musl
832   needs: ['alpine:latest@container-prep']
833
834
835
836 #
837 # FreeBSD
838 #
839 .freebsd@template:
840   stage: distro
841   extends:
842     - .build@template
843   image: $FREEBSD_CONTAINER_IMAGE
844   variables:
845     MESON_ARGS: '--cross-file freebsd -Ddocumentation=false -Dtests=false -Depoll-dir=/freebsd/usr/local/'
846     # Can't run FreeBSD tests on Linux machine, so MESON_TEST_ARGS shouldn't be "test"
847     MESON_TEST_ARGS: ''
848
849 freebsd:11.2@default-build:
850   extends:
851     - .freebsd@template
852   needs: ['freebsd:11.2@container-prep']
853
854 #
855 # deploy
856 #
857
858 wayland-web:
859   image: alpine:latest
860   stage: deploy
861   script:
862     - apk add curl
863     # Requirements:
864     # - variable WAYLAND_WEB_TOKEN defined as type File in libinput's CI/CD settings
865     # - content of that file is the token value, as generated by the Pipeline Triggers
866     #   of the wayland.freedesktop.org project.
867     - curl --request POST
868            --form "token=<$WAYLAND_WEB_TOKEN"
869            --form ref=master
870            https://gitlab.freedesktop.org/api/v4/projects/wayland${SLASH}wayland${DOT}freedesktop${DOT}org/trigger/pipeline
871   except:
872     refs:
873       - schedules
874   only:
875     refs:
876       - master
877     variables:
878       - $CI_PROJECT_PATH == "libinput/libinput"
879   dependencies: []
880   variables:
881     DOT: "%2E"
882     SLASH: "%2F"