1 # vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:
3 ########################################
5 # THIS FILE IS GENERATED, DO NOT EDIT #
7 ########################################
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.
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'.
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.
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
30 # All jobs must follow the naming scheme of
31 # <distribution>:<version>@activity:
32 # e.g. fedora:31@build-default
34 .templates_sha: &template_sha 395535ce90eb48e260c0dff12c35d9237e22c539 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
37 # Alpine container builder template
38 - project: 'freedesktop/ci-templates'
40 file: '/templates/alpine.yml'
41 # Arch container builder template
42 - project: 'freedesktop/ci-templates'
44 file: '/templates/arch.yml'
45 # Fedora container builder template
46 - project: 'freedesktop/ci-templates'
48 file: '/templates/fedora.yml'
49 # Ubuntu container builder template
50 - project: 'freedesktop/ci-templates'
52 file: '/templates/ubuntu.yml'
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
64 ###############################################################################
65 # This is the list of packages required to build libinput with the default #
68 # Run dnf install/apt-get install/.. with the list of packages for your #
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 #############################
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
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'
94 UBUNTU_EXEC: "bash .gitlab-ci/ubuntu_install.sh $UBUNTU_CUSTOM_DEBS"
96 FREEBSD_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/freebsd/11.2:$FREEBSD_TAG
97 FDO_UPSTREAM_REPO: libinput/libinput
99 MESON_BUILDDIR: "build dir"
102 MESON_TEST_ARGS: '--no-suite=hardware'
104 # udev isn't available/working properly in the containers
105 UDEV_NOT_AVAILABLE: 1
112 - runner_system_failure
113 - stuck_or_timeout_failure
114 # cancel run when a newer version is pushed to the branch
119 name: "meson-logs-$CI_JOB_NAME"
123 - $MESON_BUILDDIR/meson-logs
125 junit: $MESON_BUILDDIR/junit-*.xml
127 #################################################################
131 #################################################################
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
141 - apk add python3 git
142 - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
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"
150 # Verify that commit messages are as expected, signed-off, etc.
157 - apk add python3 git
159 - pip3 install GitPython
160 - pip3 install pytest
162 pytest --junitxml=results.xml \
165 ./.gitlab-ci/check-commit.py
167 - master@libinput/libinput
175 # This stage will recreate the container images only if the image
176 # is too old or if it is missing some dependencies.
179 .rebuild_for_schedule:
181 # force rebuild if schedule, reuse otherwise
182 - if [[ $CI_PIPELINE_SOURCE == "schedule" ]] ; then export FDO_FORCE_REBUILD=1; fi
186 - .fdo.qemu-build@fedora
188 - .rebuild_for_schedule
194 FDO_DISTRIBUTION_VERSION: 30
195 FDO_DISTRIBUTION_TAG: $QEMU_TAG
196 FDO_DISTRIBUTION_PACKAGES: $FEDORA_QEMU_RPMS
199 fedora:30@container-prep:
201 - .fdo.container-build@fedora
203 - .rebuild_for_schedule
207 FDO_DISTRIBUTION_VERSION: '30'
208 FDO_DISTRIBUTION_PACKAGES: $FEDORA_PACKAGES
209 FDO_DISTRIBUTION_TAG: $FEDORA_TAG
211 fedora:31@container-prep:
213 - .fdo.container-build@fedora
215 - .rebuild_for_schedule
219 FDO_DISTRIBUTION_VERSION: '31'
220 FDO_DISTRIBUTION_PACKAGES: $FEDORA_PACKAGES
221 FDO_DISTRIBUTION_TAG: $FEDORA_TAG
223 ubuntu:19.10@container-prep:
225 - .fdo.container-build@ubuntu
227 - .rebuild_for_schedule
231 FDO_DISTRIBUTION_VERSION: '19.10'
232 FDO_DISTRIBUTION_PACKAGES: $UBUNTU_PACKAGES
233 FDO_DISTRIBUTION_TAG: $UBUNTU_TAG
235 ubuntu:19.04@container-prep:
237 - .fdo.container-build@ubuntu
239 - .rebuild_for_schedule
243 FDO_DISTRIBUTION_VERSION: '19.04'
244 FDO_DISTRIBUTION_PACKAGES: $UBUNTU_PACKAGES
245 FDO_DISTRIBUTION_TAG: $UBUNTU_TAG
247 arch:rolling@container-prep:
249 - .fdo.container-build@arch
251 - .rebuild_for_schedule
255 FDO_DISTRIBUTION_VERSION: 'rolling'
256 FDO_DISTRIBUTION_PACKAGES: $ARCH_PACKAGES
257 FDO_DISTRIBUTION_TAG: $ARCH_TAG
259 alpine:latest@container-prep:
261 - .fdo.container-build@alpine
263 - .rebuild_for_schedule
267 FDO_DISTRIBUTION_VERSION: 'latest'
268 FDO_DISTRIBUTION_PACKAGES: $ALPINE_PACKAGES
269 FDO_DISTRIBUTION_TAG: $ALPINE_TAG
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
276 .freebsd@container-prep:
279 - .fdo.container-build@fedora
282 # log in to the registry
283 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
285 # get the full container image name
286 - export IMAGE=freebsd/$FREEBSD_VERSION:$FREEBSD_TAG
288 # force rebuild if schedule, reuse otherwise
289 - if [[ $CI_PIPELINE_SOURCE == "schedule" ]] ; then touch .scheduled; fi
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 ;
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 ;
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
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
317 freebsd:11.2@container-prep:
319 - .freebsd@container-prep
322 FREEBSD_VERSION: "11.2"
325 #################################################################
327 # container clean stage #
328 # run during the clean stage #
330 #################################################################
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
338 stage: container_clean
343 - apk add python3 git
344 - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
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
351 - ci-fairy -v --authfile $AUTHFILE delete-image
352 --repository $FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION
353 --exclude-tag $FDO_DISTRIBUTION_TAG
359 fedora:30@container-clean:
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
369 fedora:31@container-clean:
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
379 ubuntu:19.10@container-clean:
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
389 ubuntu:19.04@container-clean:
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
399 arch:rolling@container-clean:
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
409 alpine:latest@container-clean:
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
420 freebsd:11.2@container-clean:
425 CURRENT_CONTAINER_IMAGE: $FREEBSD_CONTAINER_IMAGE
427 #################################################################
431 #################################################################
439 - .gitlab-ci/meson-build.sh
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 ]];
450 echo tainted kernel ;
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.
461 - .fdo.distribution-image@fedora
466 MESON_BUILDDIR: build_dir
467 # remove the global --no-suite=hardware
470 - if ! [[ -z $SUITE_NAMES ]]; then SUITES=$(echo $SUITE_NAMES | sed 's/\([^ ]*\)/libinput-test-suite-\1/g'); fi
471 - echo "Testing $SUITES"
473 # start our vm, no args required
474 - /app/start_vm.sh || (echo "Error - Failed to start the VM." && exit 1)
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 .
492 - ssh localhost -p 5555 halt || true
496 - if [[ ! -e .success ]] ;
501 name: "qemu-meson-logs-$CI_JOB_NAME"
505 - $MESON_BUILDDIR/meson-logs
508 junit: $MESON_BUILDDIR/junit-*.xml
516 .fedora:30@test-suite-vm:
520 FDO_DISTRIBUTION_VERSION: 30
521 FDO_DISTRIBUTION_TAG: $QEMU_TAG
522 needs: ['fedora:30@qemu-prep']
527 - .fedora:30@test-suite-vm
529 SUITE_NAMES: 'touchpad'
531 vm-touchpad-no-libwacom:
535 MESON_ARGS: '-Dlibwacom=false'
539 - .fedora:30@test-suite-vm
547 MESON_ARGS: '-Dlibwacom=false'
551 - .fedora:30@test-suite-vm
553 SUITE_NAMES: 'tablet'
555 vm-tablet-no-libwacom:
559 MESON_ARGS: '-Dlibwacom=false'
563 - .fedora:30@test-suite-vm
565 SUITE_NAMES: 'gestures device'
567 vm-gestures-device-no-libwacom:
571 MESON_ARGS: '-Dlibwacom=false'
575 - .fedora:30@test-suite-vm
577 SUITE_NAMES: 'context config misc events totem udev lid log timer tablet-mode quirks trackball pad path keyboard switch touch trackpoint'
579 vm-others-no-libwacom:
583 MESON_ARGS: '-Dlibwacom=false'
587 - .fedora:30@test-suite-vm
589 SUITE_NAMES: 'pointer'
591 vm-pointer-no-libwacom:
595 MESON_ARGS: '-Dlibwacom=false'
598 vm-valgrind-touchpad:
603 MESON_TEST_ARGS: '--setup=valgrind'
610 MESON_TEST_ARGS: '--setup=valgrind'
617 MESON_TEST_ARGS: '--setup=valgrind'
619 vm-valgrind-gestures-device:
624 MESON_TEST_ARGS: '--setup=valgrind'
631 MESON_TEST_ARGS: '--setup=valgrind'
638 MESON_TEST_ARGS: '--setup=valgrind'
642 .fedora-build@template:
644 - .fdo.distribution-image@fedora
647 FDO_DISTRIBUTION_VERSION: '30'
648 FDO_DISTRIBUTION_TAG: $FEDORA_TAG
649 needs: ['fedora:30@container-prep']
651 default-build-release@fedora:30:
654 - .fedora-build@template
656 MESON_ARGS: "-Dbuildtype=release"
659 scan-build@fedora:30:
661 - .fedora-build@template
663 NINJA_ARGS: scan-build
666 - dnf install -y clang-analyzer findutils
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"
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.
677 build-no-libwacom@fedora:30:
679 - .fedora-build@template
681 MESON_ARGS: "-Dlibwacom=false"
683 build-no-libwacom-nodeps@fedora:30:
685 - .fedora-build@template
687 MESON_ARGS: "-Dlibwacom=false"
689 - dnf remove -y libwacom libwacom-devel
691 build-no-docs@fedora:30:
693 - .fedora-build@template
695 MESON_ARGS: "-Ddocumentation=false"
697 build-no-docs-nodeps@fedora:30:
699 - .fedora-build@template
701 MESON_ARGS: "-Ddocumentation=false"
703 - dnf remove -y doxygen graphviz
705 build-no-debuggui@fedora:30:
707 - .fedora-build@template
709 MESON_ARGS: "-Ddebug-gui=false"
711 build-no-debuggui-nodeps@fedora:30:
713 - .fedora-build@template
715 MESON_ARGS: "-Ddebug-gui=false"
717 - dnf remove -y gtk3-devel
719 build-no-tests@fedora:30:
721 - .fedora-build@template
723 MESON_ARGS: "-Dtests=false"
725 build-no-tests-nodeps@fedora:30:
727 - .fedora-build@template
729 MESON_ARGS: "-Dtests=false"
731 - dnf remove -y check-devel
735 - .fedora-build@template
737 MESON_TEST_ARGS: '--suite=valgrind --no-suite=hardware --setup=valgrind'
739 - dnf install -y valgrind
741 # Python checks, only run on Fedora
743 usr-bin-env-python@fedora:30:
745 - .fedora-build@template
748 if git grep -l '^#!/usr/bin/python'; then
749 echo "Use '/usr/bin/env python3' in the above files";
755 - .fedora-build@template
757 - dnf install -y python3-flake8
759 - flake8-3 --ignore=W501,E501,W504 $(git grep -l '^#!/usr/bin/env python3')
761 #################################################################
765 #################################################################
767 fedora:30@default-build:
771 - .fdo.distribution-image@fedora
773 FDO_DISTRIBUTION_VERSION: '30'
774 FDO_DISTRIBUTION_TAG: $FEDORA_TAG
775 needs: ['fedora:30@container-prep']
778 fedora:31@default-build:
782 - .fdo.distribution-image@fedora
784 FDO_DISTRIBUTION_VERSION: '31'
785 FDO_DISTRIBUTION_TAG: $FEDORA_TAG
786 needs: ['fedora:31@container-prep']
789 ubuntu:19.10@default-build:
793 - .fdo.distribution-image@ubuntu
795 FDO_DISTRIBUTION_VERSION: '19.10'
796 FDO_DISTRIBUTION_TAG: $UBUNTU_TAG
797 needs: ['ubuntu:19.10@container-prep']
800 ubuntu:19.04@default-build:
804 - .fdo.distribution-image@ubuntu
806 FDO_DISTRIBUTION_VERSION: '19.04'
807 FDO_DISTRIBUTION_TAG: $UBUNTU_TAG
808 needs: ['ubuntu:19.04@container-prep']
811 arch:rolling@default-build:
815 - .fdo.distribution-image@arch
817 FDO_DISTRIBUTION_VERSION: 'rolling'
818 FDO_DISTRIBUTION_TAG: $ARCH_TAG
819 needs: ['arch:rolling@container-prep']
822 alpine:latest@default-build:
826 - .fdo.distribution-image@alpine
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']
843 image: $FREEBSD_CONTAINER_IMAGE
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"
849 freebsd:11.2@default-build:
852 needs: ['freebsd:11.2@container-prep']
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"
870 https://gitlab.freedesktop.org/api/v4/projects/wayland${SLASH}wayland${DOT}freedesktop${DOT}org/trigger/pipeline
878 - $CI_PROJECT_PATH == "libinput/libinput"