File: .gitlab-ci.yml

package info (click to toggle)
monado 0.3.0-1~bpo10%2B1
  • links: PTS, VCS
  • area: main
  • in suites: buster-backports
  • size: 7,172 kB
  • sloc: cpp: 56,553; ansic: 51,413; python: 498; sh: 167; xml: 39; makefile: 23
file content (399 lines) | stat: -rw-r--r-- 13,072 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
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: 2018-2020 Collabora, Ltd. and the Monado contributors

variables:
  FDO_UPSTREAM_REPO: monado/monado

.templates_sha: &templates_sha 322bf2b8f29b6491caeb13861201e96969ddc169

.package_only_branch: &package_only_branch master

# Variables listing packages for Debian-based distros
.monado.variables.debian-based-packages:
  variables:
    CORE_REQUIRED_PACKAGES: "build-essential git wget unzip cmake meson ninja-build libeigen3-dev curl patch python3 pkg-config libx11-dev libx11-xcb-dev libxxf86vm-dev libxrandr-dev libxcb-randr0-dev libvulkan-dev glslang-tools libglvnd-dev libgl1-mesa-dev ca-certificates libusb-1.0-0-dev  libudev-dev"
    FEATURE_PACKAGES: "libhidapi-dev libwayland-dev libuvc-dev libavcodec-dev libopencv-dev libv4l-dev libcjson-dev libsdl2-dev libegl1-mesa-dev"
    PACKAGING_PACKAGES: "devscripts debhelper osc osc-plugins-dput dput-ng gettext-base"
    TOOLS_REQUIRED_PACKAGES: "clang-format-7 codespell doxygen graphviz python3-pip python3-click"

# Variables for build and usage of Debian 10 (Buster) image
.monado.variables.debian:buster:
  variables:
    FDO_DISTRIBUTION_VERSION: buster
    FDO_DISTRIBUTION_TAG: "2020-05-11.0"

# Variables for build and usage of Ubuntu 20.04 LTS (Focal) image
.monado.variables.ubuntu:focal:
  variables:
    FDO_DISTRIBUTION_VERSION: "20.04"
    FDO_DISTRIBUTION_TAG: "2020-05-11.1"

# Variables for build and usage of Debian 10 (Buster) + Android NDK image
.monado.variables.debian:buster-ndk:
  variables:
    FDO_DISTRIBUTION_VERSION: buster
    FDO_DISTRIBUTION_TAG: "2020-05-06.0"
    FDO_REPO_SUFFIX: ndk

# Variables for build and usage of Arch Linux image
.monado.variables.arch:rolling:
  variables:
    FDO_DISTRIBUTION_TAG: "2020-05-12.0"

include:
  - project: "freedesktop/ci-templates"
    ref: *templates_sha
    file: "/templates/debian.yml"
  - project: "freedesktop/ci-templates"
    ref: *templates_sha
    file: "/templates/ubuntu.yml"
  - project: "freedesktop/ci-templates"
    ref: *templates_sha
    file: "/templates/arch.yml"

stages:
  - container_prep
  - build
  - package
  - reprepro
  - pages
  - deploy

###
# Container prep jobs

# Base for all container prep
.monado.variables.container-prep-base:
  # "stage" set here doesn't work, for some reason
  variables:
    # no need to pull the whole tree for rebuilding the image - is this still needed?
    GIT_STRATEGY: none
    # Each most-derived container prep job has a script to set up stuff for it.
    FDO_DISTRIBUTION_EXEC: "bash .gitlab-ci/$(echo ${CI_JOB_NAME} | sed 's/:/_/g').sh"

# Debian Buster (x64 + i386)
debian:container_prep:
  stage: container_prep
  extends:
    - .monado.variables.debian:buster
    - .monado.variables.container-prep-base
    - .monado.variables.debian-based-packages
    - .fdo.container-build@debian # from ci-templates
  variables:
    # a list of packages to install - assembled from .monado.variables.debian-based-packages, plus reprepro
    FDO_DISTRIBUTION_PACKAGES: "${CORE_REQUIRED_PACKAGES} ${FEATURE_PACKAGES} ${PACKAGING_PACKAGES} ${TOOLS_REQUIRED_PACKAGES} reprepro"

