1 # vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0:
3 .templates_sha: &template_sha 01f2a6a8ab5cd31000c1c14a1acfff68ea98b59e # see https://docs.gitlab.com/ee/ci/yaml/#includefile
6 # Alpine container builder template
7 - project: 'wayland/ci-templates'
8 file: '/templates/alpine.yml'
9 # Arch container builder template
10 - project: 'wayland/ci-templates'
12 file: '/templates/arch.yml'
13 # Fedora container builder template
14 - project: 'wayland/ci-templates'
16 file: '/templates/fedora.yml'
17 # Ubuntu container builder template
18 - project: 'wayland/ci-templates'
20 file: '/templates/ubuntu.yml'
21 # Debian container builder template
22 - project: 'wayland/ci-templates'
24 file: '/templates/debian.yml'
25 # CentOS container builder template
26 - project: 'wayland/ci-templates'
28 file: '/templates/centos.yml'
31 - prep # rebuild the container images if there is a change
32 - build # for actually building and testing things in a container
33 - VM # for running the test suite in a VM
34 - distro # distribs test
35 - deploy # trigger wayland's website generation
36 - container_clean # clean up unused container images
39 ###############################################################################
40 # This is the list of packages required to build libevdev with the default #
43 # Run dnf install/apt-get install/.. with the list of packages for your #
45 ###############################################################################
46 FEDORA_RPMS: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz'
47 CENTOS_RPMS: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz'
48 UBUNTU_DEBS: 'git gcc g++ automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
49 DEBIAN_DEBS: $UBUNTU_DEBS
50 ARCH_PKGS: 'git gcc automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen'
51 ALPINE_PKGS: 'git gcc g++ automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers'
52 ############################ end of package lists #############################
53 # these tags should be updated each time the list of packages is updated
54 # changing these will force rebuilding the associated image
55 # Note: these tags have no meaning and are not tied to a particular
57 FEDORA_TAG: '2020-02-03.0'
58 CENTOS_TAG: '2020-02-03.0'
59 DEBIAN_TAG: '2020-02-03.0'
60 UBUNTU_TAG: '2020-02-03.0'
61 ARCH_TAG: '2020-02-03.0'
62 ALPINE_TAG: '2020-02-03.0'
64 UPSTREAM_REPO: libevdev/libevdev
65 BUILDAH_IMAGE: $CI_REGISTRY/wayland/ci-templates/buildah:latest
66 FEDORA_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$FEDORA_TAG
67 CENTOS_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/centos/$CENTOS_VERSION:$CENTOS_TAG
68 UBUNTU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/ubuntu/$UBUNTU_VERSION:$UBUNTU_TAG
69 DEBIAN_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:$DEBIAN_TAG
70 ARCH_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/archlinux/rolling:$ARCH_TAG
71 ALPINE_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/alpine/latest:$ALPINE_TAG
73 LIBEVDEV_SKIP_ROOT_TESTS: 1
79 - _build/test/test-suite.log
90 - pushd _build > /dev/null
91 - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
94 - if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi
97 #################################################################
101 #################################################################
107 - apk add python3 git
109 - pip3 install GitPython
110 - pip3 install pytest
112 pytest --junitxml=results.xml \
115 ./.gitlab-ci/check-commit.py
117 - master@libevdev/libevdev
124 .pull_upstream_or_rebuild:
126 # log in to the registry
127 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
129 # get the full container image name (DISTRIB_VERSION still has indirections)
130 - IMAGE=$(eval echo "$DISTRIB_FLAVOR/$DISTRIB_VERSION:$TAG")
133 # force rebuild if schedule, reuse otherwise
134 if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ;
136 # pull the latest upstream image if it exists
137 skopeo copy docker://$CI_REGISTRY/$UPSTREAM_REPO/$IMAGE \
138 docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
140 # check if our image is already in the current registry
141 skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
144 fedora:30@container-prep:
146 - .fedora@container-build
147 - .pull_upstream_or_rebuild
152 DISTRIB_FLAVOR: fedora
153 DISTRIB_VERSION: $FEDORA_VERSION
156 fedora:31@container-prep:
158 - .fedora@container-build
159 - .pull_upstream_or_rebuild
164 DISTRIB_FLAVOR: fedora
165 DISTRIB_VERSION: $FEDORA_VERSION
168 ubuntu:19.10@container-prep:
170 - .ubuntu@container-build
171 - .pull_upstream_or_rebuild
175 UBUNTU_VERSION: "19.10"
176 DISTRIB_FLAVOR: ubuntu
177 DISTRIB_VERSION: $UBUNTU_VERSION
180 ubuntu:19.04@container-prep:
182 - .ubuntu@container-build
183 - .pull_upstream_or_rebuild
187 UBUNTU_VERSION: "19.04"
188 DISTRIB_FLAVOR: ubuntu
189 DISTRIB_VERSION: $UBUNTU_VERSION
192 debian:stable@container-prep:
194 - .debian@container-build
195 - .pull_upstream_or_rebuild
199 DEBIAN_VERSION: stable
200 DISTRIB_FLAVOR: debian
201 DISTRIB_VERSION: $DEBIAN_VERSION
204 debian:sid@container-prep:
206 - .debian@container-build
207 - .pull_upstream_or_rebuild
212 DISTRIB_FLAVOR: debian
213 DISTRIB_VERSION: $DEBIAN_VERSION
216 .centos@container-prep:
218 - .centos@container-build
219 - .pull_upstream_or_rebuild
224 DISTRIB_FLAVOR: centos
225 DISTRIB_VERSION: $CENTOS_VERSION
228 centos:7@container-prep:
229 extends: .centos@container-prep
233 centos:8@container-prep:
234 extends: .centos@container-prep
238 arch:rolling@container-prep:
240 - .arch@container-build
241 - .pull_upstream_or_rebuild
245 ARCH_VERSION: rolling
246 DISTRIB_FLAVOR: archlinux
247 DISTRIB_VERSION: $ARCH_VERSION
250 alpine:latest@container-prep:
252 - .alpine@container-build
253 - .pull_upstream_or_rebuild
257 ALPINE_VERSION: latest
258 DISTRIB_FLAVOR: alpine
259 DISTRIB_VERSION: $ALPINE_VERSION
262 #################################################################
264 # container clean stage #
265 # run during the clean stage #
267 #################################################################
270 # This stage will look for the container images we currently have in
271 # the registry and will remove any that are not tagged with the provided
272 # $container_image:$tag
275 stage: container_clean
276 image: $BUILDAH_IMAGE
278 # get the full container image name (CURRENT_CONTAINER_IMAGE still has indirections)
279 - CONTAINER_IMAGE=$(eval echo "$CURRENT_CONTAINER_IMAGE")
280 - GITLAB=$(echo $CI_PROJECT_URL | cut -f3 -d/)
281 - REPOSITORY=$(echo $CONTAINER_IMAGE | cut -f2- -d/ | cut -f1 -d:)
282 - IMAGE_PATH=$(echo $CONTAINER_IMAGE | cut -f1 -d:)
283 - LATEST_TAG=$(echo $CONTAINER_IMAGE | cut -f2 -d:)
285 # log in to the registry (read only)
286 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
288 # get the r/w token from the settings to access the registry
290 # each developer needs to register a secret variable that contains
291 # a personal token with api access. The token
292 # - must be named PERSONAL_TOKEN_$USER (for example PERSONAL_TOKEN_bentiss)
293 # - must be registered in the CI/CD Variables section as type file
294 # - value must be a netrc file as a single-line string:
295 # default login <user> password <token value>
296 # e.g. "default login bentiss password 1235abcde"
297 - tokenname="PERSONAL_TOKEN_$GITLAB_USER_LOGIN"
298 - netrcfile=$(eval echo "\$$tokenname")
299 - if [[ ! -f "$netrcfile" ]]; then
300 echo "No netrc file found or token is missing, skipping job" && false;
303 # request a token for the registry API
304 - REGISTRY_TOKEN=$(curl https://$GITLAB/jwt/auth --get
305 --silent --show-error
307 -d offline_token=true
308 -d service=container_registry
309 -d "scope=repository:$REPOSITORY:pull,*"
311 --netrc-file "$netrcfile"
312 | sed -r 's/(\{"token":"|"\})//g')
314 # get the digest of the latest image
315 - LATEST_MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.Digest')
317 # get the list of tags
318 - TAGS=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.RepoTags[]')
319 # FIXME: is the above command working properly? If not, use below:
320 # - TAGS=$(curl -X GET -H "accept:application/vnd.docker.distribution.manifest.v2+json"
321 # -H "authorization:Bearer $REGISTRY_TOKEN"
322 # https://$CI_REGISTRY/v2/$REPOSITORY/tags/list | jq -r '.tags[]')
324 # iterate over the tags
327 MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$tag | jq -r '.Digest');
328 if test x"$MANIFEST" != x"$LATEST_MANIFEST";
330 echo removing $tag as $MANIFEST;
331 curl https://$CI_REGISTRY/v2/$REPOSITORY/manifests/$MANIFEST --silent
332 -H "accept:application/vnd.docker.distribution.manifest.v2+json"
333 -H "authorization:Bearer $REGISTRY_TOKEN"
334 --fail --show-error -X DELETE || true
342 fedora:30@container-clean:
343 extends: .container-clean
347 CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
349 fedora:31@container-clean:
350 extends: .container-clean
354 CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
356 ubuntu:19.10@container-clean:
357 extends: .container-clean
360 UBUNTU_VERSION: "19.10"
361 CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
363 ubuntu:19.04@container-clean:
364 extends: .container-clean
367 UBUNTU_VERSION: "19.04"
368 CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
370 debian:stable@container-clean:
371 extends: .container-clean
374 DEBIAN_VERSION: stable
375 CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
377 debian:sid@container-clean:
378 extends: .container-clean
382 CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
384 .centos@container-clean:
385 extends: .container-clean
388 CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE
390 centos:7@container-clean:
391 extends: .centos@container-clean
395 centos:8@container-clean:
396 extends: .centos@container-clean
400 arch:rolling@container-clean:
401 extends: .container-clean
404 CURRENT_CONTAINER_IMAGE: $ARCH_CONTAINER_IMAGE
406 alpine:latest@container-clean:
407 extends: .container-clean
410 CURRENT_CONTAINER_IMAGE: $ALPINE_CONTAINER_IMAGE
412 #################################################################
416 #################################################################
424 MAKE_ARGS: "distcheck"
426 .fedora-build@template:
428 extends: .build@template
429 image: $FEDORA_CONTAINER_IMAGE
431 fedora:31@default-build:
433 extends: .fedora-build@template
436 needs: ['fedora:31@container-prep']
438 fedora:30@default-build:
440 extends: .fedora-build@template
443 needs: ['fedora:30@container-prep']
445 .centos-build@template:
447 extends: .build@template
448 image: $CENTOS_CONTAINER_IMAGE
450 centos:7@default-build:
451 extends: .centos-build@template
454 MAKE_ARGS: '' # disable distcheck, requires doxygen
455 needs: ['centos:7@container-prep']
457 centos:8@default-build:
458 extends: .centos-build@template
461 MAKE_ARGS: '' # disable distcheck, requires doxygen
462 needs: ['centos:8@container-prep']
466 extends: .build@template
467 image: $UBUNTU_CONTAINER_IMAGE
469 ubuntu:19.10@default-build:
470 extends: .ubuntu@template
472 UBUNTU_VERSION: "19.10"
473 needs: ['ubuntu:19.10@container-prep']
475 ubuntu:19.04@default-build:
476 extends: .ubuntu@template
478 UBUNTU_VERSION: "19.04"
479 needs: ['ubuntu:19.04@container-prep']
483 extends: .build@template
484 image: $DEBIAN_CONTAINER_IMAGE
486 debian:stable@default-build:
487 extends: .debian@template
489 DEBIAN_VERSION: stable
490 needs: ['debian:stable@container-prep']
492 debian:sid@default-build:
493 extends: .debian@template
496 needs: ['debian:sid@container-prep']
500 extends: .build@template
501 image: $ARCH_CONTAINER_IMAGE
503 arch:rolling@default-build:
504 extends: .arch@template
505 needs: ['arch:rolling@container-prep']
509 extends: .build@template
510 image: $ALPINE_CONTAINER_IMAGE
512 alpine:latest@default-build:
513 extends: .alpine@template
514 needs: ['alpine:latest@container-prep']
516 # Build argument tests
518 # We only run the build option combinations on one image
519 # because they're supposed to fail equally on all
520 .fedora-custom-build@template:
522 extends: .fedora-build@template
525 needs: ['fedora:31@container-prep']
527 fedora:31@no-valgrind:
528 extends: .fedora-custom-build@template
530 - dnf remove -y valgrind
533 extends: .fedora-custom-build@template
535 - dnf remove -y check check-devel
537 fedora:31@no-doxygen:
538 extends: .fedora-custom-build@template
540 - dnf remove -y doxygen
542 MAKE_ARGS: '' # disable distcheck, requires doxygen
544 # doxygen is required for distcheck
545 fedora:31@no-doxygen-check-valgrind:
546 extends: .fedora-custom-build@template
548 - dnf remove -y doxygen valgrind check check-devel
550 MAKE_ARGS: '' # disable distcheck, requires doxygen
553 extends: .fedora-custom-build@template
555 - mv /usr/bin/nm /usr/bin/nm.moved
557 fedora:31@enable-gcov:
558 extends: .fedora-custom-build@template
560 CONFIGURE_FLAGS: "--enable-gcov"