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