# Arch Linux (x64)
arch:container_prep:
  stage: container_prep
  extends:
    - .monado.variables.arch:rolling
    - .monado.variables.container-prep-base
    - .fdo.container-build@arch # from ci-templates
  variables:
    # a list of packages to install
    FDO_DISTRIBUTION_PACKAGES: "git gcc clang cmake meson ninja pkgconfig python3 diffutils patch doxygen graphviz eigen hidapi libxrandr mesa glslang vulkan-headers vulkan-icd-loader check glfw-x11 libusb opencv gtk3 ffmpeg v4l-utils qt5-base"

# Ubuntu Focal (x64)
ubuntu:container_prep:
  stage: container_prep
  extends:
    - .monado.variables.ubuntu:focal
    - .monado.variables.container-prep-base
    - .monado.variables.debian-based-packages
    - .fdo.container-build@ubuntu # from ci-templates
  variables:
    # a list of packages to install - assembled from .monado.variables.debian-based-packages
    FDO_DISTRIBUTION_PACKAGES: "${CORE_REQUIRED_PACKAGES} ${FEATURE_PACKAGES} ${PACKAGING_PACKAGES} ${TOOLS_REQUIRED_PACKAGES}"

# Debian Buster + the Android NDK in /opt/android-ndk
# The NDK itself gets installed by .gitlab-ci/ndk:container_prep.sh
ndk:container_prep:
  stage: container_prep
  extends:
    - .monado.variables.debian:buster-ndk
    - .monado.variables.container-prep-base
    - .fdo.container-build@debian # from ci-templates
  variables:
    # Repo suffix is set in .monado.variables.debian:buster-ndk
    # a list of packages to install
    FDO_DISTRIBUTION_PACKAGES: "git wget unzip cmake meson ninja-build libeigen3-dev python3 pkg-config ca-certificates glslang-tools"

# Style check job
format-and-spellcheck:
  extends:
    - .monado.variables.debian:buster
    - .fdo.distribution-image@debian # from ci-templates
  stage: build
  script:
    - scripts/format-and-spellcheck.sh
  artifacts:
    paths:
      - patches/
    expire_in: 1 week
    when: on_failure

# "Base" job for a CMake build
.monado.base-job.build-cmake:
  stage: build
  script:
    - mkdir build
    - pushd build
    - cmake -GNinja .. $CMAKE_ARGS
    # List build options
    - grep "^XRT_" CMakeCache.txt
    - ninja
    - ctest --output-on-failure

# "Base" job for a Meson build
.monado.base-job.build-meson:
  stage: build
  script:
    - mkdir build
    - pushd build
    - meson .. $MESON_ARGS
    - ninja

debian:cmake:
  extends:
    - .monado.variables.debian:buster
    - .fdo.distribution-image@debian # from ci-templates
    - .monado.base-job.build-cmake
  before_script:
    # Generate "changes since last release" and add to changelog,
    # since this is the build that makes our docs.
    - pip3 install proclamation
    - pushd doc/changes
    - proclamation build --overwrite vNEXT
    - popd
  artifacts:
    paths:
      - build/doc/html/

debian:cmake-no-opencv:
  extends:
    - .monado.variables.debian:buster
    - .fdo.distribution-image@debian # from ci-templates
    - .monado.base-job.build-cmake
  variables:
    CMAKE_ARGS: -DXRT_HAVE_OPENCV=OFF

debian:cmake-no-opengl:
  extends:
    - .monado.variables.debian:buster
    - .fdo.distribution-image@debian # from ci-templates
    - .monado.base-job.build-cmake
  variables:
    CMAKE_ARGS: -DXRT_HAVE_OPENGL=OFF

