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
159 .pull_upstream_or_rebuild:
161 # log in to the registry
162 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
164 # get the full container image name (DISTRIB_VERSION still has indirections)
165 - IMAGE=$(eval echo "$DISTRIB_NAME/$DISTRIB_VERSION:$TAG")
168 # force rebuild if schedule, reuse otherwise
169 if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ;
171 # pull the latest upstream image if it exists
172 skopeo copy docker://$CI_REGISTRY/$UPSTREAM_REPO/$IMAGE \
173 docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
175 # check if our image is already in the current registry
176 skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
182 - .pull_upstream_or_rebuild
189 FEDORA_TAG: $QEMU_TAG
191 DISTRIB_VERSION: $FEDORA_VERSION
197 fedora:30@container-prep:
199 - .fedora@container-build
200 - .pull_upstream_or_rebuild
206 DISTRIB_VERSION: $FEDORA_VERSION
211 fedora:31@container-prep:
213 - .fedora@container-build
214 - .pull_upstream_or_rebuild
220 DISTRIB_VERSION: $FEDORA_VERSION
225 ubuntu:19.10@container-prep:
227 - .ubuntu@container-build
228 - .pull_upstream_or_rebuild
232 UBUNTU_VERSION: '19.10'
234 DISTRIB_VERSION: $UBUNTU_VERSION
239 ubuntu:19.04@container-prep:
241 - .ubuntu@container-build
242 - .pull_upstream_or_rebuild
246 UBUNTU_VERSION: '19.04'
248 DISTRIB_VERSION: $UBUNTU_VERSION
253 debian:stable@container-prep:
255 - .debian@container-build
256 - .pull_upstream_or_rebuild
260 DEBIAN_VERSION: 'stable'
262 DISTRIB_VERSION: $DEBIAN_VERSION
267 debian:sid@container-prep:
269 - .debian@container-build
270 - .pull_upstream_or_rebuild
274 DEBIAN_VERSION: 'sid'
276 DISTRIB_VERSION: $DEBIAN_VERSION
281 centos:7@container-prep:
283 - .centos@container-build
284 - .pull_upstream_or_rebuild
290 DISTRIB_VERSION: $CENTOS_VERSION
295 centos:8@container-prep:
297 - .centos@container-build
298 - .pull_upstream_or_rebuild
304 DISTRIB_VERSION: $CENTOS_VERSION
309 arch:rolling@container-prep:
311 - .arch@container-build
312 - .pull_upstream_or_rebuild
316 ARCH_VERSION: 'rolling'
318 DISTRIB_VERSION: $ARCH_VERSION
323 alpine:latest@container-prep:
325 - .alpine@container-build
326 - .pull_upstream_or_rebuild
330 ALPINE_VERSION: 'latest'
332 DISTRIB_VERSION: $ALPINE_VERSION
336 #################################################################
338 # container clean stage #
339 # run during the clean stage #
341 #################################################################
344 # This stage will look for the container images we currently have in
345 # the registry and will remove any that are not tagged with the provided
346 # $container_image:$tag
349 stage: container_clean
350 image: $BUILDAH_IMAGE
352 # get the full container image name (CURRENT_CONTAINER_IMAGE still has indirections)
353 - CONTAINER_IMAGE=$(eval echo "$CURRENT_CONTAINER_IMAGE")
354 - GITLAB=$(echo $CI_PROJECT_URL | cut -f3 -d/)
355 - REPOSITORY=$(echo $CONTAINER_IMAGE | cut -f2- -d/ | cut -f1 -d:)
356 - IMAGE_PATH=$(echo $CONTAINER_IMAGE | cut -f1 -d:)
357 - LATEST_TAG=$(echo $CONTAINER_IMAGE | cut -f2 -d:)
359 # log in to the registry (read only)
360 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
362 # get the r/w token from the settings to access the registry
364 # each developer needs to register a secret variable that contains
365 # a personal token with api access. The token
366 # - must be named PERSONAL_TOKEN_$USER (for example PERSONAL_TOKEN_bentiss)
367 # - must be registered in the CI/CD Variables section as type file
368 # - value must be a netrc file as a single-line string:
369 # default login <user> password <token value>
370 # e.g. "default login bentiss password 1235abcde"
371 - tokenname="PERSONAL_TOKEN_$GITLAB_USER_LOGIN"
372 - netrcfile=$(eval echo "\$$tokenname")
373 - if [[ ! -f "$netrcfile" ]]; then
374 echo "No netrc file found or token is missing, skipping job" && false;
377 # request a token for the registry API
378 - REGISTRY_TOKEN=$(curl https://$GITLAB/jwt/auth --get
379 --silent --show-error
381 -d offline_token=true
382 -d service=container_registry
383 -d "scope=repository:$REPOSITORY:pull,*"
385 --netrc-file "$netrcfile"
386 | sed -r 's/(\{"token":"|"\})//g')
388 # get the digest of the latest image
389 - LATEST_MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.Digest')
391 # get the list of tags
392 - TAGS=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.RepoTags[]')
393 # FIXME: is the above command working properly? If not, use below:
394 # - TAGS=$(curl -X GET -H "accept:application/vnd.docker.distribution.manifest.v2+json"
395 # -H "authorization:Bearer $REGISTRY_TOKEN"
396 # https://$CI_REGISTRY/v2/$REPOSITORY/tags/list | jq -r '.tags[]')
398 # iterate over the tags
401 MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$tag | jq -r '.Digest');
402 if test x"$MANIFEST" != x"$LATEST_MANIFEST";
404 echo removing $tag as $MANIFEST;
405 curl https://$CI_REGISTRY/v2/$REPOSITORY/manifests/$MANIFEST --silent
406 -H "accept:application/vnd.docker.distribution.manifest.v2+json"
407 -H "authorization:Bearer $REGISTRY_TOKEN"
408 --fail --show-error -X DELETE || true
420 fedora:30@container-clean:
421 extends: .container-clean
424 CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
428 fedora:31@container-clean:
429 extends: .container-clean
432 CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
436 ubuntu:19.10@container-clean:
437 extends: .container-clean
439 UBUNTU_VERSION: '19.10'
440 CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
444 ubuntu:19.04@container-clean:
445 extends: .container-clean
447 UBUNTU_VERSION: '19.04'
448 CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
452 debian:stable@container-clean:
453 extends: .container-clean
455 DEBIAN_VERSION: 'stable'
456 CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
460 debian:sid@container-clean:
461 extends: .container-clean
463 DEBIAN_VERSION: 'sid'
464 CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
468 centos:7@container-clean:
469 extends: .container-clean
472 CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE
476 centos:8@container-clean:
477 extends: .container-clean
480 CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE
484 arch:rolling@container-clean:
485 extends: .container-clean
487 ARCH_VERSION: 'rolling'
488 CURRENT_CONTAINER_IMAGE: $ARCH_CONTAINER_IMAGE
492 alpine:latest@container-clean:
493 extends: .container-clean
495 ALPINE_VERSION: 'latest'
496 CURRENT_CONTAINER_IMAGE: $ALPINE_CONTAINER_IMAGE
499 #################################################################
503 #################################################################
505 .autotools-build@template:
511 MAKE_ARGS: "distcheck"
513 .meson-build@template:
522 fedora:30@autotools-build:
523 extends: .autotools-build@template
525 image: $FEDORA_CONTAINER_IMAGE
528 needs: ['fedora:30@container-prep']
530 fedora:30@meson-build:
531 extends: .meson-build@template
533 image: $FEDORA_CONTAINER_IMAGE
536 needs: ['fedora:30@container-prep']
539 fedora:31@autotools-build:
540 extends: .autotools-build@template
542 image: $FEDORA_CONTAINER_IMAGE
545 needs: ['fedora:31@container-prep']
547 fedora:31@meson-build:
548 extends: .meson-build@template
550 image: $FEDORA_CONTAINER_IMAGE
553 needs: ['fedora:31@container-prep']
556 ubuntu:19.10@autotools-build:
557 extends: .autotools-build@template
559 image: $UBUNTU_CONTAINER_IMAGE
561 UBUNTU_VERSION: '19.10'
562 needs: ['ubuntu:19.10@container-prep']
564 ubuntu:19.10@meson-build:
565 extends: .meson-build@template
567 image: $UBUNTU_CONTAINER_IMAGE
569 UBUNTU_VERSION: '19.10'
570 needs: ['ubuntu:19.10@container-prep']
573 ubuntu:19.04@autotools-build:
574 extends: .autotools-build@template
576 image: $UBUNTU_CONTAINER_IMAGE
578 UBUNTU_VERSION: '19.04'
579 needs: ['ubuntu:19.04@container-prep']
581 ubuntu:19.04@meson-build:
582 extends: .meson-build@template
584 image: $UBUNTU_CONTAINER_IMAGE
586 UBUNTU_VERSION: '19.04'
587 needs: ['ubuntu:19.04@container-prep']
590 debian:stable@autotools-build:
591 extends: .autotools-build@template
593 image: $DEBIAN_CONTAINER_IMAGE
595 DEBIAN_VERSION: 'stable'
596 needs: ['debian:stable@container-prep']
598 debian:stable@meson-build:
599 extends: .meson-build@template
601 image: $DEBIAN_CONTAINER_IMAGE
603 DEBIAN_VERSION: 'stable'
604 needs: ['debian:stable@container-prep']
607 debian:sid@autotools-build:
608 extends: .autotools-build@template
610 image: $DEBIAN_CONTAINER_IMAGE
612 DEBIAN_VERSION: 'sid'
613 needs: ['debian:sid@container-prep']
615 debian:sid@meson-build:
616 extends: .meson-build@template
618 image: $DEBIAN_CONTAINER_IMAGE
620 DEBIAN_VERSION: 'sid'
621 needs: ['debian:sid@container-prep']
624 centos:7@autotools-build:
625 extends: .autotools-build@template
627 image: $CENTOS_CONTAINER_IMAGE
630 MAKE_ARGS: '' # disable distcheck, requires doxygen
631 needs: ['centos:7@container-prep']
635 centos:8@autotools-build:
636 extends: .autotools-build@template
638 image: $CENTOS_CONTAINER_IMAGE
641 MAKE_ARGS: '' # disable distcheck, requires doxygen
642 needs: ['centos:8@container-prep']
646 arch:rolling@autotools-build:
647 extends: .autotools-build@template
649 image: $ARCH_CONTAINER_IMAGE
651 ARCH_VERSION: 'rolling'
652 needs: ['arch:rolling@container-prep']
654 arch:rolling@meson-build:
655 extends: .meson-build@template
657 image: $ARCH_CONTAINER_IMAGE
659 ARCH_VERSION: 'rolling'
660 needs: ['arch:rolling@container-prep']
663 alpine:latest@autotools-build:
664 extends: .autotools-build@template
666 image: $ALPINE_CONTAINER_IMAGE
668 ALPINE_VERSION: 'latest'
669 needs: ['alpine:latest@container-prep']
671 alpine:latest@meson-build:
672 extends: .meson-build@template
674 image: $ALPINE_CONTAINER_IMAGE
676 ALPINE_VERSION: 'latest'
677 needs: ['alpine:latest@container-prep']
680 # Build argument tests
682 # We only run the build option combinations on one image
683 # because they're supposed to fail equally on all
684 .fedora-custom-build@autotools-template:
685 extends: .autotools-build@template
687 image: $FEDORA_CONTAINER_IMAGE
690 needs: ['fedora:31@container-prep']
692 no-valgrind:autotools:
693 extends: .fedora-custom-build@autotools-template
695 - dnf remove -y valgrind
698 extends: .fedora-custom-build@autotools-template
700 - dnf remove -y check check-devel
702 no-doxygen:autotools:
703 extends: .fedora-custom-build@autotools-template
705 - dnf remove -y doxygen
707 MAKE_ARGS: '' # disable distcheck, requires doxygen
709 # doxygen is required for distcheck
710 no-doxygen-check-valgrind:autotools:
711 extends: .fedora-custom-build@autotools-template
713 - dnf remove -y doxygen valgrind check check-devel
715 MAKE_ARGS: '' # disable distcheck, requires doxygen
718 extends: .fedora-custom-build@autotools-template
720 - mv /usr/bin/nm /usr/bin/nm.moved
722 enable-gcov:autotools:
723 extends: .fedora-custom-build@autotools-template
725 CONFIGURE_FLAGS: "--enable-gcov"
727 .fedora-custom-build@meson-template:
728 extends: .meson-build@template
730 image: $FEDORA_CONTAINER_IMAGE
733 needs: ['fedora:31@container-prep']
736 extends: .fedora-custom-build@meson-template
738 - dnf remove -y valgrind
741 extends: .fedora-custom-build@meson-template
743 - dnf remove -y check check-devel
745 MESON_ARGS: -Dtests=disabled
748 # doxygen is required for dist
750 extends: .fedora-custom-build@meson-template
752 - dnf remove -y doxygen
754 MESON_ARGS: -Ddocumentation=disabled
757 # doxygen is required for dist
758 no-doxygen-check-valgrind:meson:
759 extends: .fedora-custom-build@meson-template
761 - dnf remove -y doxygen valgrind check check-devel
763 MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled
768 extends: .fedora-custom-build@meson-template
770 MESON_ARGS: '-Dcoverity=true'
773 extends: .fedora-custom-build@meson-template
775 NINJA_ARGS: 'scan-build'
780 image: $FEDORA_CONTAINER_IMAGE
782 - ./autogen.sh --prefix=$PWD/prefix-autotools/
784 - ls -l $PWD/prefix-autotools/lib/libevdev.so.2.3.0
785 - meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/
786 - ninja -C "$MESON_BUILDDIR" install
787 - ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0
790 needs: ['fedora:31@container-prep']
792 #################################################################
796 #################################################################
798 .check_tainted: &check_tainted |
799 # make sure the kernel is not tainted
800 if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
802 echo tainted kernel ;
808 image: $QEMU_CONTAINER_IMAGE
813 MESON_BUILDDIR: build_dir
815 # start our vm, no args required
820 - "scp -P 5555 -r $PWD localhost:"
821 - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
822 - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
823 - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
824 - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS\"" >> sshenv
825 - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
826 - "scp -P 5555 sshenv localhost:~/$CI_PROJECT_NAME/.meson_environment"
827 - ssh localhost -p 5555 "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
828 # no matter the results of the tests, we want to fetch the logs
829 - scp -P 5555 -r localhost:$CI_PROJECT_NAME/"$MESON_BUILDDIR" .
833 - ssh localhost -p 5555 halt || true
837 - if [[ ! -e .success ]] ;
842 name: "qemu-meson-logs-$CI_JOB_NAME"
846 - $MESON_BUILDDIR/meson-logs
849 junit: $MESON_BUILDDIR/junit-*.xml
854 needs: ['fedora:31@qemu-prep']
857 extends: .qemu@fedora:31
860 extends: .qemu@fedora:31
862 MESON_TEST_ARGS: '--setup=valgrind'
866 image: $FEDORA_CONTAINER_IMAGE
868 - export INSTALLDIR="$PWD/_inst"
870 - pushd _build > /dev/null
871 - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
875 - mkdir -p _tarball_dir
876 - tar xf _build/libevdev-*.tar.xz -C _tarball_dir
877 - pushd _tarball_dir/libevdev-*/ > /dev/null
878 - meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR"
879 - ninja -C "$MESON_BUILDDIR" test
880 - ninja -C "$MESON_BUILDDIR" install
885 needs: ['fedora:31@container-prep']
887 autotools-from-tarball:
889 image: $FEDORA_CONTAINER_IMAGE
891 - export INSTALLDIR="$PWD/_inst"
892 - meson "$MESON_BUILDDIR"
893 - ninja -C "$MESON_BUILDDIR" dist
894 - mkdir -p _tarball_dir
895 - tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir
896 - pushd _tarball_dir/libevdev-*/ > /dev/null
898 - pushd _build > /dev/null
899 - ../autogen.sh --disable-silent-rules --prefix="$INSTALLDIR" $CONFIGURE_FLAGS
908 needs: ['fedora:31@container-prep']