1 # vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:
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'
15 file: '/templates/alpine.yml'
16 # Arch container builder template
17 - project: 'wayland/ci-templates'
19 file: '/templates/arch.yml'
20 # Centos container builder template
21 - project: 'wayland/ci-templates'
23 file: '/templates/centos.yml'
24 # Debian container builder template
25 - project: 'wayland/ci-templates'
27 file: '/templates/debian.yml'
28 # Fedora container builder template
29 - project: 'wayland/ci-templates'
31 file: '/templates/fedora.yml'
32 # Ubuntu container builder template
33 - project: 'wayland/ci-templates'
35 file: '/templates/ubuntu.yml'
38 - prep # rebuild the container images if there is a change
39 - build # for actually building and testing things in a container
40 - VM # for running the test suite in a VM
41 - autotools # distribution builds with autotools
42 - meson # distribution builds with meson
43 - tarballs # tarball builds
44 - container_clean # clean up unused container images
47 ###############################################################################
48 # This is the list of packages required to build libevdev with the default #
51 # Run dnf install/apt-get install/.. with the list of packages for your #
53 ###############################################################################
54 FEDORA_RPMS: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
55 CENTOS_RPMS: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz'
56 UBUNTU_DEBS: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
57 DEBIAN_DEBS: $UBUNTU_DEBS
58 ARCH_PKGS: 'git gcc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen'
59 ALPINE_PKGS: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers'
60 ############################ end of package lists #############################
61 # these tags should be updated each time the list of packages is updated
62 # changing these will force rebuilding the associated image
63 # Note: these tags have no meaning and are not tied to a particular
65 FEDORA_TAG: '2020-02-24.0'
66 CENTOS_TAG: '2020-02-24.0'
67 DEBIAN_TAG: '2020-02-24.0'
68 UBUNTU_TAG: '2020-02-24.0'
69 ARCH_TAG: '2020-02-24.0'
70 ALPINE_TAG: '2020-02-24.0'
71 QEMU_TAG: 'qemu-2020-02-24.0'
73 UPSTREAM_REPO: libevdev/libevdev
74 BUILDAH_IMAGE: $CI_REGISTRY/wayland/ci-templates/buildah:latest
75 FEDORA_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$FEDORA_TAG
76 CENTOS_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/centos/$CENTOS_VERSION:$CENTOS_TAG
77 UBUNTU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/ubuntu/$UBUNTU_VERSION:$UBUNTU_TAG
78 DEBIAN_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:$DEBIAN_TAG
79 ARCH_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/archlinux/rolling:$ARCH_TAG
80 ALPINE_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/alpine/latest:$ALPINE_TAG
81 QEMU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$QEMU_TAG
83 LIBEVDEV_SKIP_ROOT_TESTS: 1
85 MESON_BUILDDIR: 'build dir'
90 - _build/test/test-suite.log
91 - $MESON_BUILDDIR/meson-logs/
102 - pushd _build > /dev/null
103 - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
106 - if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi
113 - meson "$MESON_BUILDDIR" $MESON_ARGS
114 - ninja -C "$MESON_BUILDDIR" $NINJA_ARGS
115 - if ! [[ -z "$MESON_TEST_ARGS" ]]; then
116 meson test -C "$MESON_BUILDDIR" $MESON_TEST_ARGS;
119 #################################################################
123 #################################################################
125 # Re-generate the CI script and make sure it's the one currently checked in
126 # If this job fails, re-generate the gitlab-ci.yml script, see
127 # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
133 - apk add python3 git
134 - pip3 install --user jinja2 PyYAML
136 - python3 ./.gitlab-ci/generate-gitlab-ci.py
137 - git diff --exit-code && exit 0 || true
138 - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
145 - apk add python3 git
147 - pip3 install GitPython
148 - pip3 install pytest
150 pytest --junitxml=results.xml \
153 ./.gitlab-ci/check-commit.py
155 - master@libevdev/libevdev
162 .pull_upstream_or_rebuild:
164 # log in to the registry
165 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
167 # get the full container image name (DISTRIB_VERSION still has indirections)
168 - IMAGE=$(eval echo "$DISTRIB_FLAVOR/$DISTRIB_VERSION:$TAG")
171 # force rebuild if schedule, reuse otherwise
172 if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ;
174 # pull the latest upstream image if it exists
175 skopeo copy docker://$CI_REGISTRY/$UPSTREAM_REPO/$IMAGE \
176 docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
178 # check if our image is already in the current registry
179 skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
185 - .pull_upstream_or_rebuild
192 FEDORA_TAG: $QEMU_TAG
193 DISTRIB_FLAVOR: fedora
194 DISTRIB_VERSION: $FEDORA_VERSION
200 fedora:30@container-prep:
202 - .fedora@container-build
203 - .pull_upstream_or_rebuild
208 DISTRIB_FLAVOR: fedora
209 DISTRIB_VERSION: $FEDORA_VERSION
214 fedora:31@container-prep:
216 - .fedora@container-build
217 - .pull_upstream_or_rebuild
222 DISTRIB_FLAVOR: fedora
223 DISTRIB_VERSION: $FEDORA_VERSION
228 ubuntu:19.10@container-prep:
230 - .ubuntu@container-build
231 - .pull_upstream_or_rebuild
235 UBUNTU_VERSION: '19.10'
236 DISTRIB_FLAVOR: ubuntu
237 DISTRIB_VERSION: $UBUNTU_VERSION
242 ubuntu:19.04@container-prep:
244 - .ubuntu@container-build
245 - .pull_upstream_or_rebuild
249 UBUNTU_VERSION: '19.04'
250 DISTRIB_FLAVOR: ubuntu
251 DISTRIB_VERSION: $UBUNTU_VERSION
256 debian:stable@container-prep:
258 - .debian@container-build
259 - .pull_upstream_or_rebuild
263 DEBIAN_VERSION: 'stable'
264 DISTRIB_FLAVOR: debian
265 DISTRIB_VERSION: $DEBIAN_VERSION
270 debian:sid@container-prep:
272 - .debian@container-build
273 - .pull_upstream_or_rebuild
277 DEBIAN_VERSION: 'sid'
278 DISTRIB_FLAVOR: debian
279 DISTRIB_VERSION: $DEBIAN_VERSION
284 centos:7@container-prep:
286 - .centos@container-build
287 - .pull_upstream_or_rebuild
292 DISTRIB_FLAVOR: centos
293 DISTRIB_VERSION: $CENTOS_VERSION
298 centos:8@container-prep:
300 - .centos@container-build
301 - .pull_upstream_or_rebuild
306 DISTRIB_FLAVOR: centos
307 DISTRIB_VERSION: $CENTOS_VERSION
312 arch:rolling@container-prep:
314 - .arch@container-build
315 - .pull_upstream_or_rebuild
319 ARCH_VERSION: 'rolling'
321 DISTRIB_VERSION: $ARCH_VERSION
326 alpine:latest@container-prep:
328 - .alpine@container-build
329 - .pull_upstream_or_rebuild
333 ALPINE_VERSION: 'latest'
334 DISTRIB_FLAVOR: alpine
335 DISTRIB_VERSION: $ALPINE_VERSION
339 #################################################################
341 # container clean stage #
342 # run during the clean stage #
344 #################################################################
347 # This stage will look for the container images we currently have in
348 # the registry and will remove any that are not tagged with the provided
349 # $container_image:$tag
352 stage: container_clean
353 image: $BUILDAH_IMAGE
355 # get the full container image name (CURRENT_CONTAINER_IMAGE still has indirections)
356 - CONTAINER_IMAGE=$(eval echo "$CURRENT_CONTAINER_IMAGE")
357 - GITLAB=$(echo $CI_PROJECT_URL | cut -f3 -d/)
358 - REPOSITORY=$(echo $CONTAINER_IMAGE | cut -f2- -d/ | cut -f1 -d:)
359 - IMAGE_PATH=$(echo $CONTAINER_IMAGE | cut -f1 -d:)
360 - LATEST_TAG=$(echo $CONTAINER_IMAGE | cut -f2 -d:)
362 # log in to the registry (read only)
363 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
365 # get the r/w token from the settings to access the registry
367 # each developer needs to register a secret variable that contains
368 # a personal token with api access. The token
369 # - must be named PERSONAL_TOKEN_$USER (for example PERSONAL_TOKEN_bentiss)
370 # - must be registered in the CI/CD Variables section as type file
371 # - value must be a netrc file as a single-line string:
372 # default login <user> password <token value>
373 # e.g. "default login bentiss password 1235abcde"
374 - tokenname="PERSONAL_TOKEN_$GITLAB_USER_LOGIN"
375 - netrcfile=$(eval echo "\$$tokenname")
376 - if [[ ! -f "$netrcfile" ]]; then
377 echo "No netrc file found or token is missing, skipping job" && false;
380 # request a token for the registry API
381 - REGISTRY_TOKEN=$(curl https://$GITLAB/jwt/auth --get
382 --silent --show-error
384 -d offline_token=true
385 -d service=container_registry
386 -d "scope=repository:$REPOSITORY:pull,*"
388 --netrc-file "$netrcfile"
389 | sed -r 's/(\{"token":"|"\})//g')
391 # get the digest of the latest image
392 - LATEST_MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.Digest')
394 # get the list of tags
395 - TAGS=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.RepoTags[]')
396 # FIXME: is the above command working properly? If not, use below:
397 # - TAGS=$(curl -X GET -H "accept:application/vnd.docker.distribution.manifest.v2+json"
398 # -H "authorization:Bearer $REGISTRY_TOKEN"
399 # https://$CI_REGISTRY/v2/$REPOSITORY/tags/list | jq -r '.tags[]')
401 # iterate over the tags
404 MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$tag | jq -r '.Digest');
405 if test x"$MANIFEST" != x"$LATEST_MANIFEST";
407 echo removing $tag as $MANIFEST;
408 curl https://$CI_REGISTRY/v2/$REPOSITORY/manifests/$MANIFEST --silent
409 -H "accept:application/vnd.docker.distribution.manifest.v2+json"
410 -H "authorization:Bearer $REGISTRY_TOKEN"
411 --fail --show-error -X DELETE || true
421 fedora:30@container-clean:
422 extends: .container-clean
426 CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
430 fedora:31@container-clean:
431 extends: .container-clean
435 CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
439 ubuntu:19.10@container-clean:
440 extends: .container-clean
443 UBUNTU_VERSION: '19.10'
444 CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
448 ubuntu:19.04@container-clean:
449 extends: .container-clean
452 UBUNTU_VERSION: '19.04'
453 CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
457 debian:stable@container-clean:
458 extends: .container-clean
461 DEBIAN_VERSION: 'stable'
462 CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
466 debian:sid@container-clean:
467 extends: .container-clean
470 DEBIAN_VERSION: 'sid'
471 CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
475 centos:7@container-clean:
476 extends: .container-clean
480 CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE
484 centos:8@container-clean:
485 extends: .container-clean
489 CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE
493 arch:rolling@container-clean:
494 extends: .container-clean
497 ARCH_VERSION: 'rolling'
498 CURRENT_CONTAINER_IMAGE: $ARCH_CONTAINER_IMAGE
502 alpine:latest@container-clean:
503 extends: .container-clean
506 ALPINE_VERSION: 'latest'
507 CURRENT_CONTAINER_IMAGE: $ALPINE_CONTAINER_IMAGE
510 #################################################################
514 #################################################################
516 .autotools-build@template:
522 MAKE_ARGS: "distcheck"
524 .meson-build@template:
533 fedora:30@autotools-build:
534 extends: .autotools-build@template
536 image: $FEDORA_CONTAINER_IMAGE
539 needs: ['fedora:30@container-prep']
541 fedora:30@meson-build:
542 extends: .meson-build@template
544 image: $FEDORA_CONTAINER_IMAGE
547 needs: ['fedora:30@container-prep']
550 fedora:31@autotools-build:
551 extends: .autotools-build@template
553 image: $FEDORA_CONTAINER_IMAGE
556 needs: ['fedora:31@container-prep']
558 fedora:31@meson-build:
559 extends: .meson-build@template
561 image: $FEDORA_CONTAINER_IMAGE
564 needs: ['fedora:31@container-prep']
567 ubuntu:19.10@autotools-build:
568 extends: .autotools-build@template
570 image: $UBUNTU_CONTAINER_IMAGE
572 UBUNTU_VERSION: '19.10'
573 needs: ['ubuntu:19.10@container-prep']
575 ubuntu:19.10@meson-build:
576 extends: .meson-build@template
578 image: $UBUNTU_CONTAINER_IMAGE
580 UBUNTU_VERSION: '19.10'
581 needs: ['ubuntu:19.10@container-prep']
584 ubuntu:19.04@autotools-build:
585 extends: .autotools-build@template
587 image: $UBUNTU_CONTAINER_IMAGE
589 UBUNTU_VERSION: '19.04'
590 needs: ['ubuntu:19.04@container-prep']
592 ubuntu:19.04@meson-build:
593 extends: .meson-build@template
595 image: $UBUNTU_CONTAINER_IMAGE
597 UBUNTU_VERSION: '19.04'
598 needs: ['ubuntu:19.04@container-prep']
601 debian:stable@autotools-build:
602 extends: .autotools-build@template
604 image: $DEBIAN_CONTAINER_IMAGE
606 DEBIAN_VERSION: 'stable'
607 needs: ['debian:stable@container-prep']
609 debian:stable@meson-build:
610 extends: .meson-build@template
612 image: $DEBIAN_CONTAINER_IMAGE
614 DEBIAN_VERSION: 'stable'
615 needs: ['debian:stable@container-prep']
618 debian:sid@autotools-build:
619 extends: .autotools-build@template
621 image: $DEBIAN_CONTAINER_IMAGE
623 DEBIAN_VERSION: 'sid'
624 needs: ['debian:sid@container-prep']
626 debian:sid@meson-build:
627 extends: .meson-build@template
629 image: $DEBIAN_CONTAINER_IMAGE
631 DEBIAN_VERSION: 'sid'
632 needs: ['debian:sid@container-prep']
635 centos:7@autotools-build:
636 extends: .autotools-build@template
638 image: $CENTOS_CONTAINER_IMAGE
641 MAKE_ARGS: '' # disable distcheck, requires doxygen
642 needs: ['centos:7@container-prep']
646 centos:8@autotools-build:
647 extends: .autotools-build@template
649 image: $CENTOS_CONTAINER_IMAGE
652 MAKE_ARGS: '' # disable distcheck, requires doxygen
653 needs: ['centos:8@container-prep']
657 arch:rolling@autotools-build:
658 extends: .autotools-build@template
660 image: $ARCH_CONTAINER_IMAGE
662 ARCH_VERSION: 'rolling'
663 needs: ['arch:rolling@container-prep']
665 arch:rolling@meson-build:
666 extends: .meson-build@template
668 image: $ARCH_CONTAINER_IMAGE
670 ARCH_VERSION: 'rolling'
671 needs: ['arch:rolling@container-prep']
674 alpine:latest@autotools-build:
675 extends: .autotools-build@template
677 image: $ALPINE_CONTAINER_IMAGE
679 ALPINE_VERSION: 'latest'
680 needs: ['alpine:latest@container-prep']
682 alpine:latest@meson-build:
683 extends: .meson-build@template
685 image: $ALPINE_CONTAINER_IMAGE
687 ALPINE_VERSION: 'latest'
688 needs: ['alpine:latest@container-prep']
691 # Build argument tests
693 # We only run the build option combinations on one image
694 # because they're supposed to fail equally on all
695 .fedora-custom-build@autotools-template:
696 extends: .autotools-build@template
698 image: $FEDORA_CONTAINER_IMAGE
701 needs: ['fedora:31@container-prep']
703 no-valgrind:autotools:
704 extends: .fedora-custom-build@autotools-template
706 - dnf remove -y valgrind
709 extends: .fedora-custom-build@autotools-template
711 - dnf remove -y check check-devel
713 no-doxygen:autotools:
714 extends: .fedora-custom-build@autotools-template
716 - dnf remove -y doxygen
718 MAKE_ARGS: '' # disable distcheck, requires doxygen
720 # doxygen is required for distcheck
721 no-doxygen-check-valgrind:autotools:
722 extends: .fedora-custom-build@autotools-template
724 - dnf remove -y doxygen valgrind check check-devel
726 MAKE_ARGS: '' # disable distcheck, requires doxygen
729 extends: .fedora-custom-build@autotools-template
731 - mv /usr/bin/nm /usr/bin/nm.moved
733 enable-gcov:autotools:
734 extends: .fedora-custom-build@autotools-template
736 CONFIGURE_FLAGS: "--enable-gcov"
738 .fedora-custom-build@meson-template:
739 extends: .meson-build@template
741 image: $FEDORA_CONTAINER_IMAGE
744 needs: ['fedora:31@container-prep']
747 extends: .fedora-custom-build@meson-template
749 - dnf remove -y valgrind
752 extends: .fedora-custom-build@meson-template
754 - dnf remove -y check check-devel
756 MESON_ARGS: -Dtests=disabled
758 # doxygen is required for dist
760 extends: .fedora-custom-build@meson-template
762 - dnf remove -y doxygen
764 MESON_ARGS: -Ddocumentation=disabled
767 # doxygen is required for dist
768 no-doxygen-check-valgrind:meson:
769 extends: .fedora-custom-build@meson-template
771 - dnf remove -y doxygen valgrind check check-devel
773 MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled
777 extends: .fedora-custom-build@meson-template
779 MESON_ARGS: '-Dcoverity=true'
782 extends: .fedora-custom-build@meson-template
784 NINJA_ARGS: 'scan-build'
788 image: $FEDORA_CONTAINER_IMAGE
790 - ./autogen.sh --prefix=$PWD/prefix-autotools/
792 - ls -l $PWD/prefix-autotools/lib/libevdev.so.2.3.0
793 - meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/
794 - ninja -C "$MESON_BUILDDIR" install
795 - ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0
798 needs: ['fedora:31@container-prep']
800 #################################################################
804 #################################################################
806 .check_tainted: &check_tainted |
807 # make sure the kernel is not tainted
808 if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
810 echo tainted kernel ;
816 image: $QEMU_CONTAINER_IMAGE
821 MESON_BUILDDIR: build_dir
823 # start our vm, no args required
828 - "scp -P 5555 -r $PWD localhost:"
829 - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
830 - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
831 - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
832 - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS\"" >> sshenv
833 - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
834 - "scp -P 5555 sshenv localhost:~/$CI_PROJECT_NAME/.meson_environment"
835 - ssh localhost -p 5555 "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
836 # no matter the results of the tests, we want to fetch the logs
837 - scp -P 5555 -r localhost:$CI_PROJECT_NAME/"$MESON_BUILDDIR" .
841 - ssh localhost -p 5555 halt || true
845 - if [[ ! -e .success ]] ;
850 name: "qemu-meson-logs-$CI_JOB_NAME"
854 - $MESON_BUILDDIR/meson-logs
857 junit: $MESON_BUILDDIR/junit-*.xml
863 needs: ['fedora:31@qemu-prep']
866 extends: .qemu@fedora:31
869 extends: .qemu@fedora:31
871 MESON_TEST_ARGS: '--setup=valgrind'
875 image: $FEDORA_CONTAINER_IMAGE
877 - export INSTALLDIR="$PWD/_inst"
879 - pushd _build > /dev/null
880 - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
884 - mkdir -p _tarball_dir
885 - tar xf _build/libevdev-*.tar.xz -C _tarball_dir
886 - pushd _tarball_dir/libevdev-*/ > /dev/null
887 - meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR"
888 - ninja -C "$MESON_BUILDDIR" test
889 - ninja -C "$MESON_BUILDDIR" install
894 needs: ['fedora:31@container-prep']
896 autotools-from-tarball:
898 image: $FEDORA_CONTAINER_IMAGE
900 - export INSTALLDIR="$PWD/_inst"
901 - meson "$MESON_BUILDDIR"
902 - ninja -C "$MESON_BUILDDIR" dist
903 - mkdir -p _tarball_dir
904 - tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir
905 - pushd _tarball_dir/libevdev-*/ > /dev/null
907 - pushd _build > /dev/null
908 - ../autogen.sh --disable-silent-rules --prefix="$INSTALLDIR" $CONFIGURE_FLAGS
917 needs: ['fedora:31@container-prep']