debian:cmake-no-sdl2:
  extends:
    - .monado.variables.debian:buster
    - .fdo.distribution-image@debian # from ci-templates
    - .monado.base-job.build-cmake
  variables:
    CMAKE_ARGS: -DXRT_HAVE_SDL2=OFF

debian:cmake-no-service:
  extends:
    - .monado.variables.debian:buster
    - .fdo.distribution-image@debian # from ci-templates
    - .monado.base-job.build-cmake
  variables:
    CMAKE_ARGS: -DXRT_FEATURE_SERVICE=OFF

arch:cmake:
  extends:
    - .monado.variables.arch:rolling
    - .fdo.distribution-image@arch # from ci-templates
    - .monado.base-job.build-cmake

arch:cmake:clang:
  extends:
    - .monado.variables.arch:rolling
    - .fdo.distribution-image@arch # from ci-templates
    - .monado.base-job.build-cmake
  variables:
    CMAKE_ARGS: -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++

ubuntu:cmake:
  extends:
    - .monado.variables.ubuntu:focal
    - .fdo.distribution-image@ubuntu # from ci-templates
    - .monado.base-job.build-cmake

debian:meson:
  extends:
    - .monado.variables.debian:buster
    - .fdo.distribution-image@debian # from ci-templates
    - .monado.base-job.build-meson

ubuntu:meson:
  extends:
    - .monado.variables.ubuntu:focal
    - .fdo.distribution-image@ubuntu # from ci-templates
    - .monado.base-job.build-meson

arch:meson:
  extends:
    - .monado.variables.arch:rolling
    - .fdo.distribution-image@arch # from ci-templates
    - .monado.base-job.build-meson
  variables:
    MESON_ARGS: -Ddocs=disabled

# Cross-compiling
debian:meson:32bit:
  extends:
    - .monado.variables.debian:buster
    - .fdo.distribution-image@debian # from ci-templates
    - .monado.base-job.build-meson
  variables:
    MESON_ARGS: --prefix /usr --libdir /usr/lib/i386-linux-gnu --cross-file ../.gitlab-ci/i386-cross.txt

debian:cmake:32bit:
  extends:
    - .monado.variables.debian:buster
    - .fdo.distribution-image@debian # from ci-templates
    - .monado.base-job.build-cmake
  variables:
    # OpenCV and local OpenHMD doesn't play nicely with us in multi-arch.
    CMAKE_ARGS: -DCMAKE_TOOLCHAIN_FILE=../.gitlab-ci/i386.cmake -DXRT_HAVE_OPENCV=off -DXRT_BUILD_DRIVER_OHMD=off

# Packaging
.monado.base-job.debuild:
  stage: package
  only:
    - *package_only_branch
  before_script:
    # Configure git - needed despite not actually committing here.
    - git config --global user.email "ryan.pavlik@collabora.com"
    - git config --global user.name "Monado CI"
  script:
    # Prep the source tree
    - git clean -dfx
    - git merge origin/${PACKAGE_BRANCH} --no-commit
    - FULLNAME="Monado CI <ryan.pavlik@collabora.com>" debian/extra/prepare-commit-package.sh ${CI_COMMIT_SHA} 1~${BACKPORT_SUFFIX}~ci$(date --utc "+%Y%m%d")
    # Build the package
    - debuild -uc -us
    # Use dput-ng to move the package-related files into some artifacts.
    - export INCOMING=$(pwd)/incoming
    - mkdir -p $INCOMING
    - mkdir -p ~/.dput.d/profiles
    - cat .gitlab-ci/localhost.json | envsubst  > ~/.dput.d/profiles/localhost.json
    - dpkg-parsechangelog --show-field version > incoming/${DISTRO}.distro
    - dput --debug localhost ../monado_$(dpkg-parsechangelog --show-field version)_amd64.changes
  artifacts:
    paths:
      - "incoming/"
    expire_in: 2 days

debian:buster:package:
  extends:
    - .monado.variables.debian:buster
    - .fdo.distribution-image@debian # from ci-templates
    - .monado.base-job.debuild
  variables:
    BACKPORT_SUFFIX: bpo10
    PACKAGE_BRANCH: debian/buster-backports
    DISTRO: buster

