1 ########################################
3 # THIS FILE IS GENERATED, DO NOT EDIT #
5 ########################################
7 .templates_sha: &template_sha df52af2195b052325daf5d715c88be90f8ec7d86 # 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 # The upstrem repository we will check for images
46 FDO_UPSTREAM_REPO: libevdev/libevdev
47 # The image that has buildah installed
48 BUILDAH_IMAGE: $CI_REGISTRY/wayland/ci-templates/buildah:latest
49 LIBEVDEV_SKIP_ROOT_TESTS: 1
51 MESON_BUILDDIR: 'build dir'
56 - _build/test/test-suite.log
57 - $MESON_BUILDDIR/meson-logs/
61 junit: $MESON_BUILDDIR/junit-*.xml
68 - pushd _build > /dev/null
69 - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
72 - if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi
79 - .gitlab-ci/meson-build.sh
81 # Base image for a given distribution, provides
82 # - the image of that distribution
83 # - DISTRO_CONTAINER_IMAGE for any manipulation the job needs to be
85 image: $CI_REGISTRY_IMAGE/$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
87 DISTRO_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
90 extends: .distribution_image
92 DISTRIB_NAME: 'fedora'
93 FDO_DISTRIBUTION_TAG: '2020-03-06.0'
94 FDO_DISTRIBUTION_VERSION: '30'
97 extends: .distribution_image
99 DISTRIB_NAME: 'fedora'
100 FDO_DISTRIBUTION_TAG: '2020-03-06.0'
101 FDO_DISTRIBUTION_VERSION: '31'
104 extends: .distribution_image
106 DISTRIB_NAME: 'ubuntu'
107 FDO_DISTRIBUTION_TAG: '2020-03-06.0'
108 FDO_DISTRIBUTION_VERSION: '19.10'
111 extends: .distribution_image
113 DISTRIB_NAME: 'ubuntu'
114 FDO_DISTRIBUTION_TAG: '2020-03-06.0'
115 FDO_DISTRIBUTION_VERSION: '19.04'
118 extends: .distribution_image
120 DISTRIB_NAME: 'debian'
121 FDO_DISTRIBUTION_TAG: '2020-03-06.0'
122 FDO_DISTRIBUTION_VERSION: 'stable'
125 extends: .distribution_image
127 DISTRIB_NAME: 'debian'
128 FDO_DISTRIBUTION_TAG: '2020-03-06.0'
129 FDO_DISTRIBUTION_VERSION: 'sid'
132 extends: .distribution_image
134 DISTRIB_NAME: 'centos'
135 FDO_DISTRIBUTION_TAG: '2020-03-06.0'
136 FDO_DISTRIBUTION_VERSION: '7'
139 extends: .distribution_image
141 DISTRIB_NAME: 'centos'
142 FDO_DISTRIBUTION_TAG: '2020-03-06.0'
143 FDO_DISTRIBUTION_VERSION: '8'
146 extends: .distribution_image
149 FDO_DISTRIBUTION_TAG: '2020-03-06.0'
150 FDO_DISTRIBUTION_VERSION: 'rolling'
153 extends: .distribution_image
155 DISTRIB_NAME: 'alpine'
156 FDO_DISTRIBUTION_TAG: '2020-03-06.0'
157 FDO_DISTRIBUTION_VERSION: 'latest'
161 #################################################################
165 #################################################################
167 # Re-generate the CI script and make sure it's the one currently checked in
168 # If this job fails, re-generate the gitlab-ci.yml script, see
169 # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
175 - apk add python3 git
176 - pip3 install --user jinja2 PyYAML
178 - python3 ./.gitlab-ci/generate-gitlab-ci.py
179 - git diff --exit-code && exit 0 || true
180 - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
187 - apk add python3 git
189 - pip3 install GitPython
190 - pip3 install pytest
192 pytest --junitxml=results.xml \
195 ./.gitlab-ci/check-commit.py
197 - master@libevdev/libevdev
208 .pull_upstream_or_rebuild:
210 # log in to the registry
211 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
213 # get the full container image name (FDO_DISTRIBUTION_VERSION still has indirections)
214 - IMAGE=$(eval echo "$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG")
217 # force rebuild if schedule, reuse otherwise
218 if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ;
220 # pull the latest upstream image if it exists
221 skopeo copy docker://$CI_REGISTRY/$FDO_UPSTREAM_REPO/$IMAGE \
222 docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
224 # check if our image is already in the current registry
225 skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
228 .fedora:30@qemu-prep:
231 - .fdo.qemu-build@fedora
232 - .pull_upstream_or_rebuild
238 FDO_DISTRIBUTION_TAG: qemu-2020-03-06.0
239 FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
242 .fedora:31@qemu-prep:
245 - .fdo.qemu-build@fedora
246 - .pull_upstream_or_rebuild
252 FDO_DISTRIBUTION_TAG: qemu-2020-03-06.0
253 FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
258 extends: .fedora:31@qemu-prep
262 fedora:30@container-prep:
265 - .fdo.container-build@fedora
266 - .pull_upstream_or_rebuild
270 FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
274 fedora:31@container-prep:
277 - .fdo.container-build@fedora
278 - .pull_upstream_or_rebuild
282 FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
286 ubuntu:19.10@container-prep:
289 - .fdo.container-build@ubuntu
290 - .pull_upstream_or_rebuild
294 FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
298 ubuntu:19.04@container-prep:
301 - .fdo.container-build@ubuntu
302 - .pull_upstream_or_rebuild
306 FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
310 debian:stable@container-prep:
313 - .fdo.container-build@debian
314 - .pull_upstream_or_rebuild
318 FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
322 debian:sid@container-prep:
325 - .fdo.container-build@debian
326 - .pull_upstream_or_rebuild
330 FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
334 centos:7@container-prep:
337 - .fdo.container-build@centos
338 - .pull_upstream_or_rebuild
342 FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz'
346 centos:8@container-prep:
349 - .fdo.container-build@centos
350 - .pull_upstream_or_rebuild
354 FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz'
358 arch:rolling@container-prep:
361 - .fdo.container-build@arch
362 - .pull_upstream_or_rebuild
366 FDO_DISTRIBUTION_PACKAGES: 'git gcc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen'
370 alpine:latest@container-prep:
373 - .fdo.container-build@alpine
374 - .pull_upstream_or_rebuild
378 FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers'
381 #################################################################
383 # container clean stage #
384 # run during the clean stage #
386 #################################################################
389 # This stage will look for the container images we currently have in
390 # the registry and will remove any that are not tagged with the provided
391 # $container_image:$tag
394 stage: container_clean
395 image: $BUILDAH_IMAGE
397 - CONTAINER_IMAGE=$DISTRO_CONTAINER_IMAGE
398 - GITLAB=$(echo $CI_PROJECT_URL | cut -f3 -d/)
399 - REPOSITORY=$(echo $CONTAINER_IMAGE | cut -f2- -d/ | cut -f1 -d:)
400 - IMAGE_PATH=$(echo $CONTAINER_IMAGE | cut -f1 -d:)
401 - LATEST_TAG=$(echo $CONTAINER_IMAGE | cut -f2 -d:)
403 # log in to the registry (read only)
404 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
406 # get the r/w token from the settings to access the registry
408 # each developer needs to register a secret variable that contains
409 # a personal token with api access. The token
410 # - must be named PERSONAL_TOKEN_$USER (for example PERSONAL_TOKEN_bentiss)
411 # - must be registered in the CI/CD Variables section as type file
412 # - value must be a netrc file as a single-line string:
413 # default login <user> password <token value>
414 # e.g. "default login bentiss password 1235abcde"
415 - tokenname="PERSONAL_TOKEN_$GITLAB_USER_LOGIN"
416 - netrcfile=$(eval echo "\$$tokenname")
417 - if [[ ! -f "$netrcfile" ]]; then
418 echo "No netrc file found or token is missing, skipping job" && false;
421 # request a token for the registry API
422 - REGISTRY_TOKEN=$(curl https://$GITLAB/jwt/auth --get
423 --silent --show-error
425 -d offline_token=true
426 -d service=container_registry
427 -d "scope=repository:$REPOSITORY:pull,*"
429 --netrc-file "$netrcfile"
430 | sed -r 's/(\{"token":"|"\})//g')
432 # get the digest of the latest image
433 - LATEST_MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.Digest')
435 # get the list of tags
436 - TAGS=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.RepoTags[]')
437 # FIXME: is the above command working properly? If not, use below:
438 # - TAGS=$(curl -X GET -H "accept:application/vnd.docker.distribution.manifest.v2+json"
439 # -H "authorization:Bearer $REGISTRY_TOKEN"
440 # https://$CI_REGISTRY/v2/$REPOSITORY/tags/list | jq -r '.tags[]')
442 # iterate over the tags
445 MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$tag | jq -r '.Digest');
446 if test x"$MANIFEST" != x"$LATEST_MANIFEST";
448 echo removing $tag as $MANIFEST;
449 curl https://$CI_REGISTRY/v2/$REPOSITORY/manifests/$MANIFEST --silent
450 -H "accept:application/vnd.docker.distribution.manifest.v2+json"
451 -H "authorization:Bearer $REGISTRY_TOKEN"
452 --fail --show-error -X DELETE || true
463 fedora:30@container-clean:
469 fedora:31@container-clean:
475 ubuntu:19.10@container-clean:
481 ubuntu:19.04@container-clean:
487 debian:stable@container-clean:
493 debian:sid@container-clean:
499 centos:7@container-clean:
505 centos:8@container-clean:
511 arch:rolling@container-clean:
517 alpine:latest@container-clean:
523 #################################################################
527 #################################################################
529 .autotools-build@template:
535 MAKE_ARGS: "distcheck"
537 .meson-build@template:
546 fedora:30@autotools-build:
549 - .autotools-build@template
551 needs: ['fedora:30@container-prep']
553 fedora:30@meson-build:
556 - .meson-build@template
558 needs: ['fedora:30@container-prep']
561 fedora:31@autotools-build:
564 - .autotools-build@template
566 needs: ['fedora:31@container-prep']
568 fedora:31@meson-build:
571 - .meson-build@template
573 needs: ['fedora:31@container-prep']
576 ubuntu:19.10@autotools-build:
579 - .autotools-build@template
581 needs: ['ubuntu:19.10@container-prep']
583 ubuntu:19.10@meson-build:
586 - .meson-build@template
588 needs: ['ubuntu:19.10@container-prep']
591 ubuntu:19.04@autotools-build:
594 - .autotools-build@template
596 needs: ['ubuntu:19.04@container-prep']
598 ubuntu:19.04@meson-build:
601 - .meson-build@template
603 needs: ['ubuntu:19.04@container-prep']
606 debian:stable@autotools-build:
609 - .autotools-build@template
611 needs: ['debian:stable@container-prep']
613 debian:stable@meson-build:
616 - .meson-build@template
618 needs: ['debian:stable@container-prep']
621 debian:sid@autotools-build:
624 - .autotools-build@template
626 needs: ['debian:sid@container-prep']
628 debian:sid@meson-build:
631 - .meson-build@template
633 needs: ['debian:sid@container-prep']
636 centos:7@autotools-build:
639 - .autotools-build@template
642 MAKE_ARGS: '' # disable distcheck, requires doxygen
643 needs: ['centos:7@container-prep']
647 centos:8@autotools-build:
650 - .autotools-build@template
653 MAKE_ARGS: '' # disable distcheck, requires doxygen
654 needs: ['centos:8@container-prep']
658 arch:rolling@autotools-build:
661 - .autotools-build@template
663 needs: ['arch:rolling@container-prep']
665 arch:rolling@meson-build:
668 - .meson-build@template
670 needs: ['arch:rolling@container-prep']
673 alpine:latest@autotools-build:
676 - .autotools-build@template
678 needs: ['alpine:latest@container-prep']
680 alpine:latest@meson-build:
683 - .meson-build@template
685 needs: ['alpine:latest@container-prep']
688 # Build argument tests
690 # We only run the build option combinations on one image
691 # because they're supposed to fail equally on all
692 .fedora-custom-build@autotools-template:
695 - .autotools-build@template
697 needs: ['fedora:31@container-prep']
699 no-valgrind:autotools:
700 extends: .fedora-custom-build@autotools-template
702 - dnf remove -y valgrind
705 extends: .fedora-custom-build@autotools-template
707 - dnf remove -y check check-devel
709 no-doxygen:autotools:
710 extends: .fedora-custom-build@autotools-template
712 - dnf remove -y doxygen
714 MAKE_ARGS: '' # disable distcheck, requires doxygen
716 # doxygen is required for distcheck
717 no-doxygen-check-valgrind:autotools:
718 extends: .fedora-custom-build@autotools-template
720 - dnf remove -y doxygen valgrind check check-devel
722 MAKE_ARGS: '' # disable distcheck, requires doxygen
725 extends: .fedora-custom-build@autotools-template
727 - mv /usr/bin/nm /usr/bin/nm.moved
729 enable-gcov:autotools:
730 extends: .fedora-custom-build@autotools-template
732 CONFIGURE_FLAGS: "--enable-gcov"
734 .fedora-custom-build@meson-template:
737 - .meson-build@template
739 needs: ['fedora:31@container-prep']
742 extends: .fedora-custom-build@meson-template
744 - dnf remove -y valgrind
747 extends: .fedora-custom-build@meson-template
749 - dnf remove -y check check-devel
751 MESON_ARGS: -Dtests=disabled
754 # doxygen is required for dist
756 extends: .fedora-custom-build@meson-template
758 - dnf remove -y doxygen
760 MESON_ARGS: -Ddocumentation=disabled
763 # doxygen is required for dist
764 no-doxygen-check-valgrind:meson:
765 extends: .fedora-custom-build@meson-template
767 - dnf remove -y doxygen valgrind check check-devel
769 MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled
774 extends: .fedora-custom-build@meson-template
776 MESON_ARGS: '-Dcoverity=true'
779 extends: .fedora-custom-build@meson-template
781 NINJA_ARGS: 'scan-build'
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
795 needs: ['fedora:31@container-prep']
797 #################################################################
801 #################################################################
803 .check_tainted: &check_tainted |
804 # make sure the kernel is not tainted
805 if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
807 echo tainted kernel ;
816 $CI_REGISTRY_IMAGE/$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:qemu-$FDO_DISTRIBUTION_TAG
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
856 junit: $MESON_BUILDDIR/junit-*.xml
861 needs: ['fedora:31@qemu-prep']
864 extends: .qemu@fedora:31
867 extends: .qemu@fedora:31
869 MESON_TEST_ARGS: '--setup=valgrind'
876 - export INSTALLDIR="$PWD/_inst"
878 - pushd _build > /dev/null
879 - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
883 - mkdir -p _tarball_dir
884 - tar xf _build/libevdev-*.tar.xz -C _tarball_dir
885 - pushd _tarball_dir/libevdev-*/ > /dev/null
886 - meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR"
887 - ninja -C "$MESON_BUILDDIR" test
888 - ninja -C "$MESON_BUILDDIR" install
891 needs: ['fedora:31@container-prep']
893 autotools-from-tarball:
898 - export INSTALLDIR="$PWD/_inst"
899 - meson "$MESON_BUILDDIR"
900 - ninja -C "$MESON_BUILDDIR" dist
901 - mkdir -p _tarball_dir
902 - tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir
903 - pushd _tarball_dir/libevdev-*/ > /dev/null
905 - pushd _build > /dev/null
906 - ../autogen.sh --disable-silent-rules --prefix="$INSTALLDIR" $CONFIGURE_FLAGS
913 needs: ['fedora:31@container-prep']