1 # vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0:
3 ########################################
5 # THIS FILE IS GENERATED, DO NOT EDIT #
7 ########################################
9 .templates_sha: &template_sha b7030c2cd0d6ccc5f6d4f8299bafa4daa9240d71 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
12 # Alpine container builder template
13 - project: 'wayland/ci-templates'
14 file: '/templates/alpine.yml'
15 # Arch container builder template
16 - project: 'wayland/ci-templates'
18 file: '/templates/arch.yml'
19 # Fedora container builder template
20 - project: 'wayland/ci-templates'
22 file: '/templates/fedora.yml'
23 # Ubuntu container builder template
24 - project: 'wayland/ci-templates'
26 file: '/templates/ubuntu.yml'
27 # Debian container builder template
28 - project: 'wayland/ci-templates'
30 file: '/templates/debian.yml'
31 # CentOS container builder template
32 - project: 'wayland/ci-templates'
34 file: '/templates/centos.yml'
37 - prep # rebuild the container images if there is a change
38 - build # for actually building and testing things in a container
39 - VM # for running the test suite in a VM
40 - autotools # distribution builds with autotools
41 - meson # distribution builds with meson
42 - tarballs # tarball builds
43 - container_clean # clean up unused container images
46 ###############################################################################
47 # This is the list of packages required to build libevdev with the default #
50 # Run dnf install/apt-get install/.. with the list of packages for your #
52 ###############################################################################
53 FEDORA_RPMS: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
54 CENTOS_RPMS: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz'
55 UBUNTU_DEBS: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
56 DEBIAN_DEBS: $UBUNTU_DEBS
57 ARCH_PKGS: 'git gcc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen'
58 ALPINE_PKGS: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers'
59 ############################ end of package lists #############################
60 # these tags should be updated each time the list of packages is updated
61 # changing these will force rebuilding the associated image
62 # Note: these tags have no meaning and are not tied to a particular
64 FEDORA_TAG: '2020-02-20.0'
65 CENTOS_TAG: '2020-02-17.1'
66 DEBIAN_TAG: '2020-02-17.1'
67 UBUNTU_TAG: '2020-02-17.1'
68 ARCH_TAG: '2020-02-17.1'
69 ALPINE_TAG: '2020-02-17.1'
70 QEMU_TAG: 'qemu-2020-02-18.0'
72 UPSTREAM_REPO: libevdev/libevdev
73 BUILDAH_IMAGE: $CI_REGISTRY/wayland/ci-templates/buildah:latest
74 FEDORA_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$FEDORA_TAG
75 CENTOS_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/centos/$CENTOS_VERSION:$CENTOS_TAG
76 UBUNTU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/ubuntu/$UBUNTU_VERSION:$UBUNTU_TAG
77 DEBIAN_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:$DEBIAN_TAG
78 ARCH_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/archlinux/rolling:$ARCH_TAG
79 ALPINE_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/alpine/latest:$ALPINE_TAG
80 QEMU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$QEMU_TAG
82 LIBEVDEV_SKIP_ROOT_TESTS: 1
84 MESON_BUILDDIR: 'build dir'
89 - _build/test/test-suite.log
90 - $MESON_BUILDDIR/meson-logs/
101 - pushd _build > /dev/null
102 - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
105 - if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi
112 - meson "$MESON_BUILDDIR" $MESON_ARGS
113 - ninja -C "$MESON_BUILDDIR" $NINJA_ARGS
114 - if ! [[ -z "$MESON_TEST_ARGS" ]]; then
115 meson test -C "$MESON_BUILDDIR" $MESON_TEST_ARGS;
118 #################################################################
122 #################################################################
124 # Re-generate the CI script and make sure it's the one currently checked in
125 # If this job fails, re-generate the gitlab-ci.yml script, see
126 # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
132 - apk add python3 git
133 - pip3 install --user jinja2
135 - python3 ./.gitlab-ci/generate-gitlab-ci.py
136 - git diff --exit-code && exit 0 || true
137 - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
144 - apk add python3 git
146 - pip3 install GitPython
147 - pip3 install pytest
149 pytest --junitxml=results.xml \
152 ./.gitlab-ci/check-commit.py
154 - master@libevdev/libevdev
161 .pull_upstream_or_rebuild:
163 # log in to the registry
164 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
166 # get the full container image name (DISTRIB_VERSION still has indirections)
167 - IMAGE=$(eval echo "$DISTRIB_FLAVOR/$DISTRIB_VERSION:$TAG")
170 # force rebuild if schedule, reuse otherwise
171 if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ;
173 # pull the latest upstream image if it exists
174 skopeo copy docker://$CI_REGISTRY/$UPSTREAM_REPO/$IMAGE \
175 docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
177 # check if our image is already in the current registry
178 skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
184 - .pull_upstream_or_rebuild
191 FEDORA_TAG: $QEMU_TAG
192 DISTRIB_FLAVOR: fedora
193 DISTRIB_VERSION: $FEDORA_VERSION
199 fedora:30@container-prep:
201 - .fedora@container-build
202 - .pull_upstream_or_rebuild
207 DISTRIB_FLAVOR: fedora
208 DISTRIB_VERSION: $FEDORA_VERSION
213 fedora:31@container-prep:
215 - .fedora@container-build
216 - .pull_upstream_or_rebuild
221 DISTRIB_FLAVOR: fedora
222 DISTRIB_VERSION: $FEDORA_VERSION
227 ubuntu:19.10@container-prep:
229 - .ubuntu@container-build
230 - .pull_upstream_or_rebuild
234 UBUNTU_VERSION: '19.10'
235 DISTRIB_FLAVOR: ubuntu
236 DISTRIB_VERSION: $UBUNTU_VERSION
241 ubuntu:19.04@container-prep:
243 - .ubuntu@container-build
244 - .pull_upstream_or_rebuild
248 UBUNTU_VERSION: '19.04'
249 DISTRIB_FLAVOR: ubuntu
250 DISTRIB_VERSION: $UBUNTU_VERSION
255 debian:stable@container-prep:
257 - .debian@container-build
258 - .pull_upstream_or_rebuild
262 DEBIAN_VERSION: 'stable'
263 DISTRIB_FLAVOR: debian
264 DISTRIB_VERSION: $DEBIAN_VERSION
269 debian:sid@container-prep:
271 - .debian@container-build
272 - .pull_upstream_or_rebuild
276 DEBIAN_VERSION: 'sid'
277 DISTRIB_FLAVOR: debian
278 DISTRIB_VERSION: $DEBIAN_VERSION
283 centos:7@container-prep:
285 - .centos@container-build
286 - .pull_upstream_or_rebuild
291 DISTRIB_FLAVOR: centos
292 DISTRIB_VERSION: $CENTOS_VERSION
297 centos:8@container-prep:
299 - .centos@container-build
300 - .pull_upstream_or_rebuild
305 DISTRIB_FLAVOR: centos
306 DISTRIB_VERSION: $CENTOS_VERSION
311 arch:rolling@container-prep:
313 - .arch@container-build
314 - .pull_upstream_or_rebuild
318 ARCH_VERSION: 'rolling'
319 DISTRIB_FLAVOR: archlinux
320 DISTRIB_VERSION: $ARCH_VERSION
325 alpine:latest@container-prep:
327 - .alpine@container-build
328 - .pull_upstream_or_rebuild
332 ALPINE_VERSION: 'latest'
333 DISTRIB_FLAVOR: alpine
334 DISTRIB_VERSION: $ALPINE_VERSION
338 #################################################################
340 # container clean stage #
341 # run during the clean stage #
343 #################################################################
346 # This stage will look for the container images we currently have in
347 # the registry and will remove any that are not tagged with the provided
348 # $container_image:$tag
351 stage: container_clean
352 image: $BUILDAH_IMAGE
354 # get the full container image name (CURRENT_CONTAINER_IMAGE still has indirections)
355 - CONTAINER_IMAGE=$(eval echo "$CURRENT_CONTAINER_IMAGE")
356 - GITLAB=$(echo $CI_PROJECT_URL | cut -f3 -d/)
357 - REPOSITORY=$(echo $CONTAINER_IMAGE | cut -f2- -d/ | cut -f1 -d:)
358 - IMAGE_PATH=$(echo $CONTAINER_IMAGE | cut -f1 -d:)
359 - LATEST_TAG=$(echo $CONTAINER_IMAGE | cut -f2 -d:)
361 # log in to the registry (read only)
362 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
364 # get the r/w token from the settings to access the registry
366 # each developer needs to register a secret variable that contains
367 # a personal token with api access. The token
368 # - must be named PERSONAL_TOKEN_$USER (for example PERSONAL_TOKEN_bentiss)
369 # - must be registered in the CI/CD Variables section as type file
370 # - value must be a netrc file as a single-line string:
371 # default login <user> password <token value>
372 # e.g. "default login bentiss password 1235abcde"
373 - tokenname="PERSONAL_TOKEN_$GITLAB_USER_LOGIN"
374 - netrcfile=$(eval echo "\$$tokenname")
375 - if [[ ! -f "$netrcfile" ]]; then
376 echo "No netrc file found or token is missing, skipping job" && false;
379 # request a token for the registry API
380 - REGISTRY_TOKEN=$(curl https://$GITLAB/jwt/auth --get
381 --silent --show-error
383 -d offline_token=true
384 -d service=container_registry
385 -d "scope=repository:$REPOSITORY:pull,*"
387 --netrc-file "$netrcfile"
388 | sed -r 's/(\{"token":"|"\})//g')
390 # get the digest of the latest image
391 - LATEST_MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.Digest')
393 # get the list of tags
394 - TAGS=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.RepoTags[]')
395 # FIXME: is the above command working properly? If not, use below:
396 # - TAGS=$(curl -X GET -H "accept:application/vnd.docker.distribution.manifest.v2+json"
397 # -H "authorization:Bearer $REGISTRY_TOKEN"
398 # https://$CI_REGISTRY/v2/$REPOSITORY/tags/list | jq -r '.tags[]')
400 # iterate over the tags
403 MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$tag | jq -r '.Digest');
404 if test x"$MANIFEST" != x"$LATEST_MANIFEST";
406 echo removing $tag as $MANIFEST;
407 curl https://$CI_REGISTRY/v2/$REPOSITORY/manifests/$MANIFEST --silent
408 -H "accept:application/vnd.docker.distribution.manifest.v2+json"
409 -H "authorization:Bearer $REGISTRY_TOKEN"
410 --fail --show-error -X DELETE || true
420 fedora:30@container-clean:
421 extends: .container-clean
425 CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
429 fedora:31@container-clean:
430 extends: .container-clean
434 CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
438 ubuntu:19.10@container-clean:
439 extends: .container-clean
442 UBUNTU_VERSION: '19.10'
443 CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
447 ubuntu:19.04@container-clean:
448 extends: .container-clean
451 UBUNTU_VERSION: '19.04'
452 CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
456 debian:stable@container-clean:
457 extends: .container-clean
460 DEBIAN_VERSION: 'stable'
461 CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
465 debian:sid@container-clean:
466 extends: .container-clean
469 DEBIAN_VERSION: 'sid'
470 CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
474 centos:7@container-clean:
475 extends: .container-clean
479 CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE
483 centos:8@container-clean:
484 extends: .container-clean
488 CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE
492 arch:rolling@container-clean:
493 extends: .container-clean
496 ARCH_VERSION: 'rolling'
497 CURRENT_CONTAINER_IMAGE: $ARCH_CONTAINER_IMAGE
501 alpine:latest@container-clean:
502 extends: .container-clean
505 ALPINE_VERSION: 'latest'
506 CURRENT_CONTAINER_IMAGE: $ALPINE_CONTAINER_IMAGE
509 #################################################################
513 #################################################################
515 .autotools-build@template:
521 MAKE_ARGS: "distcheck"
523 .meson-build@template:
532 fedora:30@autotools-build:
533 extends: .autotools-build@template
535 image: $FEDORA_CONTAINER_IMAGE
538 needs: ['fedora:30@container-prep']
540 fedora:30@meson-build:
541 extends: .meson-build@template
543 image: $FEDORA_CONTAINER_IMAGE
546 needs: ['fedora:30@container-prep']
549 fedora:31@autotools-build:
550 extends: .autotools-build@template
552 image: $FEDORA_CONTAINER_IMAGE
555 needs: ['fedora:31@container-prep']
557 fedora:31@meson-build:
558 extends: .meson-build@template
560 image: $FEDORA_CONTAINER_IMAGE
563 needs: ['fedora:31@container-prep']
566 ubuntu:19.10@autotools-build:
567 extends: .autotools-build@template
569 image: $UBUNTU_CONTAINER_IMAGE
571 UBUNTU_VERSION: '19.10'
572 needs: ['ubuntu:19.10@container-prep']
574 ubuntu:19.10@meson-build:
575 extends: .meson-build@template
577 image: $UBUNTU_CONTAINER_IMAGE
579 UBUNTU_VERSION: '19.10'
580 needs: ['ubuntu:19.10@container-prep']
583 ubuntu:19.04@autotools-build:
584 extends: .autotools-build@template
586 image: $UBUNTU_CONTAINER_IMAGE
588 UBUNTU_VERSION: '19.04'
589 needs: ['ubuntu:19.04@container-prep']
591 ubuntu:19.04@meson-build:
592 extends: .meson-build@template
594 image: $UBUNTU_CONTAINER_IMAGE
596 UBUNTU_VERSION: '19.04'
597 needs: ['ubuntu:19.04@container-prep']
600 debian:stable@autotools-build:
601 extends: .autotools-build@template
603 image: $DEBIAN_CONTAINER_IMAGE
605 DEBIAN_VERSION: 'stable'
606 needs: ['debian:stable@container-prep']
608 debian:stable@meson-build:
609 extends: .meson-build@template
611 image: $DEBIAN_CONTAINER_IMAGE
613 DEBIAN_VERSION: 'stable'
614 needs: ['debian:stable@container-prep']
617 debian:sid@autotools-build:
618 extends: .autotools-build@template
620 image: $DEBIAN_CONTAINER_IMAGE
622 DEBIAN_VERSION: 'sid'
623 needs: ['debian:sid@container-prep']
625 debian:sid@meson-build:
626 extends: .meson-build@template
628 image: $DEBIAN_CONTAINER_IMAGE
630 DEBIAN_VERSION: 'sid'
631 needs: ['debian:sid@container-prep']
634 centos:7@autotools-build:
635 extends: .autotools-build@template
637 image: $CENTOS_CONTAINER_IMAGE
640 MAKE_ARGS: '' # disable distcheck, requires doxygen
641 needs: ['centos:7@container-prep']
645 centos:8@autotools-build:
646 extends: .autotools-build@template
648 image: $CENTOS_CONTAINER_IMAGE
651 MAKE_ARGS: '' # disable distcheck, requires doxygen
652 needs: ['centos:8@container-prep']
656 arch:rolling@autotools-build:
657 extends: .autotools-build@template
659 image: $ARCH_CONTAINER_IMAGE
661 ARCH_VERSION: 'rolling'
662 needs: ['arch:rolling@container-prep']
664 arch:rolling@meson-build:
665 extends: .meson-build@template
667 image: $ARCH_CONTAINER_IMAGE
669 ARCH_VERSION: 'rolling'
670 needs: ['arch:rolling@container-prep']
673 alpine:latest@autotools-build:
674 extends: .autotools-build@template
676 image: $ALPINE_CONTAINER_IMAGE
678 ALPINE_VERSION: 'latest'
679 needs: ['alpine:latest@container-prep']
681 alpine:latest@meson-build:
682 extends: .meson-build@template
684 image: $ALPINE_CONTAINER_IMAGE
686 ALPINE_VERSION: 'latest'
687 needs: ['alpine:latest@container-prep']
690 # Build argument tests
692 # We only run the build option combinations on one image
693 # because they're supposed to fail equally on all
694 .fedora-custom-build@autotools-template:
695 extends: .autotools-build@template
697 image: $FEDORA_CONTAINER_IMAGE
700 needs: ['fedora:31@container-prep']
702 no-valgrind:autotools:
703 extends: .fedora-custom-build@autotools-template
705 - dnf remove -y valgrind
708 extends: .fedora-custom-build@autotools-template
710 - dnf remove -y check check-devel
712 no-doxygen:autotools:
713 extends: .fedora-custom-build@autotools-template
715 - dnf remove -y doxygen
717 MAKE_ARGS: '' # disable distcheck, requires doxygen
719 # doxygen is required for distcheck
720 no-doxygen-check-valgrind:autotools:
721 extends: .fedora-custom-build@autotools-template
723 - dnf remove -y doxygen valgrind check check-devel
725 MAKE_ARGS: '' # disable distcheck, requires doxygen
728 extends: .fedora-custom-build@autotools-template
730 - mv /usr/bin/nm /usr/bin/nm.moved
732 enable-gcov:autotools:
733 extends: .fedora-custom-build@autotools-template
735 CONFIGURE_FLAGS: "--enable-gcov"
737 .fedora-custom-build@meson-template:
738 extends: .meson-build@template
740 image: $FEDORA_CONTAINER_IMAGE
743 needs: ['fedora:31@container-prep']
746 extends: .fedora-custom-build@meson-template
748 - dnf remove -y valgrind
751 extends: .fedora-custom-build@meson-template
753 - dnf remove -y check check-devel
755 MESON_ARGS: -Dtests=disabled
757 # doxygen is required for dist
759 extends: .fedora-custom-build@meson-template
761 - dnf remove -y doxygen
763 MESON_ARGS: -Ddocumentation=disabled
766 # doxygen is required for dist
767 no-doxygen-check-valgrind:meson:
768 extends: .fedora-custom-build@meson-template
770 - dnf remove -y doxygen valgrind check check-devel
772 MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled
776 extends: .fedora-custom-build@meson-template
778 MESON_ARGS: '-Dcoverity=true'
781 extends: .fedora-custom-build@meson-template
783 NINJA_ARGS: 'scan-build'
787 image: $FEDORA_CONTAINER_IMAGE
789 - ./autogen.sh --prefix=$PWD/prefix-autotools/
791 - ls -l $PWD/prefix-autotools/lib/libevdev.so.2.3.0
792 - meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/
793 - ninja -C "$MESON_BUILDDIR" install
794 - ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0
797 needs: ['fedora:31@container-prep']
799 #################################################################
803 #################################################################
805 .check_tainted: &check_tainted |
806 # make sure the kernel is not tainted
807 if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
809 echo tainted kernel ;
815 image: $QEMU_CONTAINER_IMAGE
820 MESON_BUILDDIR: build_dir
822 # start our vm, no args required
827 - "scp -P 5555 -r $PWD localhost:"
828 - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
829 - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
830 - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
831 - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS\"" >> sshenv
832 - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
833 - "scp -P 5555 sshenv localhost:~/$CI_PROJECT_NAME/.meson_environment"
834 - ssh localhost -p 5555 "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
835 # no matter the results of the tests, we want to fetch the logs
836 - scp -P 5555 -r localhost:$CI_PROJECT_NAME/"$MESON_BUILDDIR" .
840 - ssh localhost -p 5555 halt || true
844 - if [[ ! -e .success ]] ;
849 name: "qemu-meson-logs-$CI_JOB_NAME"
853 - $MESON_BUILDDIR/meson-logs
860 needs: ['fedora:31@qemu-prep']
863 extends: .qemu@fedora:31
866 extends: .qemu@fedora:31
868 MESON_TEST_ARGS: '--setup=valgrind'
872 image: $FEDORA_CONTAINER_IMAGE
874 - export INSTALLDIR="$PWD/_inst"
876 - pushd _build > /dev/null
877 - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
881 - mkdir -p _tarball_dir
882 - tar xf _build/libevdev-*.tar.xz -C _tarball_dir
883 - pushd _tarball_dir/libevdev-*/ > /dev/null
884 - meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR"
885 - ninja -C "$MESON_BUILDDIR" test
886 - ninja -C "$MESON_BUILDDIR" install
891 needs: ['fedora:31@container-prep']
893 autotools-from-tarball:
895 image: $FEDORA_CONTAINER_IMAGE
897 - export INSTALLDIR="$PWD/_inst"
898 - meson "$MESON_BUILDDIR"
899 - ninja -C "$MESON_BUILDDIR" dist
900 - mkdir -p _tarball_dir
901 - tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir
902 - pushd _tarball_dir/libevdev-*/ > /dev/null
904 - pushd _build > /dev/null
905 - ../autogen.sh --disable-silent-rules --prefix="$INSTALLDIR" $CONFIGURE_FLAGS
914 needs: ['fedora:31@container-prep']