ubuntu:focal:package:
  extends:
    - .monado.variables.ubuntu:focal
    - .fdo.distribution-image@ubuntu # from ci-templates
    - .monado.base-job.debuild
  variables:
    BACKPORT_SUFFIX: ubuntu20.04
    PACKAGE_BRANCH: ubuntu/focal
    DISTRO: focal

reprepro:package:
  stage: reprepro
  only:
    - *package_only_branch
  extends:
    - .monado.variables.debian:buster
    - .fdo.distribution-image@debian # from ci-templates
  dependencies:
    - debian:buster:package
    - ubuntu:focal:package
  before_script:
    # Convince gnupg to work properly in CI
    - mkdir -p ~/.gnupg && chmod 700 ~/.gnupg
    - touch ~/.gnupg/gpg.conf
    - echo 'use-agent' > ~/.gnupg/gpg.conf
    - echo 'pinentry-mode loopback' >> ~/.gnupg/gpg.conf
    - touch ~/.gnupg/gpg-agent.conf
    - echo 'allow-loopback-pinentry' > ~/.gnupg/gpg-agent.conf
    - echo RELOADAGENT | gpg-connect-agent
    - gpg --batch --no-tty --yes --pinentry-mode loopback --passphrase ${MONADO_GPG_PASSPHRASE} --import ${MONADO_GPG_SECRET_KEY}

  script:
    # Use reprepro to create an apt repository in our artifacts
    - mkdir -p repo/conf
    # For each distro, sign the changes file and add it to the repo.
    - |
      for fn in incoming/*.distro; do
        # parse the distro name out
        export DISTRO=$(echo $fn | sed -e 's:incoming/::' -e 's:[.]distro::')
        echo "Processing $DISTRO"
        # add distro to repository config - blank line is mandatory!
        cat .gitlab-ci/distributions | envsubst >> repo/conf/distributions
        echo >> repo/conf/distributions

        echo "Signing package for $DISTRO"
        debsign -k ${MONADO_GPG_FINGERPRINT} -p "gpg --batch --no-tty --yes --pinentry-mode loopback --passphrase ${MONADO_GPG_PASSPHRASE}" incoming/monado_$(cat $fn)_amd64.changes

        echo "Adding package for $DISTRO to the repository"
        reprepro -V --ignore=wrongdistribution -b repo include ${DISTRO} incoming/monado_$(cat $fn)_amd64.changes
      done
  artifacts:
    paths:
      - "repo/"
    expire_in: 2 days

# Base of Android NDK builds.
# Takes the last :-delimited part of the name as the ABI to build for,
# so you don't need to do anything other than "extends" in the job
.monado.ndk:build-base:
  stage: build
  extends:
    - .monado.variables.debian:buster-ndk
    - .fdo.suffixed-image@debian # from ci-templates
  variables:
    ANDROID_PLATFORM: 24
  script:
    - mkdir build
    - pushd build
    # This extracts the ABI from the job name
    - export ABI=$(echo $CI_JOB_NAME | cut --delimiter=":" -f 2)
    # Note we are pointing CMake to the host install of Eigen3 because it's header-only
    # and thus this is safe to do.
    - cmake -GNinja .. -DANDROID_PLATFORM=$ANDROID_PLATFORM -DANDROID_ABI=$ABI -DCMAKE_TOOLCHAIN_FILE=/opt/android-ndk/build/cmake/android.toolchain.cmake -DEigen3_DIR=/usr/lib/cmake/eigen3/
    - grep "^XRT_" CMakeCache.txt
    - ninja

ndk:armeabi-v7a:
  extends: .monado.ndk:build-base

ndk:arm64-v8a:
  extends: .monado.ndk:build-base

###
# Pages
###
pages:
  stage: pages
  only:
    - master
  dependencies:
    - debian:cmake
    - reprepro:package
  script:
    - mkdir -p public
    - mv build/doc/html/* public/
    - mv repo public/apt
  artifacts:
    paths:
      - public