File: ci.template

package info (click to toggle)
libei 1.5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,916 kB
  • sloc: ansic: 23,868; python: 2,712; xml: 1,243; sh: 142; makefile: 68; cpp: 12; lisp: 2
file content (415 lines) | stat: -rw-r--r-- 12,357 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:

{# You're looking at the template here, so you can ignore the below
   warning. This is the right file to edit #}
########################################
#                                      #
# THIS FILE IS GENERATED, DO NOT EDIT  #
#                                      #
########################################

.templates_sha: &template_sha c6aeb16f86e32525fa630fb99c66c4f3e62fc3cb

include:
  - project: 'freedesktop/ci-templates'
    ref: *template_sha
    file:
  {% for distro in distributions|sort(attribute="name") %}
  {% if not distro.does_not_have_ci_templates %}
      - '/templates/{{distro.name}}.yml'
  {% endif %}
  {% endfor %}
      - '/templates/ci-fairy.yml'

stages:
  - prep             # prep work like rebuilding the container images if there is a change
  - build            # for actually building and testing things in a container
  - distro           # distribs test
  - deploy

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never
    - if: $CI_COMMIT_BRANCH

variables:
  ###############################################################################
  # This is the list of packages required to build libei with the default       #
  # configuration.                                                              #
  #                                                                             #
  # Run dnf install/apt-get install/.. with the list of packages for your       #
  # distribution                                                                #
  #                                                                             #
  # See the documentation here:                                                 #
  # https://wayland.freedesktop.org/libinput/doc/latest/building_libinput.html  #
  ###############################################################################
{% for distro in distributions %}
  {{distro.name.upper()}}_PACKAGES: '{% for p in distro.packages %}{{p}} {% endfor %}'
  {{distro.name.upper()}}_PIP_PACKAGES: '{% for p in distro.pips %}{{p}} {% endfor %}'
{% endfor %}
  ############################ end of package lists #############################

  # these tags should be updated each time the list of packages is updated
  # changing these will force rebuilding the associated image
  # Note: these tags have no meaning and are not tied to a particular
  # libinput version
{% for distro in distributions %}
  {{"%-13s"| format(distro.name.upper() + '_TAG:')}}'{{distro.tag}}'
{% endfor %}

  FDO_UPSTREAM_REPO: libinput/libei

  MESON_BUILDDIR: "builddir"
  NINJA_ARGS: ''
  MESON_ARGS: '-Dauto_features=enabled'
  MESON_TEST_ARGS: ''
  GIT_DEPTH: 1

.policy:
  retry:
    max: 2
    when:
      - runner_system_failure
      - stuck_or_timeout_failure
  # cancel run when a newer version is pushed to the branch
  interruptible: true

#################################################################
#                                                               #
#                          prep stage                           #
#                                                               #
#################################################################

fail-if-fork-is-not-public:
  stage: prep
  script:
    - |
      if [ $CI_PROJECT_VISIBILITY != "public" ]; then
           echo "*************************************************************************************"
           echo "Project visibility must be set to 'public'"
           echo "Change this in $CI_PROJECT_URL/edit under 'Visibility, project features, permissions'"
           echo "*************************************************************************************"
           exit 1
      fi
  except:
    - main@libinput/libei

# Re-generate the CI script and make sure it's the one currently checked in
# If this job fails, re-generate the gitlab-ci.yml script, see
# $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
#
check-ci-script:
  extends:
    - .fdo.ci-fairy
  stage: prep
  script:
    - ci-fairy generate-template
    - git diff --exit-code && exit 0 || true
    - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
    - exit 1

#
# Verify that commit messages are as expected, signed-off, etc.
#

check-commit:
  extends:
    - .fdo.ci-fairy
  stage: prep
  script:
    - ci-fairy check-commits --junit-xml=results.xml
  except:
    - main@libinput/libei
  variables:
    GIT_DEPTH: 100
  artifacts:
    reports:
      junit: results.xml

#
# Verify that the merge request has the allow-collaboration checkbox ticked
#

check-merge-request:
  extends:
    - .fdo.ci-fairy
  stage: deploy
  script:
    - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
  artifacts:
    when: on_failure
    reports:
      junit: results.xml
  allow_failure: true

# Format anything python with ruff
#
python-ruff-format:
  extends:
    - .fdo.ci-fairy
  stage: prep
  before_script:
    - python3 -m venv venv
    - source venv/bin/activate
    - pip3 install ruff
  script:
    - ruff format --check --diff . proto/ei-scanner

# Lint with Ruff
#
python-ruff:
  extends:
    - .fdo.ci-fairy
  stage: prep
  before_script:
    - python3 -m venv venv
    - source venv/bin/activate
    - pip3 install ruff
  script:
    - ruff check --ignore E741,E501 . proto/ei-scanner

#
# Build distribution-specific images used by the jobs in the build stage
#

{% for distro in distributions %}
{% for version in distro.versions %}
{{distro.name}}:{{version}}@container-prep:
  extends:
    - .fdo.container-build@{{distro.name}}
    - .policy
  stage: prep
  variables:
    GIT_STRATEGY: none
    FDO_DISTRIBUTION_VERSION: '{{version}}'
    FDO_DISTRIBUTION_PACKAGES: ${{distro.name.upper()}}_PACKAGES
    FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
    FDO_DISTRIBUTION_EXEC: 'pip install ${{distro.name.upper()}}_PIP_PACKAGES'

{% endfor %}
{% endfor %}


#################################################################
#                                                               #
#                       build stage                             #
#                                                               #
#################################################################

.build@template:
  extends:
    - .policy
  stage: build
  script:
    - .gitlab-ci/meson-build.sh --run-test
  artifacts:
    name: "meson-logs-$CI_JOB_NAME"
    when: always
    expire_in: 1 week
    paths:
      - $MESON_BUILDDIR/meson-logs
    reports:
      junit: $MESON_BUILDDIR/meson-logs/.junit.xml
  dependencies: []

#
# Fedora
#

{% for distro in distributions if distro.use_for_custom_build_tests %}
{% set version = "{}".format(distro.versions|last()) %}
.{{distro.name}}-build@template:
  extends:
    - .fdo.distribution-image@{{distro.name}}
    - .build@template
  variables:
    MESON_TEST_ARGS: '--no-suite=python'
    FDO_DISTRIBUTION_VERSION: '{{version}}'
    FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
  needs:
    - "{{distro.name}}:{{version}}@container-prep"

default-build-release@{{distro.name}}:{{version}}:
  stage: distro
  extends:
    - .{{distro.name}}-build@template
  variables:
    MESON_ARGS: "-Dbuildtype=release"
    CFLAGS: "-Werror -Wno-error=vla-parameter"  # munit triggers -Wvla-parameter

build-no-libxkcommon-nodeps@{{distro.name}}:{{version}}:
  extends:
    - .{{distro.name}}-build@template
  before_script:
    - dnf remove -y libxkcommon-devel

build-no-doxygen@{{distro.name}}:{{version}}:
  extends:
    - .{{distro.name}}-build@template
  variables:
    MESON_ARGS: "-Ddocumentation=[]"
  before_script:
    - dnf remove -y doxygen

build-disable-features@{{distro.name}}:{{version}}:
  extends:
    - .{{distro.name}}-build@template
  parallel:
    matrix:
      - FEATURE: libei
      - FEATURE: libeis
      - FEATURE: liboeffis
  variables:
    MESON_ARGS: '-D${FEATURE}=disabled'

valgrind@{{distro.name}}:{{version}}:
  extends:
    - .{{distro.name}}-build@template
  variables:
    MESON_TEST_ARGS: '--setup=valgrind'
  before_script:
    - dnf install -y valgrind

pytest@{{distro.name}}:{{version}}:
  extends:
    - .{{distro.name}}-build@template
  variables:
    MESON_TEST_ARGS: '--suite=python'

werror@{{distro.name}}:{{version}}:
  extends:
    - .{{distro.name}}-build@template
  variables:
    MESON_ARGS: '-Dwerror=true'
  allow_failure: true

abicheck@{{distro.name}}:{{version}}:
  extends:
    - .{{distro.name}}-build@template
  before_script:
    - git clone --depth=1 https://gitlab.freedesktop.org/hadess/check-abi
    - |
      pushd check-abi
      meson setup _build
      meson compile -C _build
      meson install -C _build
      popd
    - pip install attrs  # required by libei 1.0.0
  script:
    - git remote add upstream$CI_JOB_ID https://gitlab.freedesktop.org/$FDO_UPSTREAM_REPO
    - git fetch --tags upstream$CI_JOB_ID
    - check-abi {{last_abi_break}} $CI_COMMIT_SHA
  only:
    - merge_requests

event-type-check@{{distro.name}}:{{version}}:
  extends:
    - .{{distro.name}}-build@template
  script:
    - .gitlab-ci/meson-build.sh --skip-test
    - .gitlab-ci/check-event-values.py
  variables:
    PKG_CONFIG_PATH: $MESON_BUILDDIR/meson-uninstalled
  only:
    - merge_requests

{% endfor %}

{% for distro in distributions if distro.use_for_minimal_meson_test %}
{% set version = "{}".format(distro.versions|last()) %}
.{{distro.name}}-build@template:
  extends:
    - .fdo.distribution-image@{{distro.name}}
    - .build@template
  variables:
    MESON_TEST_ARGS: '--no-suite=python'
    FDO_DISTRIBUTION_VERSION: '{{version}}'
    FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
  needs:
    - "{{distro.name}}:{{version}}@container-prep"

minimum-meson@{{distro.name}}:{{version}}:
  extends:
    - .{{distro.name}}-build@template
  script:
    - pip uninstall -y meson
    - pip install "meson=={{minimum_meson_version}}"
    - .gitlab-ci/meson-build.sh --run-test

{% endfor %}

#################################################################
#                                                               #
#                        distro stage                           #
#                                                               #
#################################################################

{% for distro in distributions %}
{% for version in distro.versions %}
{{distro.name}}:{{version}}@default-build:
  stage: distro
  extends:
    - .build@template
    - .fdo.distribution-image@{{distro.name}}
  variables:
    FDO_DISTRIBUTION_VERSION: '{{version}}'
    FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
    {# Where we have extra_variables defined, add them to the list #}
    {% if distro.build is defined and distro.build.extra_variables is defined %}
    {% for var in distro.build.extra_variables %}
    {{var}}
    {% endfor %}
    {% endif %}
  needs:
    - "{{distro.name}}:{{version}}@container-prep"

{% if distro.name == pages.distro %}
{{distro.name}}:{{version}}@doc-build:
  stage: distro
  extends:
    - .build@template
    - .fdo.distribution-image@{{distro.name}}
  variables:
    FDO_DISTRIBUTION_VERSION: '{{version}}'
    FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
    MESON_ARGS: "-Ddocumentation=protocol,api"
  script:
    # Staying up-to-date with the breakages between hugo and the relearn theme is annoying
    # so let's lock the version for our doc build
    - go install "github.com/gohugoio/hugo@v0.111"
    - export PATH="$HOME/go/bin:$PATH"
    - .gitlab-ci/meson-build.sh
    - rm -rf public/
    - mv "$MESON_BUILDDIR"/doc/protocol/ei/public/ public/
    - mv "$MESON_BUILDDIR"/doc/html/ public/api
  artifacts:
    paths:
      - public
{% endif %}

{% endfor %}
{% endfor %}

pages:
  stage: deploy
  extends:
    - .build@template
    - .fdo.distribution-image@{{pages.distro}}
  variables:
    FDO_DISTRIBUTION_VERSION: '{{pages.version}}'
    FDO_DISTRIBUTION_TAG: ${{pages.distro.upper()}}_TAG
    MESON_ARGS: "-Ddocumentation=protocol,api"
  script:
    - echo "Nothing to do"
  dependencies:
    - "{{pages.distro}}:{{pages.version}}@doc-build"
  needs:
    - "{{pages.distro}}:{{pages.version}}@doc-build"
  only:
    refs:
      - main
  artifacts:
    paths:
      - public