1 {# You're looking at the template here, so you can ignore the below
2 warning. This is the right file to edit #}
3 ########################################
5 # THIS FILE IS GENERATED, DO NOT EDIT #
7 ########################################
9 .templates_sha: &template_sha 8410d3382c4ba5e83da76a027cb332169f2a95ad # see https://docs.gitlab.com/ee/ci/yaml/#includefile
12 {% for distribution in distributions|map(attribute='name')|unique()|sort() %}
13 # {{ distribution.capitalize() }} container builder template
14 - project: 'wayland/ci-templates'
16 file: '/templates/{{distribution}}.yml'
20 - prep # rebuild the container images if there is a change
21 - build # for actually building and testing things in a container
22 - VM # for running the test suite in a VM
23 - autotools # distribution builds with autotools
24 - meson # distribution builds with meson
25 - tarballs # tarball builds
26 - container_clean # clean up unused container images
29 ###############################################################################
30 # This is the list of packages required to build libevdev with the default #
33 # Run dnf install/apt-get install/.. with the list of packages for your #
35 ###############################################################################
36 FEDORA_RPMS: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
37 CENTOS_RPMS: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz'
38 UBUNTU_DEBS: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
39 DEBIAN_DEBS: $UBUNTU_DEBS
40 ARCH_PKGS: 'git gcc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen'
41 ALPINE_PKGS: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers'
42 ############################ end of package lists #############################
43 # these tags should be updated each time the list of packages is updated
44 # changing these will force rebuilding the associated image
45 # Note: these tags have no meaning and are not tied to a particular
47 FEDORA_TAG: '2020-02-26.4'
48 CENTOS_TAG: '2020-02-26.4'
49 DEBIAN_TAG: '2020-02-26.4'
50 UBUNTU_TAG: '2020-02-26.4'
51 ARCH_TAG: '2020-02-26.4'
52 ALPINE_TAG: '2020-02-26.4'
53 QEMU_TAG: 'qemu-2020-02-26.4'
55 UPSTREAM_REPO: libevdev/libevdev
56 BUILDAH_IMAGE: $CI_REGISTRY/wayland/ci-templates/buildah:latest
57 FEDORA_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$FEDORA_TAG
58 CENTOS_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/centos/$CENTOS_VERSION:$CENTOS_TAG
59 UBUNTU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/ubuntu/$UBUNTU_VERSION:$UBUNTU_TAG
60 DEBIAN_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:$DEBIAN_TAG
61 ARCH_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/arch/rolling:$ARCH_TAG
62 ALPINE_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/alpine/latest:$ALPINE_TAG
63 QEMU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$QEMU_TAG
65 LIBEVDEV_SKIP_ROOT_TESTS: 1
67 MESON_BUILDDIR: 'build dir'
72 - _build/test/test-suite.log
73 - $MESON_BUILDDIR/meson-logs/
77 junit: $MESON_BUILDDIR/junit-*.xml
84 - pushd _build > /dev/null
85 - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
88 - if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi
95 - .gitlab-ci/meson-build.sh
97 #################################################################
101 #################################################################
103 # Re-generate the CI script and make sure it's the one currently checked in
104 # If this job fails, re-generate the gitlab-ci.yml script, see
105 # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
111 - apk add python3 git
112 - pip3 install --user jinja2 PyYAML
114 - python3 ./.gitlab-ci/generate-gitlab-ci.py
115 - git diff --exit-code && exit 0 || true
116 - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
123 - apk add python3 git
125 - pip3 install GitPython
126 - pip3 install pytest
128 pytest --junitxml=results.xml \
131 ./.gitlab-ci/check-commit.py
133 - master@libevdev/libevdev
143 .pull_upstream_or_rebuild:
145 # log in to the registry
146 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
148 # get the full container image name (DISTRIB_VERSION still has indirections)
149 - IMAGE=$(eval echo "$DISTRIB_NAME/$DISTRIB_VERSION:$TAG")
152 # force rebuild if schedule, reuse otherwise
153 if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ;
155 # pull the latest upstream image if it exists
156 skopeo copy docker://$CI_REGISTRY/$UPSTREAM_REPO/$IMAGE \
157 docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
159 # check if our image is already in the current registry
160 skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
166 - .pull_upstream_or_rebuild
173 FEDORA_TAG: $QEMU_TAG
175 DISTRIB_VERSION: $FEDORA_VERSION
179 {% for distro in distributions %}
181 ### {{ distro.name }} {{ distro.version }}
182 {{ distro.name }}:{{ distro.version }}@container-prep:
184 - .{{ distro.name }}@container-build
185 - .pull_upstream_or_rebuild
189 {{ distro.name.upper() }}_VERSION: '{{ distro.version }}'
190 DISTRIB_NAME: {{ distro.name }}
191 DISTRIB_VERSION: ${{ distro.name.upper() }}_VERSION
192 TAG: ${{ distro.name.upper() }}_TAG
196 #################################################################
198 # container clean stage #
199 # run during the clean stage #
201 #################################################################
204 # This stage will look for the container images we currently have in
205 # the registry and will remove any that are not tagged with the provided
206 # $container_image:$tag
209 stage: container_clean
210 image: $BUILDAH_IMAGE
212 # get the full container image name (CURRENT_CONTAINER_IMAGE still has indirections)
213 - CONTAINER_IMAGE=$(eval echo "$CURRENT_CONTAINER_IMAGE")
214 - GITLAB=$(echo $CI_PROJECT_URL | cut -f3 -d/)
215 - REPOSITORY=$(echo $CONTAINER_IMAGE | cut -f2- -d/ | cut -f1 -d:)
216 - IMAGE_PATH=$(echo $CONTAINER_IMAGE | cut -f1 -d:)
217 - LATEST_TAG=$(echo $CONTAINER_IMAGE | cut -f2 -d:)
219 # log in to the registry (read only)
220 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
222 # get the r/w token from the settings to access the registry
224 # each developer needs to register a secret variable that contains
225 # a personal token with api access. The token
226 # - must be named PERSONAL_TOKEN_$USER (for example PERSONAL_TOKEN_bentiss)
227 # - must be registered in the CI/CD Variables section as type file
228 # - value must be a netrc file as a single-line string:
229 # default login <user> password <token value>
230 # e.g. "default login bentiss password 1235abcde"
231 - tokenname="PERSONAL_TOKEN_$GITLAB_USER_LOGIN"
232 - netrcfile=$(eval echo "\$$tokenname")
233 - if [[ ! -f "$netrcfile" ]]; then
234 echo "No netrc file found or token is missing, skipping job" && false;
237 # request a token for the registry API
238 - REGISTRY_TOKEN=$(curl https://$GITLAB/jwt/auth --get
239 --silent --show-error
241 -d offline_token=true
242 -d service=container_registry
243 -d "scope=repository:$REPOSITORY:pull,*"
245 --netrc-file "$netrcfile"
246 | sed -r 's/(\{"token":"|"\})//g')
248 # get the digest of the latest image
249 - LATEST_MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.Digest')
251 # get the list of tags
252 - TAGS=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.RepoTags[]')
253 # FIXME: is the above command working properly? If not, use below:
254 # - TAGS=$(curl -X GET -H "accept:application/vnd.docker.distribution.manifest.v2+json"
255 # -H "authorization:Bearer $REGISTRY_TOKEN"
256 # https://$CI_REGISTRY/v2/$REPOSITORY/tags/list | jq -r '.tags[]')
258 # iterate over the tags
261 MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$tag | jq -r '.Digest');
262 if test x"$MANIFEST" != x"$LATEST_MANIFEST";
264 echo removing $tag as $MANIFEST;
265 curl https://$CI_REGISTRY/v2/$REPOSITORY/manifests/$MANIFEST --silent
266 -H "accept:application/vnd.docker.distribution.manifest.v2+json"
267 -H "authorization:Bearer $REGISTRY_TOKEN"
268 --fail --show-error -X DELETE || true
278 {% for distro in distributions %}
280 ### {{ distro.name }} {{ distro.version }}
281 {{ distro.name }}:{{ distro.version }}@container-clean:
282 extends: .container-clean
284 {{ distro.name.upper() }}_VERSION: '{{ distro.version }}'
285 CURRENT_CONTAINER_IMAGE: ${{ distro.name.upper() }}_CONTAINER_IMAGE
289 #################################################################
293 #################################################################
295 .autotools-build@template:
301 MAKE_ARGS: "distcheck"
303 .meson-build@template:
311 {% for distro in distributions %}
313 {{ distro.name }}:{{ distro.version }}@autotools-build:
314 extends: .autotools-build@template
316 image: ${{ distro.name.upper() }}_CONTAINER_IMAGE
318 {{ distro.name.upper() }}_VERSION: '{{ distro.version }}'
319 {# Where we have extra_variables defined, add them to the list #}
320 {% if distro.build is defined and distro.build.extra_variables is defined %}
321 {% for key, value in distro.build.extra_variables.items() %}
322 {{ key }}: {{ value }}
325 needs: ['{{ distro.name }}:{{ distro.version }}@container-prep']
327 {% if not distro.build is defined or distro.build.meson|default(True) %}
328 {{ distro.name }}:{{ distro.version }}@meson-build:
329 extends: .meson-build@template
331 image: ${{ distro.name.upper() }}_CONTAINER_IMAGE
333 {{ distro.name.upper() }}_VERSION: '{{ distro.version }}'
334 {# Where we have extra_variables defined, add them to the list #}
335 {% if distro.build is defined and distro.build.extra_variables is defined %}
336 {% for key, value in distro.build.extra_variables.items() %}
337 {{ key }}: {{ value }}
340 needs: ['{{ distro.name }}:{{ distro.version }}@container-prep']
345 # Build argument tests
347 # We only run the build option combinations on one image
348 # because they're supposed to fail equally on all
349 .fedora-custom-build@autotools-template:
350 extends: .autotools-build@template
352 image: $FEDORA_CONTAINER_IMAGE
355 needs: ['fedora:31@container-prep']
357 no-valgrind:autotools:
358 extends: .fedora-custom-build@autotools-template
360 - dnf remove -y valgrind
363 extends: .fedora-custom-build@autotools-template
365 - dnf remove -y check check-devel
367 no-doxygen:autotools:
368 extends: .fedora-custom-build@autotools-template
370 - dnf remove -y doxygen
372 MAKE_ARGS: '' # disable distcheck, requires doxygen
374 # doxygen is required for distcheck
375 no-doxygen-check-valgrind:autotools:
376 extends: .fedora-custom-build@autotools-template
378 - dnf remove -y doxygen valgrind check check-devel
380 MAKE_ARGS: '' # disable distcheck, requires doxygen
383 extends: .fedora-custom-build@autotools-template
385 - mv /usr/bin/nm /usr/bin/nm.moved
387 enable-gcov:autotools:
388 extends: .fedora-custom-build@autotools-template
390 CONFIGURE_FLAGS: "--enable-gcov"
392 .fedora-custom-build@meson-template:
393 extends: .meson-build@template
395 image: $FEDORA_CONTAINER_IMAGE
398 needs: ['fedora:31@container-prep']
401 extends: .fedora-custom-build@meson-template
403 - dnf remove -y valgrind
406 extends: .fedora-custom-build@meson-template
408 - dnf remove -y check check-devel
410 MESON_ARGS: -Dtests=disabled
413 # doxygen is required for dist
415 extends: .fedora-custom-build@meson-template
417 - dnf remove -y doxygen
419 MESON_ARGS: -Ddocumentation=disabled
422 # doxygen is required for dist
423 no-doxygen-check-valgrind:meson:
424 extends: .fedora-custom-build@meson-template
426 - dnf remove -y doxygen valgrind check check-devel
428 MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled
433 extends: .fedora-custom-build@meson-template
435 MESON_ARGS: '-Dcoverity=true'
438 extends: .fedora-custom-build@meson-template
440 NINJA_ARGS: 'scan-build'
445 image: $FEDORA_CONTAINER_IMAGE
447 - ./autogen.sh --prefix=$PWD/prefix-autotools/
449 - ls -l $PWD/prefix-autotools/lib/libevdev.so.2.3.0
450 - meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/
451 - ninja -C "$MESON_BUILDDIR" install
452 - ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0
455 needs: ['fedora:31@container-prep']
457 #################################################################
461 #################################################################
463 .check_tainted: &check_tainted |
464 # make sure the kernel is not tainted
465 if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
467 echo tainted kernel ;
473 image: $QEMU_CONTAINER_IMAGE
478 MESON_BUILDDIR: build_dir
480 # start our vm, no args required
485 - "scp -P 5555 -r $PWD localhost:"
486 - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
487 - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
488 - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
489 - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS\"" >> sshenv
490 - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
491 - "scp -P 5555 sshenv localhost:~/$CI_PROJECT_NAME/.meson_environment"
492 - ssh localhost -p 5555 "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
493 # no matter the results of the tests, we want to fetch the logs
494 - scp -P 5555 -r localhost:$CI_PROJECT_NAME/"$MESON_BUILDDIR" .
498 - ssh localhost -p 5555 halt || true
502 - if [[ ! -e .success ]] ;
507 name: "qemu-meson-logs-$CI_JOB_NAME"
511 - $MESON_BUILDDIR/meson-logs
514 junit: $MESON_BUILDDIR/junit-*.xml
519 needs: ['fedora:31@qemu-prep']
522 extends: .qemu@fedora:31
525 extends: .qemu@fedora:31
527 MESON_TEST_ARGS: '--setup=valgrind'
531 image: $FEDORA_CONTAINER_IMAGE
533 - export INSTALLDIR="$PWD/_inst"
535 - pushd _build > /dev/null
536 - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
540 - mkdir -p _tarball_dir
541 - tar xf _build/libevdev-*.tar.xz -C _tarball_dir
542 - pushd _tarball_dir/libevdev-*/ > /dev/null
543 - meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR"
544 - ninja -C "$MESON_BUILDDIR" test
545 - ninja -C "$MESON_BUILDDIR" install
550 needs: ['fedora:31@container-prep']
552 autotools-from-tarball:
554 image: $FEDORA_CONTAINER_IMAGE
556 - export INSTALLDIR="$PWD/_inst"
557 - meson "$MESON_BUILDDIR"
558 - ninja -C "$MESON_BUILDDIR" dist
559 - mkdir -p _tarball_dir
560 - tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir
561 - pushd _tarball_dir/libevdev-*/ > /dev/null
563 - pushd _build > /dev/null
564 - ../autogen.sh --disable-silent-rules --prefix="$INSTALLDIR" $CONFIGURE_FLAGS
573 needs: ['fedora:31@container-prep']