1 # vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:
3 {# You're looking at the template here, so you can ignore the below
4 warning. This is the right file to edit #}
5 ########################################
7 # THIS FILE IS GENERATED, DO NOT EDIT #
9 ########################################
11 # This is a bit complicated for two reasons:
12 # - we really want to run dnf/apt/... only once, updating on the test runner for
13 # each job takes forever. So we create a container image for each distribution
14 # tested, then run the tests on this container image.
16 # This is handled by the ci-templates, ensuring containers are only rebuilt
17 # when the TAG changes.
19 # - GitLab only allows one script: set per job but we have a bunch of commands
20 # we need to re-run for each build (meson && ninja && etc). YAML cannot merge
21 # arrays so we're screwed.
23 # So instead we use a default_build template and override everything with
24 # variables. The only two variables that matter:
25 # MESON_ARGS=-Denable-something=true
26 # NINJA_ARGS=dist ... to run 'ninja -C builddir dist'
27 # Note that you cannot use scripts: in any target if you expect default_build
31 # All jobs must follow the naming scheme of
32 # <distribution>:<version>@activity:
33 # e.g. fedora:31@build-default
35 .templates_sha: &template_sha d303fafa66bbca44cc5bdb337d5773b5f019b70d # see https://docs.gitlab.com/ee/ci/yaml/#includefile
38 {% for distro in distributions|sort(attribute="name") %}
39 {% if not distro.does_not_have_ci_templates %}
40 # {{ distro.name.capitalize() }} container builder template
41 - project: 'freedesktop/ci-templates'
43 file: '/templates/{{distro.name}}.yml'
48 - prep # prep work like rebuilding the container images if there is a change
49 - build # for actually building and testing things in a container
50 - VM # for running the test suite in a VM
51 - valgrind # for running the test suite under valgrind in a VM
52 - distro # distribs test
53 - deploy # trigger wayland's website generation
54 - container_clean # clean up unused container images (scheduled jobs only)
57 ###############################################################################
58 # This is the list of packages required to build libinput with the default #
61 # Run dnf install/apt-get install/.. with the list of packages for your #
64 # See the documentation here: #
65 # https://wayland.freedesktop.org/libinput/doc/latest/building_libinput.html #
66 ###############################################################################
67 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 gtk3-devel glib2-devel mtdev-devel diffutils'
68 FEDORA_QEMU_RPMS: '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 gtk3-devel glib2-devel mtdev-devel diffutils valgrind'
69 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'
70 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'
71 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'
72 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'
73 FREEBSD_BUILD_PKGS: 'meson'
74 FREEBSD_PACKAGES: 'libepoll-shim libudev-devd libevdev libwacom gtk3 libmtdev '
75 ############################ end of package lists #############################
77 # these tags should be updated each time the list of packages is updated
78 # changing these will force rebuilding the associated image
79 # Note: these tags have no meaning and are not tied to a particular
81 {% for distro in distributions %}
82 {{"%-13s"| format(distro.name.upper() + '_TAG:')}}'{{distro.tag}}'
84 {% for distro in distributions %}
85 {% if distro.want_qemu %}
86 QEMU_TAG: 'qemu-vm-{{distro.tag}}'
90 UBUNTU_EXEC: "bash .gitlab-ci/ubuntu_install.sh $UBUNTU_CUSTOM_DEBS"
92 FREEBSD_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/freebsd/11.2:$FREEBSD_TAG
93 FDO_UPSTREAM_REPO: libinput/libinput
95 MESON_BUILDDIR: "build dir"
98 MESON_TEST_ARGS: '--no-suite=hardware'
100 # udev isn't available/working properly in the containers
101 UDEV_NOT_AVAILABLE: 1
108 - runner_system_failure
109 - stuck_or_timeout_failure
110 # cancel run when a newer version is pushed to the branch
115 name: "meson-logs-$CI_JOB_NAME"
119 - $MESON_BUILDDIR/meson-logs
121 junit: $MESON_BUILDDIR/junit-*.xml
128 - pip install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
130 #################################################################
134 #################################################################
136 # Re-generate the CI script and make sure it's the one currently checked in
137 # If this job fails, re-generate the gitlab-ci.yml script, see
138 # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
145 - ci-fairy generate-template
146 - git diff --exit-code && exit 0 || true
147 - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
151 # Verify that commit messages are as expected, signed-off, etc.
159 - ci-fairy check-commits --signed-off-by --junit-xml=results.xml
161 - master@libinput/libinput
169 # Verify that the merge request has the allow-collaboration checkbox ticked
177 - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
185 # Note: images are rebuilt weekly with a scheduled pipeline with FDO_FORCE_REBUILD set
188 {# qemu builds are only done for the latest version of any distribution #}
189 {% for distro in distributions if distro.want_qemu %}
190 {% set version = "{}".format(distro.versions|last()) %}
191 {{distro.name}}:{{version}}@qemu-prep:
193 - .fdo.qemu-build@{{distro.name}}
200 FDO_DISTRIBUTION_VERSION: {{version}}
201 FDO_DISTRIBUTION_TAG: $QEMU_TAG
202 FDO_DISTRIBUTION_PACKAGES: ${{distro.name.upper()}}_QEMU_RPMS
206 {% for distro in distributions %}
207 {% for version in distro.versions %}
208 {{distro.name}}:{{version}}@container-prep:
210 - .fdo.container-build@{{distro.name}}
215 FDO_DISTRIBUTION_VERSION: '{{version}}'
216 FDO_DISTRIBUTION_PACKAGES: ${{distro.name.upper()}}_PACKAGES
217 FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
218 {% if version == 'ubuntu'%}
219 FDO_DISTRIBUTION_EXEC: $UBUNTU_EXEC
226 # Note that we want to use the latest buildah image, and for that
227 # we use one of the .fdo.container-build@distribution by replacing the
229 .freebsd@container-prep:
232 - .fdo.container-build@fedora
235 # log in to the registry
236 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
238 # get the full container image name
239 - export IMAGE=freebsd/$FREEBSD_VERSION:$FREEBSD_TAG
241 - if [[ x"$FDO_FORCE_REBUILD" != x ]] ; then touch .rebuild; fi
243 # pull the latest upstream image if it exists
244 - test -e .rebuild || skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
245 docker://$CI_REGISTRY/$FDO_UPSTREAM_REPO/$IMAGE
246 docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
248 # check if our image is already in the current registry
249 - test -e .rebuild || skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
251 - export BUILDAH_RUN="buildah run --isolation chroot"
252 - export BUILDAH_COMMIT="buildah commit --format docker"
253 - buildcntr=$(buildah from --quiet myfreeweb/freebsd-cross:latest)
254 - $BUILDAH_RUN $buildcntr apk add --no-cache $FREEBSD_BUILD_PKGS
255 - $BUILDAH_RUN $buildcntr pkg -r /freebsd update -f
256 - $BUILDAH_RUN $buildcntr pkg -r /freebsd install -y $FREEBSD_PACKAGES
257 - buildah config --workingdir /app $buildcntr
258 # tag the current container
259 - $BUILDAH_COMMIT $buildcntr $FREEBSD_CONTAINER_IMAGE
260 # clean up the working container
261 - buildah rm $buildcntr
263 # push the container image to the libinput registry
264 - podman push --quiet $FREEBSD_CONTAINER_IMAGE
265 - skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
266 docker://$FREEBSD_CONTAINER_IMAGE
267 docker://$CI_REGISTRY_IMAGE/freebsd/$FREEBSD_VERSION:$CI_JOB_ID
269 freebsd:11.2@container-prep:
271 - .freebsd@container-prep
274 FREEBSD_VERSION: "11.2"
277 #################################################################
279 # container clean stage #
280 # run during the clean stage #
282 #################################################################
285 # This stage will look for the container images we currently have in
286 # the registry and will remove any that are not tagged with the provided
287 # $container_image:$tag
293 stage: container_clean
295 # Go to your Profile, Settings, Access Tokens
296 # Create a personal token with 'api' scope, copy the value.
297 # Go to CI/CD, Schedules, schedule a new monthly job (or edit the existing one)
298 # Define a variable of type File named AUTHFILE. Content is that token
300 - ci-fairy -v --authfile $AUTHFILE delete-image
301 --repository $FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION
302 --exclude-tag $FDO_DISTRIBUTION_TAG
308 {% for distro in distributions %}
309 {% for version in distro.versions %}
310 {{distro.name}}:{{version}}@container-clean:
315 CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/{{distro.name}}/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
316 FDO_DISTRIBUTION_VERSION: '{{version}}'
317 FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
322 freebsd:11.2@container-clean:
327 CURRENT_CONTAINER_IMAGE: $FREEBSD_CONTAINER_IMAGE
329 #################################################################
333 #################################################################
341 - .gitlab-ci/meson-build.sh
348 .check_tainted: &check_tainted |
349 # make sure the kernel is not tainted
350 if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
352 echo tainted kernel ;
356 # Run in a test suite. Special variables:
357 # - SUITES: the meson test suites to run, or
358 # - SUITE_NAMES: all elements will be expanded to libinput-test-suite-$value
359 # Set one or the other, not both.
363 - .fdo.distribution-image@fedora
368 MESON_BUILDDIR: build_dir
369 # remove the global --no-suite=hardware
372 - if ! [[ -z $SUITE_NAMES ]]; then SUITES=$(echo $SUITE_NAMES | sed 's/\([^ ]*\)/libinput-test-suite-\1/g'); fi
373 - echo "Testing $SUITES"
375 # start our vm, no args required
376 - /app/vmctl start || (echo "Error - Failed to start the VM." && exit 1)
381 - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
382 - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
383 - echo "MESON_ARGS=\"$MESON_ARGS\"" >> sshenv
384 - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
385 - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS $SUITES\"" >> sshenv
386 - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
387 - "scp sshenv vm:~/$CI_PROJECT_NAME/.meson_environment"
388 - /app/vmctl exec "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
389 # no matter the results of the tests, we want to fetch the logs
390 - scp -r vm:$CI_PROJECT_NAME/$MESON_BUILDDIR .
396 - if [[ ! -e .success ]] ;
401 name: "qemu-meson-logs-$CI_JOB_NAME"
405 - $MESON_BUILDDIR/meson-logs
408 junit: $MESON_BUILDDIR/junit-*.xml
416 {# qemu tests are only done for the latest version of any distribution #}
417 {% for distro in distributions if distro.want_qemu %}
418 {% set version = "{}".format(distro.versions|last()) %}
419 .{{distro.name}}:{{version}}@test-suite-vm:
423 FDO_DISTRIBUTION_VERSION: {{version}}
424 FDO_DISTRIBUTION_TAG: $QEMU_TAG
426 - "{{distro.name}}:{{version}}@qemu-prep"
429 {% for suite in test_suites %}
432 - .{{distro.name}}:{{version}}@test-suite-vm
434 SUITE_NAMES: '{{suite.suites}}'
436 vm-{{suite.name}}-no-libwacom:
440 MESON_ARGS: '-Dlibwacom=false'
444 {% for suite in test_suites %}
445 vm-valgrind-{{suite.name}}:
450 MESON_TEST_ARGS: '--setup=valgrind'
453 {% endfor %}{# for if distro.want_qemu #}
455 {% for distro in distributions if distro.use_for_custom_build_tests %}
456 {% set version = "{}".format(distro.versions|last()) %}
457 .{{distro.name}}-build@template:
459 - .fdo.distribution-image@fedora
462 FDO_DISTRIBUTION_VERSION: '{{version}}'
463 FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
465 - "{{distro.name}}:{{version}}@container-prep"
467 default-build-release@{{distro.name}}:{{version}}:
470 - .{{distro.name}}-build@template
472 MESON_ARGS: "-Dbuildtype=release"
475 scan-build@{{distro.name}}:{{version}}:
477 - .{{distro.name}}-build@template
479 NINJA_ARGS: scan-build
482 - dnf install -y clang-analyzer findutils
484 - test ! -d "$MESON_BUILDDIR"/meson-logs/scanbuild && exit 0
485 - test $(find "$MESON_BUILDDIR"/meson-logs/scanbuild -maxdepth 0 ! -empty -exec echo "not empty" \; | wc -l) -eq 0 && exit 0
486 - echo "Check scan-build results"
489 # Below jobs are build option combinations. We only
490 # run them on one image, they shouldn't fail on one distro
491 # when they succeed on another.
493 build-no-libwacom@{{distro.name}}:{{version}}:
495 - .{{distro.name}}-build@template
497 MESON_ARGS: "-Dlibwacom=false"
499 build-no-libwacom-nodeps@{{distro.name}}:{{version}}:
501 - .{{distro.name}}-build@template
503 MESON_ARGS: "-Dlibwacom=false"
505 - dnf remove -y libwacom libwacom-devel
507 build-no-docs@{{distro.name}}:{{version}}:
509 - .{{distro.name}}-build@template
511 MESON_ARGS: "-Ddocumentation=false"
513 build-no-docs-nodeps@{{distro.name}}:{{version}}:
515 - .{{distro.name}}-build@template
517 MESON_ARGS: "-Ddocumentation=false"
519 - dnf remove -y doxygen graphviz
521 build-no-debuggui@{{distro.name}}:{{version}}:
523 - .{{distro.name}}-build@template
525 MESON_ARGS: "-Ddebug-gui=false"
527 build-no-debuggui-nodeps@{{distro.name}}:{{version}}:
529 - .{{distro.name}}-build@template
531 MESON_ARGS: "-Ddebug-gui=false"
533 - dnf remove -y gtk3-devel
535 build-no-tests@{{distro.name}}:{{version}}:
537 - .{{distro.name}}-build@template
539 MESON_ARGS: "-Dtests=false"
541 build-no-tests-nodeps@{{distro.name}}:{{version}}:
543 - .{{distro.name}}-build@template
545 MESON_ARGS: "-Dtests=false"
547 - dnf remove -y check-devel
549 valgrind@{{distro.name}}:{{version}}:
551 - .{{distro.name}}-build@template
553 MESON_TEST_ARGS: '--suite=valgrind --no-suite=hardware --setup=valgrind'
555 - dnf install -y valgrind
557 # Python checks, only run on Fedora
559 usr-bin-env-python@{{distro.name}}:{{version}}:
561 - .{{distro.name}}-build@template
564 if git grep -l '^#!/usr/bin/python'; then
565 echo "Use '/usr/bin/env python3' in the above files";
569 flake8@{{distro.name}}:{{version}}:
571 - .{{distro.name}}-build@template
573 - dnf install -y python3-flake8
575 - flake8-3 --ignore=W501,E501,W504 $(git grep -l '^#!/usr/bin/env python3')
582 # This requires the COVERITY_SCAN_TOKEN. Log into scan.coverity.com and get
583 # the token from the respective project settings page.
584 # Schedule a pipeline and set a variable COVERITY_SCAN_TOKEN with the token value.
585 # https://gitlab.freedesktop.org/$CI_PROJECT_PATH/-/pipeline_schedules
586 # Email from coverity will be sent to the GITLAB_USER_EMAIL that scheduled the
589 # Coverity ratelimits submissions and the coverity tools download is about
590 # 700M, do not run this too often.
594 - .fdo.distribution-image@debian
598 FDO_DISTRIBUTION_VERSION: 'stable'
599 FDO_DISTRIBUTION_TAG: $DEBIAN_TAG
600 # so git-describe works, or should work
604 - $COVERITY_SCAN_TOKEN
606 - curl https://scan.coverity.com/download/linux64
607 -o /tmp/cov-analysis-linux64.tgz
608 --form project=$CI_PROJECT_NAME
609 --form token=$COVERITY_SCAN_TOKEN
610 - tar xfz /tmp/cov-analysis-linux64.tgz
611 # coverity has special build options in meson, make sure we enable those
612 - meson coverity-build -Ddocumentation=false -Dcoverity=true
613 - cov-analysis-linux64-*/bin/cov-build --dir cov-int ninja -C coverity-build
614 - tar cfz cov-int.tar.gz cov-int
615 - curl https://scan.coverity.com/builds?project=$CI_PROJECT_NAME
616 --form token=$COVERITY_SCAN_TOKEN --form email=$GITLAB_USER_EMAIL
617 --form file=@cov-int.tar.gz --form version="$(git describe --tags)"
618 --form description="$(git describe --tags) / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID"
620 name: "coverity-submit-data"
626 - "debian:stable@container-prep"
628 #################################################################
632 #################################################################
634 {% for distro in distributions %}
635 {% for version in distro.versions %}
636 {{distro.name}}:{{version}}@default-build:
640 - .fdo.distribution-image@{{distro.name}}
642 FDO_DISTRIBUTION_VERSION: '{{version}}'
643 FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
644 {# Where we have extra_variables defined, add them to the list #}
645 {% if distro.build is defined and distro.build.extra_variables is defined %}
646 {% for var in distro.build.extra_variables %}
651 - "{{distro.name}}:{{version}}@container-prep"
664 image: $FREEBSD_CONTAINER_IMAGE
666 MESON_ARGS: '--cross-file freebsd -Ddocumentation=false -Dtests=false -Depoll-dir=/freebsd/usr/local/'
667 # Can't run FreeBSD tests on Linux machine, so MESON_TEST_ARGS shouldn't be "test"
670 freebsd:11.2@default-build:
674 - "freebsd:11.2@container-prep"
676 #################################################################
680 #################################################################
684 - .fdo.distribution-image@fedora
688 FDO_DISTRIBUTION_VERSION: '32'
689 FDO_DISTRIBUTION_TAG: $FEDORA_TAG
691 - "fedora:32@container-prep"
693 - dnf install -y rpmdevtools jq
694 - meson "$MESON_BUILDDIR"
695 - VERSION=$(meson introspect "$MESON_BUILDDIR" --projectinfo | jq -r .version)
696 - sed -e "s/@PIPELINEID@/${CI_PIPELINE_ID}/"
697 -e "s/@GITVERSION@/${CI_COMMIT_SHA}/"
698 -e "s/@VERSION@/${VERSION}/" .gitlab-ci/libinput.spec.in > libinput.spec
699 - git config --local user.name 'gitlab CI'
700 - git config --local user.email 'noreply@nowhere'
701 - git add libinput.spec && git commit -m 'Add libinput.spec for build testing' libinput.spec
702 - cd "$MESON_BUILDDIR"
703 - meson dist --no-test
704 - rpmbuild -ta meson-dist/libinput*.tar.xz
709 trigger: wayland/wayland.freedesktop.org
714 MESON_ARGS: '-Ddebug-gui=false -Dlibwacom=false -Dtests=false'
715 MESON_BUILDDIR: 'builddir'
720 - $CI_PROJECT_PATH == "libinput/libinput"