gitlab CI: update to the distribution-independent CI-templates
[platform/upstream/libevdev.git] / .gitlab-ci.yml
1 ########################################
2 #                                      #
3 # THIS FILE IS GENERATED, DO NOT EDIT  #
4 #                                      #
5 ########################################
6
7 .templates_sha: &template_sha df52af2195b052325daf5d715c88be90f8ec7d86 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
8
9 include:
10   # Alpine container builder template
11   - project: 'wayland/ci-templates'
12     ref: *template_sha
13     file: '/templates/alpine.yml'
14   # Arch container builder template
15   - project: 'wayland/ci-templates'
16     ref: *template_sha
17     file: '/templates/arch.yml'
18   # Centos container builder template
19   - project: 'wayland/ci-templates'
20     ref: *template_sha
21     file: '/templates/centos.yml'
22   # Debian container builder template
23   - project: 'wayland/ci-templates'
24     ref: *template_sha
25     file: '/templates/debian.yml'
26   # Fedora container builder template
27   - project: 'wayland/ci-templates'
28     ref: *template_sha
29     file: '/templates/fedora.yml'
30   # Ubuntu container builder template
31   - project: 'wayland/ci-templates'
32     ref: *template_sha
33     file: '/templates/ubuntu.yml'
34
35 stages:
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
43
44 variables:
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
50   GIT_DEPTH: 1
51   MESON_BUILDDIR: 'build dir'
52
53 .default_artifacts:
54   artifacts:
55     paths:
56       - _build/test/test-suite.log
57       - $MESON_BUILDDIR/meson-logs/
58     expire_in: 1 week
59     when: on_failure
60     reports:
61       junit: $MESON_BUILDDIR/junit-*.xml
62
63 .autotools_build:
64   extends:
65     - .default_artifacts
66   script:
67     - mkdir _build
68     - pushd _build > /dev/null
69     - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
70     - make
71     - make check
72     - if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi
73     - popd > /dev/null
74
75 .meson_build:
76   extends:
77     - .default_artifacts
78   script:
79     - .gitlab-ci/meson-build.sh
80
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
84 .distribution_image:
85   image: $CI_REGISTRY_IMAGE/$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
86   variables:
87     DISTRO_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
88
89 .fedora:30:
90   extends: .distribution_image
91   variables:
92     DISTRIB_NAME: 'fedora'
93     FDO_DISTRIBUTION_TAG: '2020-03-06.0'
94     FDO_DISTRIBUTION_VERSION: '30'
95
96 .fedora:31:
97   extends: .distribution_image
98   variables:
99     DISTRIB_NAME: 'fedora'
100     FDO_DISTRIBUTION_TAG: '2020-03-06.0'
101     FDO_DISTRIBUTION_VERSION: '31'
102
103 .ubuntu:19.10:
104   extends: .distribution_image
105   variables:
106     DISTRIB_NAME: 'ubuntu'
107     FDO_DISTRIBUTION_TAG: '2020-03-06.0'
108     FDO_DISTRIBUTION_VERSION: '19.10'
109
110 .ubuntu:19.04:
111   extends: .distribution_image
112   variables:
113     DISTRIB_NAME: 'ubuntu'
114     FDO_DISTRIBUTION_TAG: '2020-03-06.0'
115     FDO_DISTRIBUTION_VERSION: '19.04'
116
117 .debian:stable:
118   extends: .distribution_image
119   variables:
120     DISTRIB_NAME: 'debian'
121     FDO_DISTRIBUTION_TAG: '2020-03-06.0'
122     FDO_DISTRIBUTION_VERSION: 'stable'
123
124 .debian:sid:
125   extends: .distribution_image
126   variables:
127     DISTRIB_NAME: 'debian'
128     FDO_DISTRIBUTION_TAG: '2020-03-06.0'
129     FDO_DISTRIBUTION_VERSION: 'sid'
130
131 .centos:7:
132   extends: .distribution_image
133   variables:
134     DISTRIB_NAME: 'centos'
135     FDO_DISTRIBUTION_TAG: '2020-03-06.0'
136     FDO_DISTRIBUTION_VERSION: '7'
137
138 .centos:8:
139   extends: .distribution_image
140   variables:
141     DISTRIB_NAME: 'centos'
142     FDO_DISTRIBUTION_TAG: '2020-03-06.0'
143     FDO_DISTRIBUTION_VERSION: '8'
144
145 .arch:rolling:
146   extends: .distribution_image
147   variables:
148     DISTRIB_NAME: 'arch'
149     FDO_DISTRIBUTION_TAG: '2020-03-06.0'
150     FDO_DISTRIBUTION_VERSION: 'rolling'
151
152 .alpine:latest:
153   extends: .distribution_image
154   variables:
155     DISTRIB_NAME: 'alpine'
156     FDO_DISTRIBUTION_TAG: '2020-03-06.0'
157     FDO_DISTRIBUTION_VERSION: 'latest'
158
159
160
161 #################################################################
162 #                                                               #
163 #                          prep stage                           #
164 #                                                               #
165 #################################################################
166
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
170 #
171 check-ci-script:
172   image: golang:alpine
173   stage: prep
174   before_script:
175     - apk add python3 git
176     - pip3 install --user jinja2 PyYAML
177   script:
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"
181     - exit 1
182
183 check-commit:
184   image: golang:alpine
185   stage: prep
186   before_script:
187     - apk add python3 git
188   script:
189     - pip3 install GitPython
190     - pip3 install pytest
191     - |
192       pytest --junitxml=results.xml \
193              --tb=line \
194              --assert=plain \
195              ./.gitlab-ci/check-commit.py
196   except:
197     - master@libevdev/libevdev
198   variables:
199     GIT_DEPTH: 100
200   artifacts:
201     expire_in: 1 week
202     when: on_failure
203     paths:
204       - results.xml
205     reports:
206       junit: results.xml
207
208 .pull_upstream_or_rebuild:
209   before_script:
210     # log in to the registry
211     - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
212
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")
215
216     - |
217       # force rebuild if schedule, reuse otherwise
218       if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ;
219       then
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 ;
223
224         # check if our image is already in the current registry
225         skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
226       fi
227
228 .fedora:30@qemu-prep:
229   extends:
230     - .fedora:30
231     - .fdo.qemu-build@fedora
232     - .pull_upstream_or_rebuild
233   stage: prep
234   tags:
235     - kvm
236   variables:
237     GIT_STRATEGY: none
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'
240   allow_failure: true
241
242 .fedora:31@qemu-prep:
243   extends:
244     - .fedora:31
245     - .fdo.qemu-build@fedora
246     - .pull_upstream_or_rebuild
247   stage: prep
248   tags:
249     - kvm
250   variables:
251     GIT_STRATEGY: none
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'
254   allow_failure: true
255
256
257 fedora:31@qemu-prep:
258   extends: .fedora:31@qemu-prep
259
260
261 ### fedora 30
262 fedora:30@container-prep:
263   extends:
264     - .fedora:30
265     - .fdo.container-build@fedora
266     - .pull_upstream_or_rebuild
267   stage: prep
268   variables:
269     GIT_STRATEGY: none
270     FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
271
272
273 ### fedora 31
274 fedora:31@container-prep:
275   extends:
276     - .fedora:31
277     - .fdo.container-build@fedora
278     - .pull_upstream_or_rebuild
279   stage: prep
280   variables:
281     GIT_STRATEGY: none
282     FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils doxygen xz clang-analyzer'
283
284
285 ### ubuntu 19.10
286 ubuntu:19.10@container-prep:
287   extends:
288     - .ubuntu:19.10
289     - .fdo.container-build@ubuntu
290     - .pull_upstream_or_rebuild
291   stage: prep
292   variables:
293     GIT_STRATEGY: none
294     FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
295
296
297 ### ubuntu 19.04
298 ubuntu:19.04@container-prep:
299   extends:
300     - .ubuntu:19.04
301     - .fdo.container-build@ubuntu
302     - .pull_upstream_or_rebuild
303   stage: prep
304   variables:
305     GIT_STRATEGY: none
306     FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
307
308
309 ### debian stable
310 debian:stable@container-prep:
311   extends:
312     - .debian:stable
313     - .fdo.container-build@debian
314     - .pull_upstream_or_rebuild
315   stage: prep
316   variables:
317     GIT_STRATEGY: none
318     FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
319
320
321 ### debian sid
322 debian:sid@container-prep:
323   extends:
324     - .debian:sid
325     - .fdo.container-build@debian
326     - .pull_upstream_or_rebuild
327   stage: prep
328   variables:
329     GIT_STRATEGY: none
330     FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkg-config python3 check valgrind binutils doxygen xz-utils'
331
332
333 ### centos 7
334 centos:7@container-prep:
335   extends:
336     - .centos:7
337     - .fdo.container-build@centos
338     - .pull_upstream_or_rebuild
339   stage: prep
340   variables:
341     GIT_STRATEGY: none
342     FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz'
343
344
345 ### centos 8
346 centos:8@container-prep:
347   extends:
348     - .centos:8
349     - .fdo.container-build@centos
350     - .pull_upstream_or_rebuild
351   stage: prep
352   variables:
353     GIT_STRATEGY: none
354     FDO_DISTRIBUTION_PACKAGES: 'git gcc gcc-c++ automake autoconf libtool make pkgconfig python3 check-devel valgrind binutils xz'
355
356
357 ### arch rolling
358 arch:rolling@container-prep:
359   extends:
360     - .arch:rolling
361     - .fdo.container-build@arch
362     - .pull_upstream_or_rebuild
363   stage: prep
364   variables:
365     GIT_STRATEGY: none
366     FDO_DISTRIBUTION_PACKAGES: 'git gcc meson automake autoconf libtool make pkgconfig python3 check valgrind binutils doxygen'
367
368
369 ### alpine latest
370 alpine:latest@container-prep:
371   extends:
372     - .alpine:latest
373     - .fdo.container-build@alpine
374     - .pull_upstream_or_rebuild
375   stage: prep
376   variables:
377     GIT_STRATEGY: none
378     FDO_DISTRIBUTION_PACKAGES: 'git gcc g++ meson automake autoconf libtool make pkgconfig python3 check-dev valgrind binutils doxygen xz linux-headers'
379
380
381 #################################################################
382 #                                                               #
383 #                   container clean stage                       #
384 #                 run during the clean stage                    #
385 #                                                               #
386 #################################################################
387
388 #
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
392 #
393 .container-clean:
394   stage: container_clean
395   image: $BUILDAH_IMAGE
396   script:
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:)
402
403     # log in to the registry (read only)
404     - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
405
406     # get the r/w token from the settings to access the registry
407     #
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;
419       fi
420
421     # request a token for the registry API
422     - REGISTRY_TOKEN=$(curl https://$GITLAB/jwt/auth --get
423                              --silent --show-error
424                              -d client_id=docker
425                              -d offline_token=true
426                              -d service=container_registry
427                              -d "scope=repository:$REPOSITORY:pull,*"
428                              --fail
429                              --netrc-file "$netrcfile"
430                              | sed -r 's/(\{"token":"|"\})//g')
431
432     # get the digest of the latest image
433     - LATEST_MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.Digest')
434
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[]')
441
442     # iterate over the tags
443     - for tag in $TAGS;
444       do
445         MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$tag | jq -r '.Digest');
446         if test x"$MANIFEST" != x"$LATEST_MANIFEST";
447           then
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
453           ;fi
454       ;done
455   dependencies: []
456   allow_failure: true
457   only:
458     - schedules
459   variables:
460     GIT_STRATEGY: none
461
462 ### fedora 30
463 fedora:30@container-clean:
464   extends:
465     - .fedora:30
466     - .container-clean
467
468 ### fedora 31
469 fedora:31@container-clean:
470   extends:
471     - .fedora:31
472     - .container-clean
473
474 ### ubuntu 19.10
475 ubuntu:19.10@container-clean:
476   extends:
477     - .ubuntu:19.10
478     - .container-clean
479
480 ### ubuntu 19.04
481 ubuntu:19.04@container-clean:
482   extends:
483     - .ubuntu:19.04
484     - .container-clean
485
486 ### debian stable
487 debian:stable@container-clean:
488   extends:
489     - .debian:stable
490     - .container-clean
491
492 ### debian sid
493 debian:sid@container-clean:
494   extends:
495     - .debian:sid
496     - .container-clean
497
498 ### centos 7
499 centos:7@container-clean:
500   extends:
501     - .centos:7
502     - .container-clean
503
504 ### centos 8
505 centos:8@container-clean:
506   extends:
507     - .centos:8
508     - .container-clean
509
510 ### arch rolling
511 arch:rolling@container-clean:
512   extends:
513     - .arch:rolling
514     - .container-clean
515
516 ### alpine latest
517 alpine:latest@container-clean:
518   extends:
519     - .alpine:latest
520     - .container-clean
521
522
523 #################################################################
524 #                                                               #
525 #                       build stage                             #
526 #                                                               #
527 #################################################################
528
529 .autotools-build@template:
530   extends:
531     - .autotools_build
532   stage: build
533   dependencies: []
534   variables:
535     MAKE_ARGS: "distcheck"
536
537 .meson-build@template:
538   extends:
539     - .meson_build
540   stage: build
541   dependencies: []
542   variables:
543     NINJA_ARGS: "dist"
544
545
546 fedora:30@autotools-build:
547   extends:
548     - .fedora:30
549     - .autotools-build@template
550   stage: autotools
551   needs: ['fedora:30@container-prep']
552
553 fedora:30@meson-build:
554   extends:
555     - .fedora:30
556     - .meson-build@template
557   stage: meson
558   needs: ['fedora:30@container-prep']
559
560
561 fedora:31@autotools-build:
562   extends:
563     - .fedora:31
564     - .autotools-build@template
565   stage: autotools
566   needs: ['fedora:31@container-prep']
567
568 fedora:31@meson-build:
569   extends:
570     - .fedora:31
571     - .meson-build@template
572   stage: meson
573   needs: ['fedora:31@container-prep']
574
575
576 ubuntu:19.10@autotools-build:
577   extends:
578     - .ubuntu:19.10
579     - .autotools-build@template
580   stage: autotools
581   needs: ['ubuntu:19.10@container-prep']
582
583 ubuntu:19.10@meson-build:
584   extends:
585     - .ubuntu:19.10
586     - .meson-build@template
587   stage: meson
588   needs: ['ubuntu:19.10@container-prep']
589
590
591 ubuntu:19.04@autotools-build:
592   extends:
593     - .ubuntu:19.04
594     - .autotools-build@template
595   stage: autotools
596   needs: ['ubuntu:19.04@container-prep']
597
598 ubuntu:19.04@meson-build:
599   extends:
600     - .ubuntu:19.04
601     - .meson-build@template
602   stage: meson
603   needs: ['ubuntu:19.04@container-prep']
604
605
606 debian:stable@autotools-build:
607   extends:
608     - .debian:stable
609     - .autotools-build@template
610   stage: autotools
611   needs: ['debian:stable@container-prep']
612
613 debian:stable@meson-build:
614   extends:
615     - .debian:stable
616     - .meson-build@template
617   stage: meson
618   needs: ['debian:stable@container-prep']
619
620
621 debian:sid@autotools-build:
622   extends:
623     - .debian:sid
624     - .autotools-build@template
625   stage: autotools
626   needs: ['debian:sid@container-prep']
627
628 debian:sid@meson-build:
629   extends:
630     - .debian:sid
631     - .meson-build@template
632   stage: meson
633   needs: ['debian:sid@container-prep']
634
635
636 centos:7@autotools-build:
637   extends:
638     - .centos:7
639     - .autotools-build@template
640   stage: autotools
641   variables:
642     MAKE_ARGS: ''  # disable distcheck, requires doxygen
643   needs: ['centos:7@container-prep']
644
645
646
647 centos:8@autotools-build:
648   extends:
649     - .centos:8
650     - .autotools-build@template
651   stage: autotools
652   variables:
653     MAKE_ARGS: ''  # disable distcheck, requires doxygen
654   needs: ['centos:8@container-prep']
655
656
657
658 arch:rolling@autotools-build:
659   extends:
660     - .arch:rolling
661     - .autotools-build@template
662   stage: autotools
663   needs: ['arch:rolling@container-prep']
664
665 arch:rolling@meson-build:
666   extends:
667     - .arch:rolling
668     - .meson-build@template
669   stage: meson
670   needs: ['arch:rolling@container-prep']
671
672
673 alpine:latest@autotools-build:
674   extends:
675     - .alpine:latest
676     - .autotools-build@template
677   stage: autotools
678   needs: ['alpine:latest@container-prep']
679
680 alpine:latest@meson-build:
681   extends:
682     - .alpine:latest
683     - .meson-build@template
684   stage: meson
685   needs: ['alpine:latest@container-prep']
686
687
688 # Build argument tests
689 #
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:
693   extends:
694     - .fedora:31
695     - .autotools-build@template
696   stage: build
697   needs: ['fedora:31@container-prep']
698
699 no-valgrind:autotools:
700   extends: .fedora-custom-build@autotools-template
701   before_script:
702     - dnf remove -y valgrind
703
704 no-check:autotools:
705   extends: .fedora-custom-build@autotools-template
706   before_script:
707     - dnf remove -y check check-devel
708
709 no-doxygen:autotools:
710   extends: .fedora-custom-build@autotools-template
711   before_script:
712     - dnf remove -y doxygen
713   variables:
714     MAKE_ARGS: ''  # disable distcheck, requires doxygen
715
716 # doxygen is required for distcheck
717 no-doxygen-check-valgrind:autotools:
718   extends: .fedora-custom-build@autotools-template
719   before_script:
720     - dnf remove -y doxygen valgrind check check-devel
721   variables:
722     MAKE_ARGS: ''  # disable distcheck, requires doxygen
723
724 no-nm:autotools:
725   extends: .fedora-custom-build@autotools-template
726   before_script:
727     - mv /usr/bin/nm /usr/bin/nm.moved
728
729 enable-gcov:autotools:
730   extends: .fedora-custom-build@autotools-template
731   variables:
732     CONFIGURE_FLAGS: "--enable-gcov"
733
734 .fedora-custom-build@meson-template:
735   extends:
736     - .fedora:31
737     - .meson-build@template
738   stage: build
739   needs: ['fedora:31@container-prep']
740
741 no-valgrind:meson:
742   extends: .fedora-custom-build@meson-template
743   before_script:
744     - dnf remove -y valgrind
745
746 no-check:meson:
747   extends: .fedora-custom-build@meson-template
748   before_script:
749     - dnf remove -y check check-devel
750   variables:
751     MESON_ARGS: -Dtests=disabled
752     SKIP_MESON_TEST: 1
753
754 # doxygen is required for dist
755 no-doxygen:meson:
756   extends: .fedora-custom-build@meson-template
757   before_script:
758     - dnf remove -y doxygen
759   variables:
760     MESON_ARGS: -Ddocumentation=disabled
761     NINJA_ARGS: ''
762
763 # doxygen is required for dist
764 no-doxygen-check-valgrind:meson:
765   extends: .fedora-custom-build@meson-template
766   before_script:
767     - dnf remove -y doxygen valgrind check check-devel
768   variables:
769     MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled
770     NINJA_ARGS: ''
771     SKIP_MESON_TEST: 1
772
773 enable-gcov:meson:
774   extends: .fedora-custom-build@meson-template
775   variables:
776     MESON_ARGS: '-Dcoverity=true'
777
778 scan-build:meson:
779   extends: .fedora-custom-build@meson-template
780   variables:
781     NINJA_ARGS: 'scan-build'
782     SKIP_MESON_TEST: 1
783
784 soname:
785   extends:
786     - .fedora:31
787   stage: build
788   script:
789   - ./autogen.sh --prefix=$PWD/prefix-autotools/
790   - make install
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']
796
797 #################################################################
798 #                                                               #
799 #                          VM stage                             #
800 #                                                               #
801 #################################################################
802
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 ]];
806   then
807     echo tainted kernel ;
808     exit 1 ;
809   fi
810
811 .qemu@fedora:31:
812   extends:
813     - .fedora:31
814   stage: VM
815   image:
816     $CI_REGISTRY_IMAGE/$DISTRIB_NAME/$FDO_DISTRIBUTION_VERSION:qemu-$FDO_DISTRIBUTION_TAG
817   tags:
818     - kvm
819   variables:
820     MESON_BUILDDIR: build_dir
821   script:
822     # start our vm, no args required
823     - /app/start_vm.sh
824
825     - *check_tainted
826
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" .
837
838     - *check_tainted
839
840     - ssh localhost -p 5555 halt || true
841     - sleep 2
842     - pkill qemu || true
843
844     - if [[ ! -e .success ]] ;
845       then
846         exit 1 ;
847       fi
848   artifacts:
849     name: "qemu-meson-logs-$CI_JOB_NAME"
850     when: always
851     expire_in: 1 week
852     paths:
853       - $MESON_BUILDDIR/meson-logs
854       - console.out
855     reports:
856       junit: $MESON_BUILDDIR/junit-*.xml
857
858   retry:
859     max: 2
860     when: script_failure
861   needs: ['fedora:31@qemu-prep']
862
863 qemu:meson:
864   extends: .qemu@fedora:31
865
866 qemu:meson:valgrind:
867   extends: .qemu@fedora:31
868   variables:
869     MESON_TEST_ARGS: '--setup=valgrind'
870
871 meson-from-tarball:
872   extends:
873     - .fedora:31
874   stage: tarballs
875   script:
876     - export INSTALLDIR="$PWD/_inst"
877     - mkdir _build
878     - pushd _build > /dev/null
879     - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
880     - make
881     - make distcheck
882     - popd > /dev/null
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
889     - popd > /dev/null
890     - ls -lR $INSTALLDIR
891   needs: ['fedora:31@container-prep']
892
893 autotools-from-tarball:
894   extends:
895     - .fedora:31
896   stage: tarballs
897   script:
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
904     - mkdir _build
905     - pushd _build > /dev/null
906     - ../autogen.sh --disable-silent-rules --prefix="$INSTALLDIR" $CONFIGURE_FLAGS
907     - make
908     - make install
909     - make distcheck
910     - popd > /dev/null
911     - popd > /dev/null
912     - ls -lR $INSTALLDIR
913   needs: ['fedora:31@container-prep']