1 ########################################
3 # THIS FILE IS GENERATED, DO NOT EDIT #
5 ########################################
7 .templates_sha: &template_sha 8410d3382c4ba5e83da76a027cb332169f2a95ad # see https://docs.gitlab.com/ee/ci/yaml/#includefile
10 # Alpine container builder template
11 - project: 'wayland/ci-templates'
13 file: '/templates/alpine.yml'
14 # Arch container builder template
15 - project: 'wayland/ci-templates'
17 file: '/templates/arch.yml'
18 # Centos container builder template
19 - project: 'wayland/ci-templates'
21 file: '/templates/centos.yml'
22 # Debian container builder template
23 - project: 'wayland/ci-templates'
25 file: '/templates/debian.yml'
26 # Fedora container builder template
27 - project: 'wayland/ci-templates'
29 file: '/templates/fedora.yml'
30 # Ubuntu container builder template
31 - project: 'wayland/ci-templates'
33 file: '/templates/ubuntu.yml'
36 - prep # rebuild the container images if there is a change
37 - build # for actually building and testing things in a container
38 - VM # for running the test suite in a VM
39 - autotools # distribution builds with autotools
40 - meson # distribution builds with meson
41 - tarballs # tarball builds
42 - container_clean # clean up unused container images
45 ###############################################################################
46 # This is the list of packages required to build libevdev with the default #
49 # Run dnf install/apt-get install/.. with the list of packages for your #
51 ###############################################################################
52 FEDORA_RPMS: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
53 CENTOS_RPMS: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz'
54 UBUNTU_DEBS: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
55 DEBIAN_DEBS: $UBUNTU_DEBS
56 ARCH_PKGS: 'git gcc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen'
57 ALPINE_PKGS: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers'
58 ############################ end of package lists #############################
59 # these tags should be updated each time the list of packages is updated
60 # changing these will force rebuilding the associated image
61 # Note: these tags have no meaning and are not tied to a particular
63 FEDORA_TAG: '2020-02-26.4'
64 CENTOS_TAG: '2020-02-26.4'
65 DEBIAN_TAG: '2020-02-26.4'
66 UBUNTU_TAG: '2020-02-26.4'
67 ARCH_TAG: '2020-02-26.4'
68 ALPINE_TAG: '2020-02-26.4'
69 QEMU_TAG: 'qemu-2020-02-26.4'
71 UPSTREAM_REPO: libevdev/libevdev
72 BUILDAH_IMAGE: $CI_REGISTRY/wayland/ci-templates/buildah:latest
73 FEDORA_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$FEDORA_TAG
74 CENTOS_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/centos/$CENTOS_VERSION:$CENTOS_TAG
75 UBUNTU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/ubuntu/$UBUNTU_VERSION:$UBUNTU_TAG
76 DEBIAN_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:$DEBIAN_TAG
77 ARCH_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/arch/rolling:$ARCH_TAG
78 ALPINE_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/alpine/latest:$ALPINE_TAG
79 QEMU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$QEMU_TAG
81 LIBEVDEV_SKIP_ROOT_TESTS: 1
83 MESON_BUILDDIR: 'build dir'
88 - _build/test/test-suite.log
89 - $MESON_BUILDDIR/meson-logs/
93 junit: $MESON_BUILDDIR/junit-*.xml
100 - pushd _build > /dev/null
101 - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
104 - if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi
111 - .gitlab-ci/meson-build.sh
113 #################################################################
117 #################################################################
119 # Re-generate the CI script and make sure it's the one currently checked in
120 # If this job fails, re-generate the gitlab-ci.yml script, see
121 # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
127 - apk add python3 git
128 - pip3 install --user jinja2 PyYAML
130 - python3 ./.gitlab-ci/generate-gitlab-ci.py
131 - git diff --exit-code && exit 0 || true
132 - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
139 - apk add python3 git
141 - pip3 install GitPython
142 - pip3 install pytest
144 pytest --junitxml=results.xml \
147 ./.gitlab-ci/check-commit.py
149 - master@libevdev/libevdev
160 .pull_upstream_or_rebuild:
162 # log in to the registry
163 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
165 # get the full container image name (DISTRIB_VERSION still has indirections)
166 - IMAGE=$(eval echo "$DISTRIB_NAME/$DISTRIB_VERSION:$TAG")
169 # force rebuild if schedule, reuse otherwise
170 if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ;
172 # pull the latest upstream image if it exists
173 skopeo copy docker://$CI_REGISTRY/$UPSTREAM_REPO/$IMAGE \
174 docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
176 # check if our image is already in the current registry
177 skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
183 - .pull_upstream_or_rebuild
190 FEDORA_TAG: $QEMU_TAG
192 DISTRIB_VERSION: $FEDORA_VERSION
198 fedora:30@container-prep:
200 - .fedora@container-build
201 - .pull_upstream_or_rebuild
207 DISTRIB_VERSION: $FEDORA_VERSION
212 fedora:31@container-prep:
214 - .fedora@container-build
215 - .pull_upstream_or_rebuild
221 DISTRIB_VERSION: $FEDORA_VERSION
226 ubuntu:19.10@container-prep:
228 - .ubuntu@container-build
229 - .pull_upstream_or_rebuild
233 UBUNTU_VERSION: '19.10'
235 DISTRIB_VERSION: $UBUNTU_VERSION
240 ubuntu:19.04@container-prep:
242 - .ubuntu@container-build
243 - .pull_upstream_or_rebuild
247 UBUNTU_VERSION: '19.04'
249 DISTRIB_VERSION: $UBUNTU_VERSION
254 debian:stable@container-prep:
256 - .debian@container-build
257 - .pull_upstream_or_rebuild
261 DEBIAN_VERSION: 'stable'
263 DISTRIB_VERSION: $DEBIAN_VERSION
268 debian:sid@container-prep:
270 - .debian@container-build
271 - .pull_upstream_or_rebuild
275 DEBIAN_VERSION: 'sid'
277 DISTRIB_VERSION: $DEBIAN_VERSION
282 centos:7@container-prep:
284 - .centos@container-build
285 - .pull_upstream_or_rebuild
291 DISTRIB_VERSION: $CENTOS_VERSION
296 centos:8@container-prep:
298 - .centos@container-build
299 - .pull_upstream_or_rebuild
305 DISTRIB_VERSION: $CENTOS_VERSION
310 arch:rolling@container-prep:
312 - .arch@container-build
313 - .pull_upstream_or_rebuild
317 ARCH_VERSION: 'rolling'
319 DISTRIB_VERSION: $ARCH_VERSION
324 alpine:latest@container-prep:
326 - .alpine@container-build
327 - .pull_upstream_or_rebuild
331 ALPINE_VERSION: 'latest'
333 DISTRIB_VERSION: $ALPINE_VERSION
337 #################################################################
339 # container clean stage #
340 # run during the clean stage #
342 #################################################################
345 # This stage will look for the container images we currently have in
346 # the registry and will remove any that are not tagged with the provided
347 # $container_image:$tag
350 stage: container_clean
351 image: $BUILDAH_IMAGE
353 # get the full container image name (CURRENT_CONTAINER_IMAGE still has indirections)
354 - CONTAINER_IMAGE=$(eval echo "$CURRENT_CONTAINER_IMAGE")
355 - GITLAB=$(echo $CI_PROJECT_URL | cut -f3 -d/)
356 - REPOSITORY=$(echo $CONTAINER_IMAGE | cut -f2- -d/ | cut -f1 -d:)
357 - IMAGE_PATH=$(echo $CONTAINER_IMAGE | cut -f1 -d:)
358 - LATEST_TAG=$(echo $CONTAINER_IMAGE | cut -f2 -d:)
360 # log in to the registry (read only)
361 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
363 # get the r/w token from the settings to access the registry
365 # each developer needs to register a secret variable that contains
366 # a personal token with api access. The token
367 # - must be named PERSONAL_TOKEN_$USER (for example PERSONAL_TOKEN_bentiss)
368 # - must be registered in the CI/CD Variables section as type file
369 # - value must be a netrc file as a single-line string:
370 # default login <user> password <token value>
371 # e.g. "default login bentiss password 1235abcde"
372 - tokenname="PERSONAL_TOKEN_$GITLAB_USER_LOGIN"
373 - netrcfile=$(eval echo "\$$tokenname")
374 - if [[ ! -f "$netrcfile" ]]; then
375 echo "No netrc file found or token is missing, skipping job" && false;
378 # request a token for the registry API
379 - REGISTRY_TOKEN=$(curl https://$GITLAB/jwt/auth --get
380 --silent --show-error
382 -d offline_token=true
383 -d service=container_registry
384 -d "scope=repository:$REPOSITORY:pull,*"
386 --netrc-file "$netrcfile"
387 | sed -r 's/(\{"token":"|"\})//g')
389 # get the digest of the latest image
390 - LATEST_MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.Digest')
392 # get the list of tags
393 - TAGS=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.RepoTags[]')
394 # FIXME: is the above command working properly? If not, use below:
395 # - TAGS=$(curl -X GET -H "accept:application/vnd.docker.distribution.manifest.v2+json"
396 # -H "authorization:Bearer $REGISTRY_TOKEN"
397 # https://$CI_REGISTRY/v2/$REPOSITORY/tags/list | jq -r '.tags[]')
399 # iterate over the tags
402 MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$tag | jq -r '.Digest');
403 if test x"$MANIFEST" != x"$LATEST_MANIFEST";
405 echo removing $tag as $MANIFEST;
406 curl https://$CI_REGISTRY/v2/$REPOSITORY/manifests/$MANIFEST --silent
407 -H "accept:application/vnd.docker.distribution.manifest.v2+json"
408 -H "authorization:Bearer $REGISTRY_TOKEN"
409 --fail --show-error -X DELETE || true
421 fedora:30@container-clean:
422 extends: .container-clean
425 CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
429 fedora:31@container-clean:
430 extends: .container-clean
433 CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
437 ubuntu:19.10@container-clean:
438 extends: .container-clean
440 UBUNTU_VERSION: '19.10'
441 CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
445 ubuntu:19.04@container-clean:
446 extends: .container-clean
448 UBUNTU_VERSION: '19.04'
449 CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
453 debian:stable@container-clean:
454 extends: .container-clean
456 DEBIAN_VERSION: 'stable'
457 CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
461 debian:sid@container-clean:
462 extends: .container-clean
464 DEBIAN_VERSION: 'sid'
465 CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
469 centos:7@container-clean:
470 extends: .container-clean
473 CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE
477 centos:8@container-clean:
478 extends: .container-clean
481 CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE
485 arch:rolling@container-clean:
486 extends: .container-clean
488 ARCH_VERSION: 'rolling'
489 CURRENT_CONTAINER_IMAGE: $ARCH_CONTAINER_IMAGE
493 alpine:latest@container-clean:
494 extends: .container-clean
496 ALPINE_VERSION: 'latest'
497 CURRENT_CONTAINER_IMAGE: $ALPINE_CONTAINER_IMAGE
500 #################################################################
504 #################################################################
506 .autotools-build@template:
512 MAKE_ARGS: "distcheck"
514 .meson-build@template:
523 fedora:30@autotools-build:
524 extends: .autotools-build@template
526 image: $FEDORA_CONTAINER_IMAGE
529 needs: ['fedora:30@container-prep']
531 fedora:30@meson-build:
532 extends: .meson-build@template
534 image: $FEDORA_CONTAINER_IMAGE
537 needs: ['fedora:30@container-prep']
540 fedora:31@autotools-build:
541 extends: .autotools-build@template
543 image: $FEDORA_CONTAINER_IMAGE
546 needs: ['fedora:31@container-prep']
548 fedora:31@meson-build:
549 extends: .meson-build@template
551 image: $FEDORA_CONTAINER_IMAGE
554 needs: ['fedora:31@container-prep']
557 ubuntu:19.10@autotools-build:
558 extends: .autotools-build@template
560 image: $UBUNTU_CONTAINER_IMAGE
562 UBUNTU_VERSION: '19.10'
563 needs: ['ubuntu:19.10@container-prep']
565 ubuntu:19.10@meson-build:
566 extends: .meson-build@template
568 image: $UBUNTU_CONTAINER_IMAGE
570 UBUNTU_VERSION: '19.10'
571 needs: ['ubuntu:19.10@container-prep']
574 ubuntu:19.04@autotools-build:
575 extends: .autotools-build@template
577 image: $UBUNTU_CONTAINER_IMAGE
579 UBUNTU_VERSION: '19.04'
580 needs: ['ubuntu:19.04@container-prep']
582 ubuntu:19.04@meson-build:
583 extends: .meson-build@template
585 image: $UBUNTU_CONTAINER_IMAGE
587 UBUNTU_VERSION: '19.04'
588 needs: ['ubuntu:19.04@container-prep']
591 debian:stable@autotools-build:
592 extends: .autotools-build@template
594 image: $DEBIAN_CONTAINER_IMAGE
596 DEBIAN_VERSION: 'stable'
597 needs: ['debian:stable@container-prep']
599 debian:stable@meson-build:
600 extends: .meson-build@template
602 image: $DEBIAN_CONTAINER_IMAGE
604 DEBIAN_VERSION: 'stable'
605 needs: ['debian:stable@container-prep']
608 debian:sid@autotools-build:
609 extends: .autotools-build@template
611 image: $DEBIAN_CONTAINER_IMAGE
613 DEBIAN_VERSION: 'sid'
614 needs: ['debian:sid@container-prep']
616 debian:sid@meson-build:
617 extends: .meson-build@template
619 image: $DEBIAN_CONTAINER_IMAGE
621 DEBIAN_VERSION: 'sid'
622 needs: ['debian:sid@container-prep']
625 centos:7@autotools-build:
626 extends: .autotools-build@template
628 image: $CENTOS_CONTAINER_IMAGE
631 MAKE_ARGS: '' # disable distcheck, requires doxygen
632 needs: ['centos:7@container-prep']
636 centos:8@autotools-build:
637 extends: .autotools-build@template
639 image: $CENTOS_CONTAINER_IMAGE
642 MAKE_ARGS: '' # disable distcheck, requires doxygen
643 needs: ['centos:8@container-prep']
647 arch:rolling@autotools-build:
648 extends: .autotools-build@template
650 image: $ARCH_CONTAINER_IMAGE
652 ARCH_VERSION: 'rolling'
653 needs: ['arch:rolling@container-prep']
655 arch:rolling@meson-build:
656 extends: .meson-build@template
658 image: $ARCH_CONTAINER_IMAGE
660 ARCH_VERSION: 'rolling'
661 needs: ['arch:rolling@container-prep']
664 alpine:latest@autotools-build:
665 extends: .autotools-build@template
667 image: $ALPINE_CONTAINER_IMAGE
669 ALPINE_VERSION: 'latest'
670 needs: ['alpine:latest@container-prep']
672 alpine:latest@meson-build:
673 extends: .meson-build@template
675 image: $ALPINE_CONTAINER_IMAGE
677 ALPINE_VERSION: 'latest'
678 needs: ['alpine:latest@container-prep']
681 # Build argument tests
683 # We only run the build option combinations on one image
684 # because they're supposed to fail equally on all
685 .fedora-custom-build@autotools-template:
686 extends: .autotools-build@template
688 image: $FEDORA_CONTAINER_IMAGE
691 needs: ['fedora:31@container-prep']
693 no-valgrind:autotools:
694 extends: .fedora-custom-build@autotools-template
696 - dnf remove -y valgrind
699 extends: .fedora-custom-build@autotools-template
701 - dnf remove -y check check-devel
703 no-doxygen:autotools:
704 extends: .fedora-custom-build@autotools-template
706 - dnf remove -y doxygen
708 MAKE_ARGS: '' # disable distcheck, requires doxygen
710 # doxygen is required for distcheck
711 no-doxygen-check-valgrind:autotools:
712 extends: .fedora-custom-build@autotools-template
714 - dnf remove -y doxygen valgrind check check-devel
716 MAKE_ARGS: '' # disable distcheck, requires doxygen
719 extends: .fedora-custom-build@autotools-template
721 - mv /usr/bin/nm /usr/bin/nm.moved
723 enable-gcov:autotools:
724 extends: .fedora-custom-build@autotools-template
726 CONFIGURE_FLAGS: "--enable-gcov"
728 .fedora-custom-build@meson-template:
729 extends: .meson-build@template
731 image: $FEDORA_CONTAINER_IMAGE
734 needs: ['fedora:31@container-prep']
737 extends: .fedora-custom-build@meson-template
739 - dnf remove -y valgrind
742 extends: .fedora-custom-build@meson-template
744 - dnf remove -y check check-devel
746 MESON_ARGS: -Dtests=disabled
749 # doxygen is required for dist
751 extends: .fedora-custom-build@meson-template
753 - dnf remove -y doxygen
755 MESON_ARGS: -Ddocumentation=disabled
758 # doxygen is required for dist
759 no-doxygen-check-valgrind:meson:
760 extends: .fedora-custom-build@meson-template
762 - dnf remove -y doxygen valgrind check check-devel
764 MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled
769 extends: .fedora-custom-build@meson-template
771 MESON_ARGS: '-Dcoverity=true'
774 extends: .fedora-custom-build@meson-template
776 NINJA_ARGS: 'scan-build'
781 image: $FEDORA_CONTAINER_IMAGE
783 - ./autogen.sh --prefix=$PWD/prefix-autotools/
785 - ls -l $PWD/prefix-autotools/lib/libevdev.so.2.3.0
786 - meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/
787 - ninja -C "$MESON_BUILDDIR" install
788 - ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0
791 needs: ['fedora:31@container-prep']
793 #################################################################
797 #################################################################
799 .check_tainted: &check_tainted |
800 # make sure the kernel is not tainted
801 if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
803 echo tainted kernel ;
809 image: $QEMU_CONTAINER_IMAGE
814 MESON_BUILDDIR: build_dir
816 # start our vm, no args required
821 - "scp -P 5555 -r $PWD localhost:"
822 - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
823 - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
824 - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
825 - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS\"" >> sshenv
826 - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
827 - "scp -P 5555 sshenv localhost:~/$CI_PROJECT_NAME/.meson_environment"
828 - ssh localhost -p 5555 "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
829 # no matter the results of the tests, we want to fetch the logs
830 - scp -P 5555 -r localhost:$CI_PROJECT_NAME/"$MESON_BUILDDIR" .
834 - ssh localhost -p 5555 halt || true
838 - if [[ ! -e .success ]] ;
843 name: "qemu-meson-logs-$CI_JOB_NAME"
847 - $MESON_BUILDDIR/meson-logs
850 junit: $MESON_BUILDDIR/junit-*.xml
855 needs: ['fedora:31@qemu-prep']
858 extends: .qemu@fedora:31
861 extends: .qemu@fedora:31
863 MESON_TEST_ARGS: '--setup=valgrind'
867 image: $FEDORA_CONTAINER_IMAGE
869 - export INSTALLDIR="$PWD/_inst"
871 - pushd _build > /dev/null
872 - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
876 - mkdir -p _tarball_dir
877 - tar xf _build/libevdev-*.tar.xz -C _tarball_dir
878 - pushd _tarball_dir/libevdev-*/ > /dev/null
879 - meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR"
880 - ninja -C "$MESON_BUILDDIR" test
881 - ninja -C "$MESON_BUILDDIR" install
886 needs: ['fedora:31@container-prep']
888 autotools-from-tarball:
890 image: $FEDORA_CONTAINER_IMAGE
892 - export INSTALLDIR="$PWD/_inst"
893 - meson "$MESON_BUILDDIR"
894 - ninja -C "$MESON_BUILDDIR" dist
895 - mkdir -p _tarball_dir
896 - tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir
897 - pushd _tarball_dir/libevdev-*/ > /dev/null
899 - pushd _build > /dev/null
900 - ../autogen.sh --disable-silent-rules --prefix="$INSTALLDIR" $CONFIGURE_FLAGS
909 needs: ['fedora:31@container-prep']