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 - container_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
76 .default_artifacts: &default_artifacts
83 .default_build: &default_build
86 - ./configure --disable-silent-rules $CONFIGURE_FLAGS
89 - if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi
90 <<: *default_artifacts
92 #################################################################
94 # container prep stage #
96 #################################################################
98 .pull_upstream_or_rebuild: &pull_upstream_or_rebuild
100 # log in to the registry
101 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
103 # get the full container image name (DISTRIB_VERSION still has indirections)
104 - IMAGE=$(eval echo "$DISTRIB_FLAVOR/$DISTRIB_VERSION:$TAG")
107 # force rebuild if schedule, reuse otherwise
108 if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ;
110 # pull the latest upstream image if it exists
111 skopeo copy docker://$CI_REGISTRY/$UPSTREAM_REPO/$IMAGE \
112 docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
114 # check if our image is already in the current registry
115 skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
118 fedora:30@container-prep:
119 extends: .fedora@container-build
120 stage: container_prep
124 DISTRIB_FLAVOR: fedora
125 DISTRIB_VERSION: $FEDORA_VERSION
127 <<: *pull_upstream_or_rebuild
129 fedora:31@container-prep:
130 extends: .fedora@container-build
131 stage: container_prep
135 DISTRIB_FLAVOR: fedora
136 DISTRIB_VERSION: $FEDORA_VERSION
138 <<: *pull_upstream_or_rebuild
141 ubuntu:19.10@container-prep:
142 extends: .ubuntu@container-build
143 stage: container_prep
146 UBUNTU_VERSION: "19.10"
147 DISTRIB_FLAVOR: ubuntu
148 DISTRIB_VERSION: $UBUNTU_VERSION
150 <<: *pull_upstream_or_rebuild
152 ubuntu:19.04@container-prep:
153 extends: .ubuntu@container-build
154 stage: container_prep
157 UBUNTU_VERSION: "19.04"
158 DISTRIB_FLAVOR: ubuntu
159 DISTRIB_VERSION: $UBUNTU_VERSION
161 <<: *pull_upstream_or_rebuild
163 debian:stable@container-prep:
164 extends: .debian@container-build
165 stage: container_prep
168 DEBIAN_VERSION: stable
169 DISTRIB_FLAVOR: debian
170 DISTRIB_VERSION: $DEBIAN_VERSION
172 <<: *pull_upstream_or_rebuild
174 debian:sid@container-prep:
175 extends: .debian@container-build
176 stage: container_prep
180 DISTRIB_FLAVOR: debian
181 DISTRIB_VERSION: $DEBIAN_VERSION
183 <<: *pull_upstream_or_rebuild
185 .centos@container-prep:
186 extends: .centos@container-build
187 stage: container_prep
191 DISTRIB_FLAVOR: centos
192 DISTRIB_VERSION: $CENTOS_VERSION
194 <<: *pull_upstream_or_rebuild
196 centos:7@container-prep:
197 extends: .centos@container-prep
201 centos:8@container-prep:
202 extends: .centos@container-prep
206 arch:rolling@container-prep:
207 extends: .arch@container-build
208 stage: container_prep
211 ARCH_VERSION: rolling
212 DISTRIB_FLAVOR: archlinux
213 DISTRIB_VERSION: $ARCH_VERSION
215 <<: *pull_upstream_or_rebuild
217 alpine:latest@container-prep:
218 extends: .alpine@container-build
219 stage: container_prep
222 ALPINE_VERSION: latest
223 DISTRIB_FLAVOR: alpine
224 DISTRIB_VERSION: $ALPINE_VERSION
226 <<: *pull_upstream_or_rebuild
228 #################################################################
230 # container clean stage #
231 # run during the clean stage #
233 #################################################################
236 # This stage will look for the container images we currently have in
237 # the registry and will remove any that are not tagged with the provided
238 # $container_image:$tag
241 stage: container_clean
242 image: $BUILDAH_IMAGE
244 # get the full container image name (CURRENT_CONTAINER_IMAGE still has indirections)
245 - CONTAINER_IMAGE=$(eval echo "$CURRENT_CONTAINER_IMAGE")
246 - GITLAB=$(echo $CI_PROJECT_URL | cut -f3 -d/)
247 - REPOSITORY=$(echo $CONTAINER_IMAGE | cut -f2- -d/ | cut -f1 -d:)
248 - IMAGE_PATH=$(echo $CONTAINER_IMAGE | cut -f1 -d:)
249 - LATEST_TAG=$(echo $CONTAINER_IMAGE | cut -f2 -d:)
251 # log in to the registry (read only)
252 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
254 # get the r/w token from the settings to access the registry
256 # each developer needs to register a secret variable that contains
257 # a personal token with api access. The token
258 # - must be named PERSONAL_TOKEN_$USER (for example PERSONAL_TOKEN_bentiss)
259 # - must be registered in the CI/CD Variables section as type file
260 # - value must be a netrc file as a single-line string:
261 # default login <user> password <token value>
262 # e.g. "default login bentiss password 1235abcde"
263 - tokenname="PERSONAL_TOKEN_$GITLAB_USER_LOGIN"
264 - netrcfile=$(eval echo "\$$tokenname")
265 - if [[ ! -f "$netrcfile" ]]; then
266 echo "No netrc file found or token is missing, skipping job" && false;
269 # request a token for the registry API
270 - REGISTRY_TOKEN=$(curl https://$GITLAB/jwt/auth --get
271 --silent --show-error
273 -d offline_token=true
274 -d service=container_registry
275 -d "scope=repository:$REPOSITORY:pull,*"
277 --netrc-file "$netrcfile"
278 | sed -r 's/(\{"token":"|"\})//g')
280 # get the digest of the latest image
281 - LATEST_MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.Digest')
283 # get the list of tags
284 - TAGS=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.RepoTags[]')
285 # FIXME: is the above command working properly? If not, use below:
286 # - TAGS=$(curl -X GET -H "accept:application/vnd.docker.distribution.manifest.v2+json"
287 # -H "authorization:Bearer $REGISTRY_TOKEN"
288 # https://$CI_REGISTRY/v2/$REPOSITORY/tags/list | jq -r '.tags[]')
290 # iterate over the tags
293 MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$tag | jq -r '.Digest');
294 if test x"$MANIFEST" != x"$LATEST_MANIFEST";
296 echo removing $tag as $MANIFEST;
297 curl https://$CI_REGISTRY/v2/$REPOSITORY/manifests/$MANIFEST --silent
298 -H "accept:application/vnd.docker.distribution.manifest.v2+json"
299 -H "authorization:Bearer $REGISTRY_TOKEN"
300 --fail --show-error -X DELETE || true
308 fedora:30@container-clean:
309 extends: .container-clean
313 CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
315 fedora:31@container-clean:
316 extends: .container-clean
320 CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
322 ubuntu:19.10@container-clean:
323 extends: .container-clean
326 UBUNTU_VERSION: "19.10"
327 CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
329 ubuntu:19.04@container-clean:
330 extends: .container-clean
333 UBUNTU_VERSION: "19.04"
334 CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
336 debian:stable@container-clean:
337 extends: .container-clean
340 DEBIAN_VERSION: stable
341 CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
343 debian:sid@container-clean:
344 extends: .container-clean
348 CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
350 .centos@container-clean:
351 extends: .container-clean
354 CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE
356 centos:7@container-clean:
357 extends: .centos@container-clean
361 centos:8@container-clean:
362 extends: .centos@container-clean
366 arch:rolling@container-clean:
367 extends: .container-clean
370 CURRENT_CONTAINER_IMAGE: $ARCH_CONTAINER_IMAGE
372 alpine:latest@container-clean:
373 extends: .container-clean
376 CURRENT_CONTAINER_IMAGE: $ALPINE_CONTAINER_IMAGE
378 #################################################################
382 #################################################################
386 <<: *default_artifacts
390 MAKE_ARGS: "distcheck"
392 .fedora-build@template:
394 extends: .build@template
395 image: $FEDORA_CONTAINER_IMAGE
397 fedora:31@default-build:
399 extends: .fedora-build@template
402 needs: ['fedora:31@container-prep']
404 fedora:30@default-build:
406 extends: .fedora-build@template
409 needs: ['fedora:30@container-prep']
411 .centos-build@template:
413 extends: .build@template
414 image: $CENTOS_CONTAINER_IMAGE
416 centos:7@default-build:
417 extends: .centos-build@template
420 MAKE_ARGS: '' # disable distcheck, requires doxygen
421 needs: ['centos:7@container-prep']
423 centos:8@default-build:
424 extends: .centos-build@template
427 MAKE_ARGS: '' # disable distcheck, requires doxygen
428 needs: ['centos:8@container-prep']
432 extends: .build@template
433 image: $UBUNTU_CONTAINER_IMAGE
435 ubuntu:19.10@default-build:
436 extends: .ubuntu@template
438 UBUNTU_VERSION: "19.10"
439 needs: ['ubuntu:19.10@container-prep']
441 ubuntu:19.04@default-build:
442 extends: .ubuntu@template
444 UBUNTU_VERSION: "19.04"
445 needs: ['ubuntu:19.04@container-prep']
449 extends: .build@template
450 image: $DEBIAN_CONTAINER_IMAGE
452 debian:stable@default-build:
453 extends: .debian@template
455 DEBIAN_VERSION: stable
456 needs: ['debian:stable@container-prep']
458 debian:sid@default-build:
459 extends: .debian@template
462 needs: ['debian:sid@container-prep']
466 extends: .build@template
467 image: $ARCH_CONTAINER_IMAGE
469 arch:rolling@default-build:
470 extends: .arch@template
471 needs: ['arch:rolling@container-prep']
475 extends: .build@template
476 image: $ALPINE_CONTAINER_IMAGE
478 alpine:latest@default-build:
479 extends: .alpine@template
480 needs: ['alpine:latest@container-prep']
482 # Build argument tests
484 # We only run the build option combinations on one image
485 # because they're supposed to fail equally on all
486 .fedora-custom-build@template:
488 extends: .fedora-build@template
491 needs: ['fedora:31@container-prep']
493 fedora:31@no-valgrind:
494 extends: .fedora-custom-build@template
496 - dnf remove -y valgrind
499 extends: .fedora-custom-build@template
501 - dnf remove -y check check-devel
503 fedora:31@no-doxygen:
504 extends: .fedora-custom-build@template
506 - dnf remove -y doxygen
509 MAKE_ARGS: '' # disable distcheck, requires doxygen
511 # doxygen is required for distcheck
512 fedora:31@no-doxygen-check-valgrind:
513 extends: .fedora-custom-build@template
515 - dnf remove -y doxygen valgrind check check-devel
518 MAKE_ARGS: '' # disable distcheck, requires doxygen
521 extends: .fedora-custom-build@template
523 - mv /usr/bin/nm /usr/bin/nm.moved
525 fedora:31@enable-gcov:
526 extends: .fedora-custom-build@template
527 <<: *default_artifacts
529 CONFIGURE_FLAGS: "--enable-gcov"