README: note that patches go as MRs to gitlab now
[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 8410d3382c4ba5e83da76a027cb332169f2a95ad # 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   ###############################################################################
46   # This is the list of packages required to build libevdev with the default    #
47   # configuration.                                                              #
48   #                                                                             #
49   # Run dnf install/apt-get install/.. with the list of packages for your       #
50   # distribution                                                                #
51   ###############################################################################
52   FEDORA_RPMS: 'git gcc gcc-c++ meson automake autoconf libtool make pkgconfig  python3 check-devel valgrind binutils doxygen xz clang-analyzer'
53   CENTOS_RPMS: 'git gcc gcc-c++       automake autoconf libtool make pkgconfig  python3 check-devel valgrind binutils xz'
54   UBUNTU_DEBS: 'git gcc g++     meson automake autoconf libtool make pkg-config python3 check       valgrind binutils doxygen xz-utils'
55   DEBIAN_DEBS: $UBUNTU_DEBS
56   ARCH_PKGS:   'git gcc         meson automake autoconf libtool make pkgconfig  python3 check       valgrind binutils doxygen'
57   ALPINE_PKGS: 'git gcc g++     meson automake autoconf libtool make pkgconfig  python3 check-dev   valgrind binutils doxygen xz linux-headers'
58   ############################ end of package lists #############################
59   # these tags should be updated each time the list of packages is updated
60   # changing these will force rebuilding the associated image
61   # Note: these tags have no meaning and are not tied to a particular
62   # libevdev version
63   FEDORA_TAG: '2020-02-26.4'
64   CENTOS_TAG: '2020-02-26.4'
65   DEBIAN_TAG: '2020-02-26.4'
66   UBUNTU_TAG: '2020-02-26.4'
67   ARCH_TAG:   '2020-02-26.4'
68   ALPINE_TAG: '2020-02-26.4'
69   QEMU_TAG:   'qemu-2020-02-26.4'
70
71   UPSTREAM_REPO: libevdev/libevdev
72   BUILDAH_IMAGE: $CI_REGISTRY/wayland/ci-templates/buildah:latest
73   FEDORA_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$FEDORA_TAG
74   CENTOS_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/centos/$CENTOS_VERSION:$CENTOS_TAG
75   UBUNTU_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/ubuntu/$UBUNTU_VERSION:$UBUNTU_TAG
76   DEBIAN_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:$DEBIAN_TAG
77   ARCH_CONTAINER_IMAGE:   $CI_REGISTRY_IMAGE/arch/rolling:$ARCH_TAG
78   ALPINE_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/alpine/latest:$ALPINE_TAG
79   QEMU_CONTAINER_IMAGE:   $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$QEMU_TAG
80
81   LIBEVDEV_SKIP_ROOT_TESTS: 1
82   GIT_DEPTH: 1
83   MESON_BUILDDIR: 'build dir'
84
85 .default_artifacts:
86   artifacts:
87     paths:
88       - _build/test/test-suite.log
89       - $MESON_BUILDDIR/meson-logs/
90     expire_in: 1 week
91     when: on_failure
92     reports:
93       junit: $MESON_BUILDDIR/junit-*.xml
94
95 .autotools_build:
96   extends:
97     - .default_artifacts
98   script:
99     - mkdir _build
100     - pushd _build > /dev/null
101     - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
102     - make
103     - make check
104     - if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi
105     - popd > /dev/null
106
107 .meson_build:
108   extends:
109     - .default_artifacts
110   script:
111     - .gitlab-ci/meson-build.sh
112
113 #################################################################
114 #                                                               #
115 #                          prep stage                           #
116 #                                                               #
117 #################################################################
118
119 # Re-generate the CI script and make sure it's the one currently checked in
120 # If this job fails, re-generate the gitlab-ci.yml script, see
121 # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
122 #
123 check-ci-script:
124   image: golang:alpine
125   stage: prep
126   before_script:
127     - apk add python3 git
128     - pip3 install --user jinja2 PyYAML
129   script:
130     - python3 ./.gitlab-ci/generate-gitlab-ci.py
131     - git diff --exit-code && exit 0 || true
132     - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
133     - exit 1
134
135 check-commit:
136   image: golang:alpine
137   stage: prep
138   before_script:
139     - apk add python3 git
140   script:
141     - pip3 install GitPython
142     - pip3 install pytest
143     - |
144       pytest --junitxml=results.xml \
145              --tb=line \
146              --assert=plain \
147              ./.gitlab-ci/check-commit.py
148   except:
149     - master@libevdev/libevdev
150   variables:
151     GIT_DEPTH: 100
152   artifacts:
153     when: on_failure
154     paths:
155       - results.xml
156     reports:
157       junit: results.xml
158
159 .pull_upstream_or_rebuild:
160   before_script:
161     # log in to the registry
162     - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
163
164     # get the full container image name (DISTRIB_VERSION still has indirections)
165     - IMAGE=$(eval echo "$DISTRIB_NAME/$DISTRIB_VERSION:$TAG")
166
167     - |
168       # force rebuild if schedule, reuse otherwise
169       if [[ $CI_PIPELINE_SOURCE != "schedule" ]] ;
170       then
171         # pull the latest upstream image if it exists
172         skopeo copy docker://$CI_REGISTRY/$UPSTREAM_REPO/$IMAGE \
173                     docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
174
175         # check if our image is already in the current registry
176         skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
177       fi
178
179 fedora:31@qemu-prep:
180   extends:
181     - .fedora@qemu-build
182     - .pull_upstream_or_rebuild
183   stage: prep
184   tags:
185     - kvm
186   variables:
187     GIT_STRATEGY: none
188     FEDORA_VERSION: 31
189     FEDORA_TAG: $QEMU_TAG
190     DISTRIB_NAME: fedora
191     DISTRIB_VERSION: $FEDORA_VERSION
192     TAG: $QEMU_TAG
193   allow_failure: true
194
195
196 ### fedora 30
197 fedora:30@container-prep:
198   extends:
199     - .fedora@container-build
200     - .pull_upstream_or_rebuild
201   stage: prep
202   variables:
203     GIT_STRATEGY: none
204     FEDORA_VERSION: '30'
205     DISTRIB_NAME: fedora
206     DISTRIB_VERSION: $FEDORA_VERSION
207     TAG: $FEDORA_TAG
208
209
210 ### fedora 31
211 fedora:31@container-prep:
212   extends:
213     - .fedora@container-build
214     - .pull_upstream_or_rebuild
215   stage: prep
216   variables:
217     GIT_STRATEGY: none
218     FEDORA_VERSION: '31'
219     DISTRIB_NAME: fedora
220     DISTRIB_VERSION: $FEDORA_VERSION
221     TAG: $FEDORA_TAG
222
223
224 ### ubuntu 19.10
225 ubuntu:19.10@container-prep:
226   extends:
227     - .ubuntu@container-build
228     - .pull_upstream_or_rebuild
229   stage: prep
230   variables:
231     GIT_STRATEGY: none
232     UBUNTU_VERSION: '19.10'
233     DISTRIB_NAME: ubuntu
234     DISTRIB_VERSION: $UBUNTU_VERSION
235     TAG: $UBUNTU_TAG
236
237
238 ### ubuntu 19.04
239 ubuntu:19.04@container-prep:
240   extends:
241     - .ubuntu@container-build
242     - .pull_upstream_or_rebuild
243   stage: prep
244   variables:
245     GIT_STRATEGY: none
246     UBUNTU_VERSION: '19.04'
247     DISTRIB_NAME: ubuntu
248     DISTRIB_VERSION: $UBUNTU_VERSION
249     TAG: $UBUNTU_TAG
250
251
252 ### debian stable
253 debian:stable@container-prep:
254   extends:
255     - .debian@container-build
256     - .pull_upstream_or_rebuild
257   stage: prep
258   variables:
259     GIT_STRATEGY: none
260     DEBIAN_VERSION: 'stable'
261     DISTRIB_NAME: debian
262     DISTRIB_VERSION: $DEBIAN_VERSION
263     TAG: $DEBIAN_TAG
264
265
266 ### debian sid
267 debian:sid@container-prep:
268   extends:
269     - .debian@container-build
270     - .pull_upstream_or_rebuild
271   stage: prep
272   variables:
273     GIT_STRATEGY: none
274     DEBIAN_VERSION: 'sid'
275     DISTRIB_NAME: debian
276     DISTRIB_VERSION: $DEBIAN_VERSION
277     TAG: $DEBIAN_TAG
278
279
280 ### centos 7
281 centos:7@container-prep:
282   extends:
283     - .centos@container-build
284     - .pull_upstream_or_rebuild
285   stage: prep
286   variables:
287     GIT_STRATEGY: none
288     CENTOS_VERSION: '7'
289     DISTRIB_NAME: centos
290     DISTRIB_VERSION: $CENTOS_VERSION
291     TAG: $CENTOS_TAG
292
293
294 ### centos 8
295 centos:8@container-prep:
296   extends:
297     - .centos@container-build
298     - .pull_upstream_or_rebuild
299   stage: prep
300   variables:
301     GIT_STRATEGY: none
302     CENTOS_VERSION: '8'
303     DISTRIB_NAME: centos
304     DISTRIB_VERSION: $CENTOS_VERSION
305     TAG: $CENTOS_TAG
306
307
308 ### arch rolling
309 arch:rolling@container-prep:
310   extends:
311     - .arch@container-build
312     - .pull_upstream_or_rebuild
313   stage: prep
314   variables:
315     GIT_STRATEGY: none
316     ARCH_VERSION: 'rolling'
317     DISTRIB_NAME: arch
318     DISTRIB_VERSION: $ARCH_VERSION
319     TAG: $ARCH_TAG
320
321
322 ### alpine latest
323 alpine:latest@container-prep:
324   extends:
325     - .alpine@container-build
326     - .pull_upstream_or_rebuild
327   stage: prep
328   variables:
329     GIT_STRATEGY: none
330     ALPINE_VERSION: 'latest'
331     DISTRIB_NAME: alpine
332     DISTRIB_VERSION: $ALPINE_VERSION
333     TAG: $ALPINE_TAG
334
335
336 #################################################################
337 #                                                               #
338 #                   container clean stage                       #
339 #                 run during the clean stage                    #
340 #                                                               #
341 #################################################################
342
343 #
344 # This stage will look for the container images we currently have in
345 # the registry and will remove any that are not tagged with the provided
346 # $container_image:$tag
347 #
348 .container-clean:
349   stage: container_clean
350   image: $BUILDAH_IMAGE
351   script:
352     # get the full container image name (CURRENT_CONTAINER_IMAGE still has indirections)
353     - CONTAINER_IMAGE=$(eval echo "$CURRENT_CONTAINER_IMAGE")
354     - GITLAB=$(echo $CI_PROJECT_URL | cut -f3 -d/)
355     - REPOSITORY=$(echo $CONTAINER_IMAGE | cut -f2- -d/ | cut -f1 -d:)
356     - IMAGE_PATH=$(echo $CONTAINER_IMAGE | cut -f1 -d:)
357     - LATEST_TAG=$(echo $CONTAINER_IMAGE | cut -f2 -d:)
358
359     # log in to the registry (read only)
360     - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
361
362     # get the r/w token from the settings to access the registry
363     #
364     # each developer needs to register a secret variable that contains
365     # a personal token with api access. The token
366     # - must be named PERSONAL_TOKEN_$USER (for example PERSONAL_TOKEN_bentiss)
367     # - must be registered in the CI/CD Variables section as type file
368     # - value must be a netrc file as a single-line string:
369     #   default login <user> password <token value>
370     #   e.g. "default login bentiss password 1235abcde"
371     - tokenname="PERSONAL_TOKEN_$GITLAB_USER_LOGIN"
372     - netrcfile=$(eval echo "\$$tokenname")
373     - if [[ ! -f "$netrcfile" ]]; then
374          echo "No netrc file found or token is missing, skipping job" && false;
375       fi
376
377     # request a token for the registry API
378     - REGISTRY_TOKEN=$(curl https://$GITLAB/jwt/auth --get
379                              --silent --show-error
380                              -d client_id=docker
381                              -d offline_token=true
382                              -d service=container_registry
383                              -d "scope=repository:$REPOSITORY:pull,*"
384                              --fail
385                              --netrc-file "$netrcfile"
386                              | sed -r 's/(\{"token":"|"\})//g')
387
388     # get the digest of the latest image
389     - LATEST_MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.Digest')
390
391     # get the list of tags
392     - TAGS=$(skopeo inspect docker://$IMAGE_PATH:$LATEST_TAG | jq -r '.RepoTags[]')
393     # FIXME: is the above command working properly? If not, use below:
394     # - TAGS=$(curl -X GET -H "accept:application/vnd.docker.distribution.manifest.v2+json"
395     #                      -H "authorization:Bearer $REGISTRY_TOKEN"
396     #                      https://$CI_REGISTRY/v2/$REPOSITORY/tags/list | jq -r '.tags[]')
397
398     # iterate over the tags
399     - for tag in $TAGS;
400       do
401         MANIFEST=$(skopeo inspect docker://$IMAGE_PATH:$tag | jq -r '.Digest');
402         if test x"$MANIFEST" != x"$LATEST_MANIFEST";
403           then
404             echo removing $tag as $MANIFEST;
405             curl https://$CI_REGISTRY/v2/$REPOSITORY/manifests/$MANIFEST --silent
406                  -H "accept:application/vnd.docker.distribution.manifest.v2+json"
407                  -H "authorization:Bearer $REGISTRY_TOKEN"
408                  --fail --show-error -X DELETE || true
409           ;fi
410       ;done
411   dependencies: []
412   allow_failure: true
413   only:
414     - schedules
415   variables:
416     GIT_STRATEGY: none
417
418
419 ### fedora 30
420 fedora:30@container-clean:
421   extends: .container-clean
422   variables:
423     FEDORA_VERSION: '30'
424     CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
425
426
427 ### fedora 31
428 fedora:31@container-clean:
429   extends: .container-clean
430   variables:
431     FEDORA_VERSION: '31'
432     CURRENT_CONTAINER_IMAGE: $FEDORA_CONTAINER_IMAGE
433
434
435 ### ubuntu 19.10
436 ubuntu:19.10@container-clean:
437   extends: .container-clean
438   variables:
439     UBUNTU_VERSION: '19.10'
440     CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
441
442
443 ### ubuntu 19.04
444 ubuntu:19.04@container-clean:
445   extends: .container-clean
446   variables:
447     UBUNTU_VERSION: '19.04'
448     CURRENT_CONTAINER_IMAGE: $UBUNTU_CONTAINER_IMAGE
449
450
451 ### debian stable
452 debian:stable@container-clean:
453   extends: .container-clean
454   variables:
455     DEBIAN_VERSION: 'stable'
456     CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
457
458
459 ### debian sid
460 debian:sid@container-clean:
461   extends: .container-clean
462   variables:
463     DEBIAN_VERSION: 'sid'
464     CURRENT_CONTAINER_IMAGE: $DEBIAN_CONTAINER_IMAGE
465
466
467 ### centos 7
468 centos:7@container-clean:
469   extends: .container-clean
470   variables:
471     CENTOS_VERSION: '7'
472     CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE
473
474
475 ### centos 8
476 centos:8@container-clean:
477   extends: .container-clean
478   variables:
479     CENTOS_VERSION: '8'
480     CURRENT_CONTAINER_IMAGE: $CENTOS_CONTAINER_IMAGE
481
482
483 ### arch rolling
484 arch:rolling@container-clean:
485   extends: .container-clean
486   variables:
487     ARCH_VERSION: 'rolling'
488     CURRENT_CONTAINER_IMAGE: $ARCH_CONTAINER_IMAGE
489
490
491 ### alpine latest
492 alpine:latest@container-clean:
493   extends: .container-clean
494   variables:
495     ALPINE_VERSION: 'latest'
496     CURRENT_CONTAINER_IMAGE: $ALPINE_CONTAINER_IMAGE
497
498
499 #################################################################
500 #                                                               #
501 #                       build stage                             #
502 #                                                               #
503 #################################################################
504
505 .autotools-build@template:
506   extends:
507     - .autotools_build
508   stage: build
509   dependencies: []
510   variables:
511     MAKE_ARGS: "distcheck"
512
513 .meson-build@template:
514   extends:
515     - .meson_build
516   stage: build
517   dependencies: []
518   variables:
519     NINJA_ARGS: "dist"
520
521
522 fedora:30@autotools-build:
523   extends: .autotools-build@template
524   stage: autotools
525   image: $FEDORA_CONTAINER_IMAGE
526   variables:
527     FEDORA_VERSION: '30'
528   needs: ['fedora:30@container-prep']
529
530 fedora:30@meson-build:
531   extends: .meson-build@template
532   stage: meson
533   image: $FEDORA_CONTAINER_IMAGE
534   variables:
535     FEDORA_VERSION: '30'
536   needs: ['fedora:30@container-prep']
537
538
539 fedora:31@autotools-build:
540   extends: .autotools-build@template
541   stage: autotools
542   image: $FEDORA_CONTAINER_IMAGE
543   variables:
544     FEDORA_VERSION: '31'
545   needs: ['fedora:31@container-prep']
546
547 fedora:31@meson-build:
548   extends: .meson-build@template
549   stage: meson
550   image: $FEDORA_CONTAINER_IMAGE
551   variables:
552     FEDORA_VERSION: '31'
553   needs: ['fedora:31@container-prep']
554
555
556 ubuntu:19.10@autotools-build:
557   extends: .autotools-build@template
558   stage: autotools
559   image: $UBUNTU_CONTAINER_IMAGE
560   variables:
561     UBUNTU_VERSION: '19.10'
562   needs: ['ubuntu:19.10@container-prep']
563
564 ubuntu:19.10@meson-build:
565   extends: .meson-build@template
566   stage: meson
567   image: $UBUNTU_CONTAINER_IMAGE
568   variables:
569     UBUNTU_VERSION: '19.10'
570   needs: ['ubuntu:19.10@container-prep']
571
572
573 ubuntu:19.04@autotools-build:
574   extends: .autotools-build@template
575   stage: autotools
576   image: $UBUNTU_CONTAINER_IMAGE
577   variables:
578     UBUNTU_VERSION: '19.04'
579   needs: ['ubuntu:19.04@container-prep']
580
581 ubuntu:19.04@meson-build:
582   extends: .meson-build@template
583   stage: meson
584   image: $UBUNTU_CONTAINER_IMAGE
585   variables:
586     UBUNTU_VERSION: '19.04'
587   needs: ['ubuntu:19.04@container-prep']
588
589
590 debian:stable@autotools-build:
591   extends: .autotools-build@template
592   stage: autotools
593   image: $DEBIAN_CONTAINER_IMAGE
594   variables:
595     DEBIAN_VERSION: 'stable'
596   needs: ['debian:stable@container-prep']
597
598 debian:stable@meson-build:
599   extends: .meson-build@template
600   stage: meson
601   image: $DEBIAN_CONTAINER_IMAGE
602   variables:
603     DEBIAN_VERSION: 'stable'
604   needs: ['debian:stable@container-prep']
605
606
607 debian:sid@autotools-build:
608   extends: .autotools-build@template
609   stage: autotools
610   image: $DEBIAN_CONTAINER_IMAGE
611   variables:
612     DEBIAN_VERSION: 'sid'
613   needs: ['debian:sid@container-prep']
614
615 debian:sid@meson-build:
616   extends: .meson-build@template
617   stage: meson
618   image: $DEBIAN_CONTAINER_IMAGE
619   variables:
620     DEBIAN_VERSION: 'sid'
621   needs: ['debian:sid@container-prep']
622
623
624 centos:7@autotools-build:
625   extends: .autotools-build@template
626   stage: autotools
627   image: $CENTOS_CONTAINER_IMAGE
628   variables:
629     CENTOS_VERSION: '7'
630     MAKE_ARGS: ''  # disable distcheck, requires doxygen
631   needs: ['centos:7@container-prep']
632
633
634
635 centos:8@autotools-build:
636   extends: .autotools-build@template
637   stage: autotools
638   image: $CENTOS_CONTAINER_IMAGE
639   variables:
640     CENTOS_VERSION: '8'
641     MAKE_ARGS: ''  # disable distcheck, requires doxygen
642   needs: ['centos:8@container-prep']
643
644
645
646 arch:rolling@autotools-build:
647   extends: .autotools-build@template
648   stage: autotools
649   image: $ARCH_CONTAINER_IMAGE
650   variables:
651     ARCH_VERSION: 'rolling'
652   needs: ['arch:rolling@container-prep']
653
654 arch:rolling@meson-build:
655   extends: .meson-build@template
656   stage: meson
657   image: $ARCH_CONTAINER_IMAGE
658   variables:
659     ARCH_VERSION: 'rolling'
660   needs: ['arch:rolling@container-prep']
661
662
663 alpine:latest@autotools-build:
664   extends: .autotools-build@template
665   stage: autotools
666   image: $ALPINE_CONTAINER_IMAGE
667   variables:
668     ALPINE_VERSION: 'latest'
669   needs: ['alpine:latest@container-prep']
670
671 alpine:latest@meson-build:
672   extends: .meson-build@template
673   stage: meson
674   image: $ALPINE_CONTAINER_IMAGE
675   variables:
676     ALPINE_VERSION: 'latest'
677   needs: ['alpine:latest@container-prep']
678
679
680 # Build argument tests
681 #
682 # We only run the build option combinations on one image
683 # because they're supposed to fail equally on all
684 .fedora-custom-build@autotools-template:
685   extends: .autotools-build@template
686   stage: build
687   image: $FEDORA_CONTAINER_IMAGE
688   variables:
689     FEDORA_VERSION: 31
690   needs: ['fedora:31@container-prep']
691
692 no-valgrind:autotools:
693   extends: .fedora-custom-build@autotools-template
694   before_script:
695     - dnf remove -y valgrind
696
697 no-check:autotools:
698   extends: .fedora-custom-build@autotools-template
699   before_script:
700     - dnf remove -y check check-devel
701
702 no-doxygen:autotools:
703   extends: .fedora-custom-build@autotools-template
704   before_script:
705     - dnf remove -y doxygen
706   variables:
707     MAKE_ARGS: ''  # disable distcheck, requires doxygen
708
709 # doxygen is required for distcheck
710 no-doxygen-check-valgrind:autotools:
711   extends: .fedora-custom-build@autotools-template
712   before_script:
713     - dnf remove -y doxygen valgrind check check-devel
714   variables:
715     MAKE_ARGS: ''  # disable distcheck, requires doxygen
716
717 no-nm:autotools:
718   extends: .fedora-custom-build@autotools-template
719   before_script:
720     - mv /usr/bin/nm /usr/bin/nm.moved
721
722 enable-gcov:autotools:
723   extends: .fedora-custom-build@autotools-template
724   variables:
725     CONFIGURE_FLAGS: "--enable-gcov"
726
727 .fedora-custom-build@meson-template:
728   extends: .meson-build@template
729   stage: build
730   image: $FEDORA_CONTAINER_IMAGE
731   variables:
732     FEDORA_VERSION: 31
733   needs: ['fedora:31@container-prep']
734
735 no-valgrind:meson:
736   extends: .fedora-custom-build@meson-template
737   before_script:
738     - dnf remove -y valgrind
739
740 no-check:meson:
741   extends: .fedora-custom-build@meson-template
742   before_script:
743     - dnf remove -y check check-devel
744   variables:
745     MESON_ARGS: -Dtests=disabled
746     SKIP_MESON_TEST: 1
747
748 # doxygen is required for dist
749 no-doxygen:meson:
750   extends: .fedora-custom-build@meson-template
751   before_script:
752     - dnf remove -y doxygen
753   variables:
754     MESON_ARGS: -Ddocumentation=disabled
755     NINJA_ARGS: ''
756
757 # doxygen is required for dist
758 no-doxygen-check-valgrind:meson:
759   extends: .fedora-custom-build@meson-template
760   before_script:
761     - dnf remove -y doxygen valgrind check check-devel
762   variables:
763     MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled
764     NINJA_ARGS: ''
765     SKIP_MESON_TEST: 1
766
767 enable-gcov:meson:
768   extends: .fedora-custom-build@meson-template
769   variables:
770     MESON_ARGS: '-Dcoverity=true'
771
772 scan-build:meson:
773   extends: .fedora-custom-build@meson-template
774   variables:
775     NINJA_ARGS: 'scan-build'
776     SKIP_MESON_TEST: 1
777
778 soname:
779   stage: build
780   image: $FEDORA_CONTAINER_IMAGE
781   script:
782   - ./autogen.sh --prefix=$PWD/prefix-autotools/
783   - make install
784   - ls -l $PWD/prefix-autotools/lib/libevdev.so.2.3.0
785   - meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/
786   - ninja -C "$MESON_BUILDDIR" install
787   - ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0
788   variables:
789     FEDORA_VERSION: 31
790   needs: ['fedora:31@container-prep']
791
792 #################################################################
793 #                                                               #
794 #                          VM stage                             #
795 #                                                               #
796 #################################################################
797
798 .check_tainted: &check_tainted |
799   # make sure the kernel is not tainted
800   if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
801   then
802     echo tainted kernel ;
803     exit 1 ;
804   fi
805
806 .qemu@fedora:31:
807   stage: VM
808   image: $QEMU_CONTAINER_IMAGE
809   tags:
810     - kvm
811   variables:
812     FEDORA_VERSION: 31
813     MESON_BUILDDIR: build_dir
814   script:
815     # start our vm, no args required
816     - /app/start_vm.sh
817
818     - *check_tainted
819
820     - "scp -P 5555 -r $PWD localhost:"
821     - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
822     - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
823     - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
824     - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS\"" >> sshenv
825     - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
826     - "scp -P 5555 sshenv localhost:~/$CI_PROJECT_NAME/.meson_environment"
827     - ssh localhost -p 5555 "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
828     # no matter the results of the tests, we want to fetch the logs
829     - scp -P 5555 -r localhost:$CI_PROJECT_NAME/"$MESON_BUILDDIR" .
830
831     - *check_tainted
832
833     - ssh localhost -p 5555 halt || true
834     - sleep 2
835     - pkill qemu || true
836
837     - if [[ ! -e .success ]] ;
838       then
839         exit 1 ;
840       fi
841   artifacts:
842     name: "qemu-meson-logs-$CI_JOB_NAME"
843     when: always
844     expire_in: 1 week
845     paths:
846       - $MESON_BUILDDIR/meson-logs
847       - console.out
848     reports:
849       junit: $MESON_BUILDDIR/junit-*.xml
850
851   retry:
852     max: 2
853     when: script_failure
854   needs: ['fedora:31@qemu-prep']
855
856 qemu:meson:
857   extends: .qemu@fedora:31
858
859 qemu:meson:valgrind:
860   extends: .qemu@fedora:31
861   variables:
862     MESON_TEST_ARGS: '--setup=valgrind'
863
864 meson-from-tarball:
865   stage: tarballs
866   image: $FEDORA_CONTAINER_IMAGE
867   script:
868     - export INSTALLDIR="$PWD/_inst"
869     - mkdir _build
870     - pushd _build > /dev/null
871     - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
872     - make
873     - make distcheck
874     - popd > /dev/null
875     - mkdir -p _tarball_dir
876     - tar xf _build/libevdev-*.tar.xz -C _tarball_dir
877     - pushd _tarball_dir/libevdev-*/ > /dev/null
878     - meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR"
879     - ninja -C "$MESON_BUILDDIR" test
880     - ninja -C "$MESON_BUILDDIR" install
881     - popd > /dev/null
882     - ls -lR $INSTALLDIR
883   variables:
884     FEDORA_VERSION: 31
885   needs: ['fedora:31@container-prep']
886
887 autotools-from-tarball:
888   stage: tarballs
889   image: $FEDORA_CONTAINER_IMAGE
890   script:
891     - export INSTALLDIR="$PWD/_inst"
892     - meson "$MESON_BUILDDIR"
893     - ninja -C "$MESON_BUILDDIR" dist
894     - mkdir -p _tarball_dir
895     - tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir
896     - pushd _tarball_dir/libevdev-*/ > /dev/null
897     - mkdir _build
898     - pushd _build > /dev/null
899     - ../autogen.sh --disable-silent-rules --prefix="$INSTALLDIR" $CONFIGURE_FLAGS
900     - make
901     - make install
902     - make distcheck
903     - popd > /dev/null
904     - popd > /dev/null
905     - ls -lR $INSTALLDIR
906   variables:
907     FEDORA_VERSION: 31
908   needs: ['fedora:31@container-prep']