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 16f790f93f893394b70d7048fb0e8a981ceaa3c5 # 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'
46 - project: 'freedesktop/ci-templates'
48 file: '/templates/ci-fairy.yml'
51 - sanity check # CI/commit checks
52 - prep # prep work like rebuilding the container images if there is a change
53 - build # for actually building and testing things in a container
54 - VM # for running the test suite in a VM
55 - valgrind # for running the test suite under valgrind in a VM
56 - distro # distribs test
57 - deploy # trigger wayland's website generation
58 - container_clean # clean up unused container images (scheduled jobs only)
61 ###############################################################################
62 # This is the list of packages required to build libinput with the default #
65 # Run dnf install/apt-get install/.. with the list of packages for your #
68 # See the documentation here: #
69 # https://wayland.freedesktop.org/libinput/doc/latest/building_libinput.html #
70 ###############################################################################
71 {% for distro in distributions %}
72 {{"%-17s" | format(distro.name.upper() + '_PACKAGES:')}} '{{ distro.packages|join(' ')}}'
74 FREEBSD_BUILD_PKGS: 'meson'
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 FREEBSD_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/freebsd/11.2:$FREEBSD_TAG
91 FDO_UPSTREAM_REPO: libinput/libinput
93 MESON_BUILDDIR: "build dir"
96 MESON_TEST_ARGS: '--no-suite=hardware'
98 # udev isn't available/working properly in the containers
106 - runner_system_failure
107 - stuck_or_timeout_failure
108 # cancel run when a newer version is pushed to the branch
113 name: "meson-logs-$CI_JOB_NAME"
117 - $MESON_BUILDDIR/meson-logs
119 junit: $MESON_BUILDDIR/junit-*.xml
122 #################################################################
124 # sanity check stage #
126 #################################################################
128 # Re-generate the CI script and make sure it's the one currently checked in
129 # If this job fails, re-generate the gitlab-ci.yml script, see
130 # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
137 - ci-fairy generate-template --verify && exit 0 || true
138 - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
142 # Verify that commit messages are as expected, signed-off, etc.
150 - ci-fairy check-commits --signed-off-by --junit-xml=results.xml
152 - master@libinput/libinput
159 #################################################################
163 #################################################################
166 # Note: images are rebuilt weekly with a scheduled pipeline with FDO_FORCE_REBUILD set
169 {# qemu builds are only done for the latest version of any distribution #}
170 {% for distro in distributions if distro.want_qemu %}
171 {% set version = "{}".format(distro.versions|last()) %}
172 {{distro.name}}:{{version}}@qemu-prep:
174 - .fdo.qemu-build@{{distro.name}}
181 FDO_DISTRIBUTION_VERSION: {{version}}
182 FDO_DISTRIBUTION_TAG: $QEMU_TAG
183 FDO_DISTRIBUTION_PACKAGES: ${{distro.name.upper()}}_PACKAGES
187 {% for distro in distributions %}
188 {% for version in distro.versions %}
189 {{distro.name}}:{{version}}@container-prep:
191 - .fdo.container-build@{{distro.name}}
196 FDO_DISTRIBUTION_VERSION: '{{version}}'
197 FDO_DISTRIBUTION_PACKAGES: ${{distro.name.upper()}}_PACKAGES
198 FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
204 # Note that we want to use the latest buildah image, and for that
205 # we use one of the .fdo.container-build@distribution by replacing the
207 .freebsd@container-prep:
210 - .fdo.container-build@fedora
213 # log in to the registry
214 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
216 # get the full container image name
217 - export IMAGE=freebsd/$FREEBSD_VERSION:$FREEBSD_TAG
219 - if [[ x"$FDO_FORCE_REBUILD" != x ]] ; then touch .rebuild; fi
221 # pull the latest upstream image if it exists
222 - test -e .rebuild || skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
223 docker://$CI_REGISTRY/$FDO_UPSTREAM_REPO/$IMAGE
224 docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
226 # check if our image is already in the current registry
227 - test -e .rebuild || skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
229 - export BUILDAH_RUN="buildah run --isolation chroot"
230 - export BUILDAH_COMMIT="buildah commit --format docker"
231 - buildcntr=$(buildah from --quiet myfreeweb/freebsd-cross:latest)
232 - $BUILDAH_RUN $buildcntr apk add --no-cache $FREEBSD_BUILD_PKGS
233 - $BUILDAH_RUN $buildcntr pkg -r /freebsd update -f
234 - $BUILDAH_RUN $buildcntr pkg -r /freebsd install -y $FREEBSD_PACKAGES
235 - buildah config --workingdir /app $buildcntr
236 # tag the current container
237 - $BUILDAH_COMMIT $buildcntr $FREEBSD_CONTAINER_IMAGE
238 # clean up the working container
239 - buildah rm $buildcntr
241 # push the container image to the libinput registry
242 - podman push --quiet $FREEBSD_CONTAINER_IMAGE
243 - skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
244 docker://$FREEBSD_CONTAINER_IMAGE
245 docker://$CI_REGISTRY_IMAGE/freebsd/$FREEBSD_VERSION:$CI_JOB_ID
247 freebsd:11.2@container-prep:
249 - .freebsd@container-prep
252 FREEBSD_VERSION: "11.2"
255 #################################################################
257 # container clean stage #
258 # run during the clean stage #
260 #################################################################
263 # This stage will look for the container images we currently have in
264 # the registry and will remove any that are not tagged with the provided
265 # $container_image:$tag
271 stage: container_clean
273 # Go to your Profile, Settings, Access Tokens
274 # Create a personal token with 'api' scope, copy the value.
275 # Go to CI/CD, Schedules, schedule a new monthly job (or edit the existing one)
276 # Define a variable of type File named AUTHFILE. Content is that token
278 - ci-fairy -v --authfile $AUTHFILE delete-image
279 --repository $FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION
280 --exclude-tag $FDO_DISTRIBUTION_TAG
286 {% for distro in distributions %}
287 {% for version in distro.versions %}
288 {{distro.name}}:{{version}}@container-clean:
293 CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/{{distro.name}}/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
294 FDO_DISTRIBUTION_VERSION: '{{version}}'
295 FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
300 freebsd:11.2@container-clean:
305 CURRENT_CONTAINER_IMAGE: $FREEBSD_CONTAINER_IMAGE
307 #################################################################
311 #################################################################
319 - .gitlab-ci/meson-build.sh
326 .check_tainted: &check_tainted |
327 # make sure the kernel is not tainted
328 if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
330 echo tainted kernel ;
334 # Run in a test suite. Special variables:
335 # - SUITES: the meson test suites to run, or
336 # - SUITE_NAMES: all elements will be expanded to libinput-test-suite-$value
337 # Set one or the other, not both.
341 - .fdo.distribution-image@fedora
346 MESON_BUILDDIR: build_dir
347 # remove the global --no-suite=hardware
350 - if ! [[ -z $SUITE_NAMES ]]; then SUITES=$(echo $SUITE_NAMES | sed 's/\([^ ]*\)/libinput-test-suite-\1/g'); fi
351 - echo "Testing $SUITES"
353 # start our vm, no args required
354 - /app/vmctl start || (echo "Error - Failed to start the VM." && exit 1)
359 - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
360 - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
361 - echo "MESON_ARGS=\"$MESON_ARGS\"" >> sshenv
362 - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
363 - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS $SUITES\"" >> sshenv
364 - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
365 - "scp sshenv vm:~/$CI_PROJECT_NAME/.meson_environment"
366 - /app/vmctl exec "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
367 # no matter the results of the tests, we want to fetch the logs
368 - scp -r vm:$CI_PROJECT_NAME/$MESON_BUILDDIR .
374 - if [[ ! -e .success ]] ;
379 name: "qemu-meson-logs-$CI_JOB_NAME"
383 - $MESON_BUILDDIR/meson-logs
386 junit: $MESON_BUILDDIR/junit-*.xml
394 {# qemu tests are only done for the latest version of any distribution #}
395 {% for distro in distributions if distro.want_qemu %}
396 {% set version = "{}".format(distro.versions|last()) %}
397 .{{distro.name}}:{{version}}@test-suite-vm:
401 FDO_DISTRIBUTION_VERSION: {{version}}
402 FDO_DISTRIBUTION_TAG: $QEMU_TAG
404 - "{{distro.name}}:{{version}}@qemu-prep"
407 {% for suite in test_suites %}
410 - .{{distro.name}}:{{version}}@test-suite-vm
412 SUITE_NAMES: '{{suite.suites}}'
414 vm-{{suite.name}}-no-libwacom:
418 MESON_ARGS: '-Dlibwacom=false'
422 {% for suite in test_suites %}
423 vm-valgrind-{{suite.name}}:
428 MESON_TEST_ARGS: '--setup=valgrind'
431 {% endfor %}{# for if distro.want_qemu #}
433 {% for distro in distributions if distro.use_for_custom_build_tests %}
434 {% set version = "{}".format(distro.versions|last()) %}
435 .{{distro.name}}-build@template:
437 - .fdo.distribution-image@fedora
440 FDO_DISTRIBUTION_VERSION: '{{version}}'
441 FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
443 - "{{distro.name}}:{{version}}@container-prep"
445 default-build-release@{{distro.name}}:{{version}}:
448 - .{{distro.name}}-build@template
450 MESON_ARGS: "-Dbuildtype=release"
453 scan-build@{{distro.name}}:{{version}}:
455 - .{{distro.name}}-build@template
457 NINJA_ARGS: scan-build
460 - dnf install -y clang-analyzer findutils
462 - test ! -d "$MESON_BUILDDIR"/meson-logs/scanbuild && exit 0
463 - test $(find "$MESON_BUILDDIR"/meson-logs/scanbuild -maxdepth 0 ! -empty -exec echo "not empty" \; | wc -l) -eq 0 && exit 0
464 - echo "Check scan-build results"
467 # Below jobs are build option combinations. We only
468 # run them on one image, they shouldn't fail on one distro
469 # when they succeed on another.
471 build-no-libwacom@{{distro.name}}:{{version}}:
473 - .{{distro.name}}-build@template
475 MESON_ARGS: "-Dlibwacom=false"
477 build-no-libwacom-nodeps@{{distro.name}}:{{version}}:
479 - .{{distro.name}}-build@template
481 MESON_ARGS: "-Dlibwacom=false"
483 - dnf remove -y libwacom libwacom-devel
485 build-no-docs@{{distro.name}}:{{version}}:
487 - .{{distro.name}}-build@template
489 MESON_ARGS: "-Ddocumentation=false"
491 build-no-docs-nodeps@{{distro.name}}:{{version}}:
493 - .{{distro.name}}-build@template
495 MESON_ARGS: "-Ddocumentation=false"
497 - dnf remove -y doxygen graphviz
499 build-no-debuggui@{{distro.name}}:{{version}}:
501 - .{{distro.name}}-build@template
503 MESON_ARGS: "-Ddebug-gui=false"
505 build-no-debuggui-nodeps@{{distro.name}}:{{version}}:
507 - .{{distro.name}}-build@template
509 MESON_ARGS: "-Ddebug-gui=false"
511 - dnf remove -y gtk3-devel
513 build-no-tests@{{distro.name}}:{{version}}:
515 - .{{distro.name}}-build@template
517 MESON_ARGS: "-Dtests=false"
519 build-no-tests-nodeps@{{distro.name}}:{{version}}:
521 - .{{distro.name}}-build@template
523 MESON_ARGS: "-Dtests=false"
525 - dnf remove -y check-devel
527 valgrind@{{distro.name}}:{{version}}:
529 - .{{distro.name}}-build@template
531 MESON_TEST_ARGS: '--suite=valgrind --no-suite=hardware --setup=valgrind'
533 - dnf install -y valgrind
535 # Python checks, only run on Fedora
537 usr-bin-env-python@{{distro.name}}:{{version}}:
539 - .{{distro.name}}-build@template
542 if git grep -l '^#!/usr/bin/python'; then
543 echo "Use '/usr/bin/env python3' in the above files";
547 flake8@{{distro.name}}:{{version}}:
549 - .{{distro.name}}-build@template
551 - dnf install -y python3-flake8
553 - flake8-3 --ignore=W501,E501,W504 $(git grep -l '^#!/usr/bin/env python3')
560 # This requires the COVERITY_SCAN_TOKEN. Log into scan.coverity.com and get
561 # the token from the respective project settings page.
562 # Schedule a pipeline and set a variable COVERITY_SCAN_TOKEN with the token value.
563 # https://gitlab.freedesktop.org/$CI_PROJECT_PATH/-/pipeline_schedules
564 # Email from coverity will be sent to the GITLAB_USER_EMAIL that scheduled the
567 # Coverity ratelimits submissions and the coverity tools download is about
568 # 700M, do not run this too often.
572 - .fdo.distribution-image@debian
576 FDO_DISTRIBUTION_VERSION: 'stable'
577 FDO_DISTRIBUTION_TAG: $DEBIAN_TAG
578 # so git-describe works, or should work
582 - $COVERITY_SCAN_TOKEN
584 - curl https://scan.coverity.com/download/linux64
585 -o /tmp/cov-analysis-linux64.tgz
586 --form project=$CI_PROJECT_NAME
587 --form token=$COVERITY_SCAN_TOKEN
588 - tar xfz /tmp/cov-analysis-linux64.tgz
589 # coverity has special build options in meson, make sure we enable those
590 - meson coverity-build -Ddocumentation=false -Dcoverity=true
591 - cov-analysis-linux64-*/bin/cov-build --dir cov-int ninja -C coverity-build
592 - tar cfz cov-int.tar.gz cov-int
593 - curl https://scan.coverity.com/builds?project=$CI_PROJECT_NAME
594 --form token=$COVERITY_SCAN_TOKEN --form email=$GITLAB_USER_EMAIL
595 --form file=@cov-int.tar.gz --form version="$(git describe --tags)"
596 --form description="$(git describe --tags) / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID"
598 name: "coverity-submit-data"
604 - "debian:stable@container-prep"
606 #################################################################
610 #################################################################
612 {% for distro in distributions %}
613 {% for version in distro.versions %}
614 {{distro.name}}:{{version}}@default-build:
618 - .fdo.distribution-image@{{distro.name}}
620 FDO_DISTRIBUTION_VERSION: '{{version}}'
621 FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
622 {# Where we have extra_variables defined, add them to the list #}
623 {% if distro.build is defined and distro.build.extra_variables is defined %}
624 {% for var in distro.build.extra_variables %}
629 - "{{distro.name}}:{{version}}@container-prep"
642 image: $FREEBSD_CONTAINER_IMAGE
644 MESON_ARGS: '--cross-file freebsd -Ddocumentation=false -Dtests=false -Depoll-dir=/freebsd/usr/local/'
645 # Can't run FreeBSD tests on Linux machine, so MESON_TEST_ARGS shouldn't be "test"
648 freebsd:11.2@default-build:
652 - "freebsd:11.2@container-prep"
654 #################################################################
658 #################################################################
661 # Verify that the merge request has the allow-collaboration checkbox ticked
669 - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
678 - .fdo.distribution-image@fedora
682 FDO_DISTRIBUTION_VERSION: '32'
683 FDO_DISTRIBUTION_TAG: $FEDORA_TAG
685 - "fedora:32@container-prep"
687 - dnf install -y rpmdevtools jq
688 - meson "$MESON_BUILDDIR"
689 - VERSION=$(meson introspect "$MESON_BUILDDIR" --projectinfo | jq -r .version)
690 - sed -e "s/@PIPELINEID@/${CI_PIPELINE_ID}/"
691 -e "s/@GITVERSION@/${CI_COMMIT_SHA}/"
692 -e "s/@VERSION@/${VERSION}/" .gitlab-ci/libinput.spec.in > libinput.spec
693 - git config --local user.name 'gitlab CI'
694 - git config --local user.email 'noreply@nowhere'
695 - git add libinput.spec && git commit -m 'Add libinput.spec for build testing' libinput.spec
696 - cd "$MESON_BUILDDIR"
697 - meson dist --no-test
698 - rpmbuild -ta meson-dist/libinput*.tar.xz
703 trigger: wayland/wayland.freedesktop.org
708 MESON_ARGS: '-Ddebug-gui=false -Dlibwacom=false -Dtests=false'
709 MESON_BUILDDIR: 'builddir'
714 - $CI_PROJECT_PATH == "libinput/libinput"