gitlab CI: trigger the wayland website pipeline directly
[platform/upstream/libinput.git] / .gitlab-ci / ci.template
1 # vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:
2
3 {# You're looking at the template here, so you can ignore the below
4    warning. This is the right file to edit #}
5 ########################################
6 #                                      #
7 # THIS FILE IS GENERATED, DO NOT EDIT  #
8 #                                      #
9 ########################################
10
11 #
12 # This is a bit complicated for two reasons:
13 # - we really want to run dnf/apt/... only once, updating on the test runner for
14 #   each job takes forever. So we create a container image for each distribution
15 #   tested, then run the tests on this container image.
16 #
17 #   Creating a container image is time-consuming, so we only do so for pushes to
18 #   libinput directly (not merge requests) and if the current image is 'old'.
19 #
20 # - GitLab only allows one script: set per job but we have a bunch of commands
21 #   we need to re-run for each build (meson && ninja && etc). YAML cannot merge
22 #   arrays templates so we're screwed.
23 #
24 #   So instead we use a default_build template and override everything with
25 #   variables. The only two variables that matter:
26 #     MESON_ARGS=-Denable-something=true
27 #     NINJA_ARGS=dist ... to run 'ninja -C builddir dist'
28 #   Note that you cannot use scripts: in any target if you expect default_build
29 #   to work.
30 #
31 #
32 # All jobs must follow the naming scheme of
33 # <distribution>:<version>@activity:
34 #  e.g. fedora:31@build-default
35
36 .templates_sha: &template_sha 395535ce90eb48e260c0dff12c35d9237e22c539 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
37
38 include:
39   {% for distro in distributions|sort(attribute="name") %}
40   {% if not distro.does_not_have_ci_templates %}
41   # {{ distro.name.capitalize() }} container builder template
42   - project: 'freedesktop/ci-templates'
43     ref: *template_sha
44     file: '/templates/{{distro.name}}.yml'
45   {% endif %}
46   {% endfor %}
47
48 stages:
49   - prep             # prep work like rebuilding the container images if there is a change
50   - build            # for actually building and testing things in a container
51   - VM               # for running the test suite in a VM
52   - valgrind         # for running the test suite under valgrind in a VM
53   - distro           # distribs test
54   - deploy           # trigger wayland's website generation
55   - container_clean  # clean up unused container images
56
57 variables:
58   ###############################################################################
59   # This is the list of packages required to build libinput with the default    #
60   # configuration.                                                              #
61   #                                                                             #
62   # Run dnf install/apt-get install/.. with the list of packages for your       #
63   # distribution                                                                #
64   #                                                                             #
65   # See the documentation here:                                                 #
66   # https://wayland.freedesktop.org/libinput/doc/latest/building_libinput.html  #
67   ###############################################################################
68   FEDORA_PACKAGES:    'git gcc gcc-c++ pkgconf-pkg-config meson check-devel libudev-devel libevdev-devel doxygen graphviz python3-sphinx python3-recommonmark python3-sphinx_rtd_theme python3-pytest-xdist libwacom-devel cairo-devel   gtk3-devel   glib2-devel    mtdev-devel diffutils'
69   FEDORA_QEMU_RPMS:   'git gcc gcc-c++ pkgconf-pkg-config meson check-devel libudev-devel libevdev-devel doxygen graphviz python3-sphinx python3-recommonmark python3-sphinx_rtd_theme python3-pytest-xdist libwacom-devel cairo-devel   gtk3-devel   glib2-devel    mtdev-devel diffutils valgrind'
70   UBUNTU_PACKAGES:    'git gcc g++     pkg-config         meson check       libudev-dev   libevdev-dev   doxygen graphviz python3-sphinx python3-recommonmark python3-sphinx-rtd-theme python3-pytest-xdist libwacom-dev   libcairo2-dev libgtk-3-dev libglib2.0-dev libmtdev-dev'
71   ARCH_PACKAGES:      'git gcc         pkgconfig          meson check       libsystemd    libevdev       doxygen graphviz python-sphinx  python-recommonmark  python-sphinx_rtd_theme  python-pytest-xdist  libwacom                     gtk3                        mtdev      diffutils'
72   FREEBSD_BUILD_PKGS: 'meson'
73   FREEBSD_PKGS:       'libepoll-shim                                        libudev-devd  libevdev                                                                                     libwacom                     gtk3                        libmtdev   '
74   ALPINE_PACKAGES:    'git gcc build-base pkgconfig       meson check-dev   eudev-dev     libevdev-dev                                                                                 libwacom-dev   cairo-dev     gtk+3.0-dev  mtdev-dev bash'
75   ############################ end of package lists #############################
76
77   # these tags should be updated each time the list of packages is updated
78   # changing these will force rebuilding the associated image
79   # Note: these tags have no meaning and are not tied to a particular
80   # libinput version
81 {% for distro in distributions %}
82   {{"%-13s"| format(distro.name.upper() + '_TAG:')}}'{{distro.tag}}'
83 {% endfor %}
84 {% for distro in distributions %}
85 {% if distro.want_qemu %}
86   QEMU_TAG:    'qemu-vm-{{distro.tag}}'
87 {% endif %}
88 {% endfor %}
89
90   UBUNTU_EXEC: "bash .gitlab-ci/ubuntu_install.sh $UBUNTU_CUSTOM_DEBS"
91
92   FREEBSD_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/freebsd/11.2:$FREEBSD_TAG
93   FDO_UPSTREAM_REPO: libinput/libinput
94
95   MESON_BUILDDIR: "build dir"
96   NINJA_ARGS: ''
97   MESON_ARGS: ''
98   MESON_TEST_ARGS: '--no-suite=hardware'
99
100   # udev isn't available/working properly in the containers
101   UDEV_NOT_AVAILABLE: 1
102   GIT_DEPTH: 1
103
104 .policy:
105   retry:
106     max: 2
107     when:
108       - runner_system_failure
109       - stuck_or_timeout_failure
110   # cancel run when a newer version is pushed to the branch
111   interruptible: true
112
113 .default_artifacts:
114   artifacts:
115     name: "meson-logs-$CI_JOB_NAME"
116     when: always
117     expire_in: 1 week
118     paths:
119       - $MESON_BUILDDIR/meson-logs
120     reports:
121       junit: $MESON_BUILDDIR/junit-*.xml
122
123 #################################################################
124 #                                                               #
125 #                          prep stage                           #
126 #                                                               #
127 #################################################################
128
129 # Re-generate the CI script and make sure it's the one currently checked in
130 # If this job fails, re-generate the gitlab-ci.yml script, see
131 # $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
132 #
133 check-ci-script:
134   image: golang:alpine
135   stage: prep
136   before_script:
137     - apk add python3 py-pip git
138     - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
139   script:
140     - ci-fairy generate-template
141     - git diff --exit-code && exit 0 || true
142     - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
143     - exit 1
144
145 #
146 # Verify that commit messages are as expected, signed-off, etc.
147 #
148
149 check-commit:
150   image: golang:alpine
151   stage: prep
152   before_script:
153     - apk add python3 py-pip git
154     - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
155   script:
156     - ci-fairy check-commits --signed-off-by --junit-xml=results.xml
157   except:
158     - master@libinput/libinput
159   variables:
160     GIT_DEPTH: 100
161   artifacts:
162     reports:
163       junit: results.xml
164
165 #
166 # Verify that the merge request has the allow-collaboration checkbox ticked
167 #
168
169 check-merge-request:
170   image: golang:alpine
171   stage: deploy
172   before_script:
173     - apk add python3 py-pip git
174     - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
175   script:
176     - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
177   artifacts:
178     when: on_failure
179     reports:
180       junit: results.xml
181   allow_failure: true
182
183 #
184 # Note: images are rebuilt weekly with a scheduled pipeline with FDO_FORCE_REBUILD set
185 #
186 #
187 {# qemu builds are only done for the latest version of any distribution #}
188 {% for distro in distributions if distro.want_qemu %}
189 {% set version = "{}".format(distro.versions|last()) %}
190 {{distro.name}}:{{version}}@qemu-prep:
191   extends:
192     - .fdo.qemu-build@{{distro.name}}
193     - .policy
194   stage: prep
195   tags:
196     - kvm
197   variables:
198     GIT_STRATEGY: none
199     FDO_DISTRIBUTION_VERSION: {{version}}
200     FDO_DISTRIBUTION_TAG: $QEMU_TAG
201     FDO_DISTRIBUTION_PACKAGES: ${{distro.name.upper()}}_QEMU_RPMS
202   allow_failure: true
203 {% endfor %}
204
205 {% for distro in distributions %}
206 {% for version in distro.versions %}
207 {{distro.name}}:{{version}}@container-prep:
208   extends:
209     - .fdo.container-build@{{distro.name}}
210     - .policy
211   stage: prep
212   variables:
213     GIT_STRATEGY: none
214     FDO_DISTRIBUTION_VERSION: '{{version}}'
215     FDO_DISTRIBUTION_PACKAGES: ${{distro.name.upper()}}_PACKAGES
216     FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
217  {% if version == 'ubuntu'%}
218     FDO_DISTRIBUTION_EXEC: $UBUNTU_EXEC
219  {% endif %}
220
221 {% endfor %}
222 {% endfor %}
223
224
225 # Note that we want to use the latest buildah image, and for that
226 # we use one of the .fdo.container-build@distribution by replacing the
227 # `script`.
228 .freebsd@container-prep:
229   extends:
230     - .policy
231     - .fdo.container-build@fedora
232   stage: prep
233   script:
234     # log in to the registry
235     - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
236
237     # get the full container image name
238     - export IMAGE=freebsd/$FREEBSD_VERSION:$FREEBSD_TAG
239
240     - if [[ x"$FDO_FORCE_REBUILD" != x ]] ; then touch .rebuild; fi
241
242     # pull the latest upstream image if it exists
243     - test -e .rebuild || skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
244                                  docker://$CI_REGISTRY/$FDO_UPSTREAM_REPO/$IMAGE
245                                  docker://$CI_REGISTRY_IMAGE/$IMAGE && exit 0 || true ;
246
247     # check if our image is already in the current registry
248     - test -e .rebuild || skopeo inspect docker://$CI_REGISTRY_IMAGE/$IMAGE > /dev/null && exit 0 || true ;
249
250     - export BUILDAH_RUN="buildah run --isolation chroot"
251     - export BUILDAH_COMMIT="buildah commit --format docker"
252     - buildcntr=$(buildah from --quiet  myfreeweb/freebsd-cross:latest)
253     - $BUILDAH_RUN $buildcntr apk add --no-cache $FREEBSD_BUILD_PKGS
254     - $BUILDAH_RUN $buildcntr pkg -r /freebsd update -f
255     - $BUILDAH_RUN $buildcntr pkg -r /freebsd install -y $FREEBSD_PKGS
256     - buildah config --workingdir /app $buildcntr
257     # tag the current container
258     - $BUILDAH_COMMIT $buildcntr $FREEBSD_CONTAINER_IMAGE
259     # clean up the working container
260     - buildah rm $buildcntr
261
262     # push the container image to the libinput registry
263     - podman push --quiet $FREEBSD_CONTAINER_IMAGE
264     - skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
265         docker://$FREEBSD_CONTAINER_IMAGE
266         docker://$CI_REGISTRY_IMAGE/freebsd/$FREEBSD_VERSION:$CI_JOB_ID
267
268 freebsd:11.2@container-prep:
269   extends:
270     - .freebsd@container-prep
271   variables:
272     GIT_STRATEGY: none
273     FREEBSD_VERSION: "11.2"
274
275
276 #################################################################
277 #                                                               #
278 #                   container clean stage                       #
279 #                 run during the clean stage                    #
280 #                                                               #
281 #################################################################
282
283 #
284 # This stage will look for the container images we currently have in
285 # the registry and will remove any that are not tagged with the provided
286 # $container_image:$tag
287 #
288 .container-clean:
289   stage: container_clean
290   extends:
291     - .policy
292   image: golang:alpine
293   before_script:
294     - apk add python3 py-pip git
295     - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
296   script:
297     # Go to your Profile, Settings, Access Tokens
298     # Create a personal token with 'api' scope, copy the value.
299     # Go to CI/CD, Schedules, schedule a new monthly job (or edit the existing one)
300     # Define a variable of type File named AUTHFILE. Content is that token
301     # value.
302     - ci-fairy -v --authfile $AUTHFILE delete-image
303             --repository $FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION
304             --exclude-tag $FDO_DISTRIBUTION_TAG
305   dependencies: []
306   allow_failure: true
307   only:
308     - schedules
309
310 {% for distro in distributions %}
311 {% for version in distro.versions %}
312 {{distro.name}}:{{version}}@container-clean:
313   extends:
314     - .container-clean
315   variables:
316     GIT_STRATEGY: none
317     {{distro.name.upper()}}_VERSION: '{{version}}'
318     CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/{{distro.name}}/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
319     FDO_DISTRIBUTION_VERSION: '{{version}}'
320     FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
321
322 {% endfor %}
323 {% endfor %}
324
325 freebsd:11.2@container-clean:
326   extends:
327     - .container-clean
328   variables:
329     GIT_STRATEGY: none
330     CURRENT_CONTAINER_IMAGE: $FREEBSD_CONTAINER_IMAGE
331
332 #################################################################
333 #                                                               #
334 #                       build stage                             #
335 #                                                               #
336 #################################################################
337
338 .build@template:
339   extends:
340     - .policy
341     - .default_artifacts
342   stage: build
343   script:
344     - .gitlab-ci/meson-build.sh
345   dependencies: []
346
347 #
348 # Fedora
349 #
350
351 .check_tainted: &check_tainted |
352   # make sure the kernel is not tainted
353   if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
354   then
355     echo tainted kernel ;
356     exit 1 ;
357   fi
358
359 # Run in a test suite. Special variables:
360 # - SUITES: the meson test suites to run, or
361 # - SUITE_NAMES: all elements will be expanded to libinput-test-suite-$value
362 # Set one or the other, not both.
363 .test-suite-vm:
364   extends:
365     - .policy
366     - .fdo.distribution-image@fedora
367   stage: VM
368   tags:
369     - kvm
370   variables:
371     MESON_BUILDDIR: build_dir
372     # remove the global --no-suite=hardware
373     MESON_TEST_ARGS: ''
374   before_script:
375     - if ! [[ -z $SUITE_NAMES ]]; then SUITES=$(echo $SUITE_NAMES | sed 's/\([^ ]*\)/libinput-test-suite-\1/g'); fi
376     - echo "Testing $SUITES"
377   script:
378     # start our vm, no args required
379     - /app/start_vm.sh || (echo "Error - Failed to start the VM." && exit 1)
380
381     - *check_tainted
382
383     - "scp -P 5555 -r $PWD localhost:"
384     - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
385     - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
386     - echo "MESON_ARGS=\"$MESON_ARGS\"" >> sshenv
387     - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
388     - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS $SUITES\"" >> sshenv
389     - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
390     - "scp -P 5555 sshenv localhost:~/$CI_PROJECT_NAME/.meson_environment"
391     - ssh localhost -p 5555 "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
392     # no matter the results of the tests, we want to fetch the logs
393     - scp -P 5555 -r localhost:$CI_PROJECT_NAME/$MESON_BUILDDIR .
394
395     - *check_tainted
396
397     - ssh localhost -p 5555 halt || true
398     - sleep 2
399     - pkill qemu || true
400
401     - if [[ ! -e .success ]] ;
402       then
403         exit 1 ;
404       fi
405   artifacts:
406     name: "qemu-meson-logs-$CI_JOB_NAME"
407     when: always
408     expire_in: 1 week
409     paths:
410       - $MESON_BUILDDIR/meson-logs
411       - console.out
412     reports:
413       junit: $MESON_BUILDDIR/junit-*.xml
414
415   allow_failure: true
416   retry:
417     max: 2
418     when: script_failure
419
420
421 {# qemu tests are only done for the latest version of any distribution #}
422 {% for distro in distributions if distro.want_qemu %}
423 {% set version = "{}".format(distro.versions|last()) %}
424 .{{distro.name}}:{{version}}@test-suite-vm:
425   extends:
426     - .test-suite-vm
427   variables:
428     FDO_DISTRIBUTION_VERSION: {{version}}
429     FDO_DISTRIBUTION_TAG: $QEMU_TAG
430   needs:
431     - "{{distro.name}}:{{version}}@qemu-prep"
432
433
434 {% for suite in test_suites %}
435 vm-{{suite.name}}:
436   extends:
437     - .{{distro.name}}:{{version}}@test-suite-vm
438   variables:
439     SUITE_NAMES: '{{suite.suites}}'
440
441 vm-{{suite.name}}-no-libwacom:
442   extends:
443     - vm-{{suite.name}}
444   variables:
445     MESON_ARGS: '-Dlibwacom=false'
446
447 {% endfor %}
448
449 {% for suite in test_suites %}
450 vm-valgrind-{{suite.name}}:
451   stage: valgrind
452   extends:
453     - vm-{{suite.name}}
454   variables:
455     MESON_TEST_ARGS: '--setup=valgrind'
456
457 {% endfor %}
458 {% endfor %}{# for if distro.want_qemu #}
459
460 {% for distro in distributions if distro.use_for_custom_build_tests %}
461 {% set version = "{}".format(distro.versions|last()) %}
462 .{{distro.name}}-build@template:
463   extends:
464     - .fdo.distribution-image@fedora
465     - .build@template
466   variables:
467     FDO_DISTRIBUTION_VERSION: '{{version}}'
468     FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
469   needs:
470     - "{{distro.name}}:{{version}}@container-prep"
471
472 default-build-release@{{distro.name}}:{{version}}:
473   stage: distro
474   extends:
475     - .{{distro.name}}-build@template
476   variables:
477     MESON_ARGS: "-Dbuildtype=release"
478     CFLAGS: "-Werror"
479
480 scan-build@{{distro.name}}:{{version}}:
481   extends:
482     - .{{distro.name}}-build@template
483   variables:
484     NINJA_ARGS: scan-build
485     MESON_TEST_ARGS: ''
486   before_script:
487     - dnf install -y clang-analyzer findutils
488   after_script:
489     - test ! -d "$MESON_BUILDDIR"/meson-logs/scanbuild && exit 0
490     - test $(find "$MESON_BUILDDIR"/meson-logs/scanbuild -maxdepth 0 ! -empty -exec echo "not empty" \; | wc -l) -eq 0 && exit 0
491     - echo "Check scan-build results"
492     - /bin/false
493
494 # Below jobs are build option combinations. We only
495 # run them on one image, they shouldn't fail on one distro
496 # when they succeed on another.
497
498 build-no-libwacom@{{distro.name}}:{{version}}:
499   extends:
500     - .{{distro.name}}-build@template
501   variables:
502     MESON_ARGS: "-Dlibwacom=false"
503
504 build-no-libwacom-nodeps@{{distro.name}}:{{version}}:
505   extends:
506     - .{{distro.name}}-build@template
507   variables:
508     MESON_ARGS: "-Dlibwacom=false"
509   before_script:
510     - dnf remove -y libwacom libwacom-devel
511
512 build-no-docs@{{distro.name}}:{{version}}:
513   extends:
514     - .{{distro.name}}-build@template
515   variables:
516     MESON_ARGS: "-Ddocumentation=false"
517
518 build-no-docs-nodeps@{{distro.name}}:{{version}}:
519   extends:
520     - .{{distro.name}}-build@template
521   variables:
522     MESON_ARGS: "-Ddocumentation=false"
523   before_script:
524     - dnf remove -y doxygen graphviz
525
526 build-no-debuggui@{{distro.name}}:{{version}}:
527   extends:
528     - .{{distro.name}}-build@template
529   variables:
530     MESON_ARGS: "-Ddebug-gui=false"
531
532 build-no-debuggui-nodeps@{{distro.name}}:{{version}}:
533   extends:
534     - .{{distro.name}}-build@template
535   variables:
536     MESON_ARGS: "-Ddebug-gui=false"
537   before_script:
538     - dnf remove -y gtk3-devel
539
540 build-no-tests@{{distro.name}}:{{version}}:
541   extends:
542     - .{{distro.name}}-build@template
543   variables:
544     MESON_ARGS: "-Dtests=false"
545
546 build-no-tests-nodeps@{{distro.name}}:{{version}}:
547   extends:
548     - .{{distro.name}}-build@template
549   variables:
550     MESON_ARGS: "-Dtests=false"
551   before_script:
552     - dnf remove -y check-devel
553
554 valgrind@{{distro.name}}:{{version}}:
555   extends:
556     - .{{distro.name}}-build@template
557   variables:
558     MESON_TEST_ARGS: '--suite=valgrind --no-suite=hardware --setup=valgrind'
559   before_script:
560     - dnf install -y valgrind
561
562 # Python checks, only run on Fedora
563
564 usr-bin-env-python@{{distro.name}}:{{version}}:
565   extends:
566     - .{{distro.name}}-build@template
567   script:
568     - |
569       if git grep -l '^#!/usr/bin/python'; then
570         echo "Use '/usr/bin/env python3' in the above files";
571         /bin/false
572       fi
573
574 flake8@{{distro.name}}:{{version}}:
575   extends:
576     - .{{distro.name}}-build@template
577   before_script:
578     - dnf install -y python3-flake8
579   script:
580     - flake8-3 --ignore=W501,E501,W504 $(git grep -l '^#!/usr/bin/env python3')
581
582 {% endfor %}
583
584 #
585 # coverity run
586 #
587 # This requires the COVERITY_SCAN_TOKEN. Log into scan.coverity.com and get
588 # the token from the respective project settings page.
589 # Schedule a pipeline and set a variable COVERITY_SCAN_TOKEN with the token value.
590 # https://gitlab.freedesktop.org/$CI_PROJECT_PATH/-/pipeline_schedules
591 # Email from coverity will be sent to the GITLAB_USER_EMAIL that scheduled the
592 # job.
593 #
594 # Coverity ratelimits submissions and the coverity tools download is about
595 # 700M, do not run this too often.
596 #
597 coverity:
598   extends:
599     - .fdo.distribution-image@fedora
600     - .policy
601   stage: build
602   variables:
603     # coverity doesn't work on Fedora 32
604     FDO_DISTRIBUTION_VERSION: '31'
605     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
606     # so git-describe works, or should work
607     GIT_DEPTH: 200
608   only:
609     variables:
610       - $COVERITY_SCAN_TOKEN
611   script:
612     - curl https://scan.coverity.com/download/linux64
613         -o /tmp/cov-analysis-linux64.tgz
614         --form project=$CI_PROJECT_NAME
615         --form token=$COVERITY_SCAN_TOKEN
616     - tar xfz /tmp/cov-analysis-linux64.tgz
617     # coverity has special build options in meson, make sure we enable those
618     - meson coverity-build -Ddocumentation=false -Dcoverity=true
619     - cov-analysis-linux64-*/bin/cov-build --dir cov-int  ninja -C coverity-build
620     - tar cfz cov-int.tar.gz cov-int
621     - curl https://scan.coverity.com/builds?project=$CI_PROJECT_NAME
622         --form token=$COVERITY_SCAN_TOKEN --form email=$GITLAB_USER_EMAIL
623         --form file=@cov-int.tar.gz --form version="$(git describe --tags)"
624         --form description="$(git describe --tags) / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID"
625   artifacts:
626     name: "coverity-submit-data"
627     when: always
628     expire_in: 1 week
629     paths:
630       - cov-int.tar.gz
631   needs:
632     - "fedora:31@container-prep"
633
634 #################################################################
635 #                                                               #
636 #                        distro stage                           #
637 #                                                               #
638 #################################################################
639
640 {% for distro in distributions %}
641 {% for version in distro.versions %}
642 {{distro.name}}:{{version}}@default-build:
643   stage: distro
644   extends:
645     - .build@template
646     - .fdo.distribution-image@{{distro.name}}
647   variables:
648     FDO_DISTRIBUTION_VERSION: '{{version}}'
649     FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
650     {# Where we have extra_variables defined, add them to the list #}
651     {% if distro.build is defined and distro.build.extra_variables is defined %}
652     {% for var in distro.build.extra_variables %}
653     {{var}}
654     {% endfor %}
655     {% endif %}
656   needs:
657     - "{{distro.name}}:{{version}}@container-prep"
658
659
660 {% endfor %}
661 {% endfor %}
662
663 #
664 # FreeBSD
665 #
666 .freebsd@template:
667   stage: distro
668   extends:
669     - .build@template
670   image: $FREEBSD_CONTAINER_IMAGE
671   variables:
672     MESON_ARGS: '--cross-file freebsd -Ddocumentation=false -Dtests=false -Depoll-dir=/freebsd/usr/local/'
673     # Can't run FreeBSD tests on Linux machine, so MESON_TEST_ARGS shouldn't be "test"
674     MESON_TEST_ARGS: ''
675
676 freebsd:11.2@default-build:
677   extends:
678     - .freebsd@template
679   needs:
680     - "freebsd:11.2@container-prep"
681
682 #
683 # deploy
684 #
685
686 build rpm:
687   extends:
688     - .fdo.distribution-image@fedora
689     - .policy
690   stage: deploy
691   variables:
692     FDO_DISTRIBUTION_VERSION: '32'
693     FDO_DISTRIBUTION_TAG: $FEDORA_TAG
694   needs:
695     - "fedora:32@container-prep"
696   script:
697     - dnf install -y rpmdevtools jq
698     - meson "$MESON_BUILDDIR"
699     - VERSION=$(meson introspect "$MESON_BUILDDIR" --projectinfo | jq -r .version)
700     - sed -e "s/@PIPELINEID@/${CI_PIPELINE_ID}/"
701           -e "s/@GITVERSION@/${CI_COMMIT_SHA}/"
702           -e "s/@VERSION@/${VERSION}/" .gitlab-ci/libinput.spec.in > libinput.spec
703     - git config --local user.name 'gitlab CI'
704     - git config --local user.email 'noreply@nowhere'
705     - git add libinput.spec && git commit -m 'Add libinput.spec for build testing' libinput.spec
706     - cd "$MESON_BUILDDIR"
707     - meson dist --no-test
708     - rpmbuild -ta meson-dist/libinput*.tar.xz
709
710
711 wayland-web:
712   stage: deploy
713   trigger: wayland/wayland.freedesktop.org
714   except:
715     refs:
716       - schedules
717   only:
718     refs:
719       - master
720     variables:
721       - $CI_PROJECT_PATH == "libinput/libinput"
722