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
144 .pull_upstream_or_rebuild:
146 # log in to the registry
147 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
149 # get the full container image name (DISTRIB_VERSION still has indirections)
150 - IMAGE=$(eval echo "$DISTRIB_NAME/$DISTRIB_VERSION:$TAG")
153 # force rebuild if schedule, reuse otherwise
154 if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ;
156 # pull the latest upstream image if it exists
157 skopeo copy docker://$CI_REGISTRY/$UPSTREAM_REPO/$IMAGE \
158 docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
160 # check if our image is already in the current registry
161 skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
167 - .pull_upstream_or_rebuild
174 FEDORA_TAG: $QEMU_TAG
176 DISTRIB_VERSION: $FEDORA_VERSION
180 {% for distro in distributions %}
182 ### {{ distro.name }} {{ distro.version }}
183 {{ distro.name }}:{{ distro.version }}@container-prep:
185 - .{{ distro.name }}@container-build
186 - .pull_upstream_or_rebuild
190 {{ distro.name.upper() }}_VERSION: '{{ distro.version }}'
191 DISTRIB_NAME: {{ distro.name }}
192 DISTRIB_VERSION: ${{ distro.name.upper() }}_VERSION
193 TAG: ${{ distro.name.upper() }}_TAG
197 #################################################################
199 # container clean stage #
200 # run during the clean stage #
202 #################################################################
205 # This stage will look for the container images we currently have in
206 # the registry and will remove any that are not tagged with the provided
207 # $container_image:$tag
210 stage: container_clean
211 image: $BUILDAH_IMAGE
213 # get the full container image name (CURRENT_CONTAINER_IMAGE still has indirections)
214 - CONTAINER_IMAGE=$(eval echo "$CURRENT_CONTAINER_IMAGE")
215 - GITLAB=$(echo $CI_PROJECT_URL | cut -f3 -d/)
216 - REPOSITORY=$(echo $CONTAINER_IMAGE | cut -f2- -d/ | cut -f1 -d:)
217 - IMAGE_PATH=$(echo $CONTAINER_IMAGE | cut -f1 -d:)
218 - LATEST_TAG=$(echo $CONTAINER_IMAGE | cut -f2 -d:)
220 # log in to the registry (read only)
221 - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
223 # get the r/w token from the settings to access the registry
225 # each developer needs to register a secret variable that contains
226 # a personal token with api access. The token
227 # - must be named PERSONAL_TOKEN_$USER (for example PERSONAL_TOKEN_bentiss)
228 # - must be registered in the CI/CD Variables section as type file
229 # - value must be a netrc file as a single-line string:
230 # default login <user> password <token value>
231 # e.g. "default login bentiss password 1235abcde"
232 - tokenname="PERSONAL_TOKEN_$GITLAB_USER_LOGIN"
233 - netrcfile=$(eval echo "\$$tokenname")
234 - if [[ ! -f "$netrcfile" ]]; then
235 echo "No netrc file found or token is missing, skipping job" && false;
238 # request a token for the registry API
239 - REGISTRY_TOKEN=$(curl https://$GITLAB/jwt/auth --get
240 --silent --show-error
242 -d offline_token=true
243 -d service=container_registry
244 -d "scope=repository:$REPOSITORY:pull,*"
246 --netrc-file "$netrcfile"
247 | sed -r 's/(\{"token":"|"\})//g')
249 # get the digest of the latest image
250 - LATEST_MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.Digest')
252 # get the list of tags
253 - TAGS=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.RepoTags[]')
254 # FIXME: is the above command working properly? If not, use below:
255 # - TAGS=$(curl -X GET -H "accept:application/vnd.docker.distribution.manifest.v2+json"
256 # -H "authorization:Bearer $REGISTRY_TOKEN"
257 # https://$CI_REGISTRY/v2/$REPOSITORY/tags/list | jq -r '.tags[]')
259 # iterate over the tags
262 MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$tag | jq -r '.Digest');
263 if test x"$MANIFEST" != x"$LATEST_MANIFEST";
265 echo removing $tag as $MANIFEST;
266 curl https://$CI_REGISTRY/v2/$REPOSITORY/manifests/$MANIFEST --silent
267 -H "accept:application/vnd.docker.distribution.manifest.v2+json"
268 -H "authorization:Bearer $REGISTRY_TOKEN"
269 --fail --show-error -X DELETE || true
279 {% for distro in distributions %}
281 ### {{ distro.name }} {{ distro.version }}
282 {{ distro.name }}:{{ distro.version }}@container-clean:
283 extends: .container-clean
285 {{ distro.name.upper() }}_VERSION: '{{ distro.version }}'
286 CURRENT_CONTAINER_IMAGE: ${{ distro.name.upper() }}_CONTAINER_IMAGE
290 #################################################################
294 #################################################################
296 .autotools-build@template:
302 MAKE_ARGS: "distcheck"
304 .meson-build@template:
312 {% for distro in distributions %}
314 {{ distro.name }}:{{ distro.version }}@autotools-build:
315 extends: .autotools-build@template
317 image: ${{ distro.name.upper() }}_CONTAINER_IMAGE
319 {{ distro.name.upper() }}_VERSION: '{{ distro.version }}'
320 {# Where we have extra_variables defined, add them to the list #}
321 {% if distro.build is defined and distro.build.extra_variables is defined %}
322 {% for key, value in distro.build.extra_variables.items() %}
323 {{ key }}: {{ value }}
326 needs: ['{{ distro.name }}:{{ distro.version }}@container-prep']
328 {% if not distro.build is defined or distro.build.meson|default(True) %}
329 {{ distro.name }}:{{ distro.version }}@meson-build:
330 extends: .meson-build@template
332 image: ${{ distro.name.upper() }}_CONTAINER_IMAGE
334 {{ distro.name.upper() }}_VERSION: '{{ distro.version }}'
335 {# Where we have extra_variables defined, add them to the list #}
336 {% if distro.build is defined and distro.build.extra_variables is defined %}
337 {% for key, value in distro.build.extra_variables.items() %}
338 {{ key }}: {{ value }}
341 needs: ['{{ distro.name }}:{{ distro.version }}@container-prep']
346 # Build argument tests
348 # We only run the build option combinations on one image
349 # because they're supposed to fail equally on all
350 .fedora-custom-build@autotools-template:
351 extends: .autotools-build@template
353 image: $FEDORA_CONTAINER_IMAGE
356 needs: ['fedora:31@container-prep']
358 no-valgrind:autotools:
359 extends: .fedora-custom-build@autotools-template
361 - dnf remove -y valgrind
364 extends: .fedora-custom-build@autotools-template
366 - dnf remove -y check check-devel
368 no-doxygen:autotools:
369 extends: .fedora-custom-build@autotools-template
371 - dnf remove -y doxygen
373 MAKE_ARGS: '' # disable distcheck, requires doxygen
375 # doxygen is required for distcheck
376 no-doxygen-check-valgrind:autotools:
377 extends: .fedora-custom-build@autotools-template
379 - dnf remove -y doxygen valgrind check check-devel
381 MAKE_ARGS: '' # disable distcheck, requires doxygen
384 extends: .fedora-custom-build@autotools-template
386 - mv /usr/bin/nm /usr/bin/nm.moved
388 enable-gcov:autotools:
389 extends: .fedora-custom-build@autotools-template
391 CONFIGURE_FLAGS: "--enable-gcov"
393 .fedora-custom-build@meson-template:
394 extends: .meson-build@template
396 image: $FEDORA_CONTAINER_IMAGE
399 needs: ['fedora:31@container-prep']
402 extends: .fedora-custom-build@meson-template
404 - dnf remove -y valgrind
407 extends: .fedora-custom-build@meson-template
409 - dnf remove -y check check-devel
411 MESON_ARGS: -Dtests=disabled
414 # doxygen is required for dist
416 extends: .fedora-custom-build@meson-template
418 - dnf remove -y doxygen
420 MESON_ARGS: -Ddocumentation=disabled
423 # doxygen is required for dist
424 no-doxygen-check-valgrind:meson:
425 extends: .fedora-custom-build@meson-template
427 - dnf remove -y doxygen valgrind check check-devel
429 MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled
434 extends: .fedora-custom-build@meson-template
436 MESON_ARGS: '-Dcoverity=true'
439 extends: .fedora-custom-build@meson-template
441 NINJA_ARGS: 'scan-build'
446 image: $FEDORA_CONTAINER_IMAGE
448 - ./autogen.sh --prefix=$PWD/prefix-autotools/
450 - ls -l $PWD/prefix-autotools/lib/libevdev.so.2.3.0
451 - meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/
452 - ninja -C "$MESON_BUILDDIR" install
453 - ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0
456 needs: ['fedora:31@container-prep']
458 #################################################################
462 #################################################################
464 .check_tainted: &check_tainted |
465 # make sure the kernel is not tainted
466 if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
468 echo tainted kernel ;
474 image: $QEMU_CONTAINER_IMAGE
479 MESON_BUILDDIR: build_dir
481 # start our vm, no args required
486 - "scp -P 5555 -r $PWD localhost:"
487 - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
488 - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
489 - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
490 - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS\"" >> sshenv
491 - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
492 - "scp -P 5555 sshenv localhost:~/$CI_PROJECT_NAME/.meson_environment"
493 - ssh localhost -p 5555 "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
494 # no matter the results of the tests, we want to fetch the logs
495 - scp -P 5555 -r localhost:$CI_PROJECT_NAME/"$MESON_BUILDDIR" .
499 - ssh localhost -p 5555 halt || true
503 - if [[ ! -e .success ]] ;
508 name: "qemu-meson-logs-$CI_JOB_NAME"
512 - $MESON_BUILDDIR/meson-logs
515 junit: $MESON_BUILDDIR/junit-*.xml
520 needs: ['fedora:31@qemu-prep']
523 extends: .qemu@fedora:31
526 extends: .qemu@fedora:31
528 MESON_TEST_ARGS: '--setup=valgrind'
532 image: $FEDORA_CONTAINER_IMAGE
534 - export INSTALLDIR="$PWD/_inst"
536 - pushd _build > /dev/null
537 - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
541 - mkdir -p _tarball_dir
542 - tar xf _build/libevdev-*.tar.xz -C _tarball_dir
543 - pushd _tarball_dir/libevdev-*/ > /dev/null
544 - meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR"
545 - ninja -C "$MESON_BUILDDIR" test
546 - ninja -C "$MESON_BUILDDIR" install
551 needs: ['fedora:31@container-prep']
553 autotools-from-tarball:
555 image: $FEDORA_CONTAINER_IMAGE
557 - export INSTALLDIR="$PWD/_inst"
558 - meson "$MESON_BUILDDIR"
559 - ninja -C "$MESON_BUILDDIR" dist
560 - mkdir -p _tarball_dir
561 - tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir
562 - pushd _tarball_dir/libevdev-*/ > /dev/null
564 - pushd _build > /dev/null
565 - ../autogen.sh --disable-silent-rules --prefix="$INSTALLDIR" $CONFIGURE_FLAGS
574 needs: ['fedora:31@container-prep']