.gitlab-ci.yml 7.04 KB
Newer Older
1 2 3
include:
 - 'https://source.puri.sm/Librem5/librem5-ci/raw/master/librem5-pipeline-definitions.yml'

Guido Gunther's avatar
Guido Gunther committed
4 5
stages:
 - build
Guido Gunther's avatar
Guido Gunther committed
6
 - test+docs
Guido Gunther's avatar
Guido Gunther committed
7 8
 - package

9
variables:
10
  DEPS: build-essential git wget gcovr
11
  EXP_DEPS: libhandy-1-dev/experimental libhandy-1-0/experimental gir1.2-handy-1/experimental
12
  WANT_BUILD_DEPS: "true"
13
  XVFB_RUN: xvfb-run -a -s -noreset
14
  COMMON_BUILD_OPTS: -Db_coverage=true --werror
15
  ALPINE_EDGE_DEPS: alpine-sdk elogind-dev feedbackd-dev gcr-dev git glib-dev gnome-desktop-dev
16 17 18
                    gtk+3.0-dev libhandy1-dev gcr-dev libsecret-dev gcovr linux-pam-dev
                    meson musl-dev networkmanager-dev ninja polkit-elogind-dev pulseaudio-dev
                    upower-dev wayland-dev wayland-protocols
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

.bullseye_vars: &bullseye_vars
  variables:
    DIST: bullseye
    BUILD_OPTS: -Dphoc_tests=enabled -Dgtk_doc=true ${COMMON_BUILD_OPTS}

.build_step: &build_step
  script:
    - git submodule update --recursive
    - 'echo "Build opts: ${BUILD_OPTS}"'
    - meson ${BUILD_OPTS} . _build
    - ninja -C _build

.test_step: &test_step
  script:
    - export LC_ALL=C.UTF-8
    - ${XVFB_RUN} ninja -C _build test
36
    - ninja -C _build coverage
37

38
# For the smoke tests we also want debug packages, phoc,
39 40 41
# weston-info, gdb, valgrind, ...
.smoketest_vars:
  variables: &smoketest_vars
42
    DIST: bullseye
43
    DEPS: phoc wget gnome-session-bin gdb weston valgrind
44
          libhandy-1-0-dbgsym libgtk-3-0-dbgsym libglib2.0-0-dbgsym
45
          dconf-gsettings-backend-dbgsym libfeedback-0.0-0-dbgsym
46
          xvfb imagemagick
47
    EXP_DEPS: libhandy-1-0-dbgsym/experimental-debug libhandy-1-0/experimental
48
    WANT_BUILD_DEPS: "false"
49

50

51
before_script:
52 53
  - export DEBIAN_FRONTEND=noninteractive
  - apt-get -y update
54
  - apt-get -y install wget ca-certificates gnupg eatmydata
55
  - echo "deb http://debug.mirrors.debian.org/debian-debug/ ${DIST}-debug main" > /etc/apt/sources.list.d/debug.list
56 57
  - echo "deb http://debug.mirrors.debian.org/debian-debug/ experimental-debug main" >> /etc/apt/sources.list.d/debug.list
  - echo "deb http://deb.debian.org/debian/ experimental main" > /etc/apt/sources.list.d/exp.list
58
  - eatmydata apt-get -y update
59
  - eatmydata apt-get -y install $EXP_DEPS
60
  - '[ "$WANT_BUILD_DEPS" != "true" ] || eatmydata apt-get -y build-dep .'
61
  - eatmydata apt-get -y install $DEPS
62 63 64
  # Forecully drop lcov so gcovr is used
  # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=987818
  - eatmydata dpkg --force-depends --remove lcov
65
  - ulimit -c unlimited
66

67
.tags: &tags
68 69
  tags:
    - librem5
70

71 72 73 74
build:native-debian-bullseye:
  <<: *tags
  stage: build
  image: debian:bullseye
75 76
  <<: *bullseye_vars
  <<: *build_step
Guido Gunther's avatar
Guido Gunther committed
77 78 79
  artifacts:
    paths:
      - _build
80 81 82
  except:
    variables:
      - $PKG_ONLY == "1"
83

84 85 86 87 88
build:cross-debian-bullseye:i386:
  <<: *tags
  stage: build
  image: debian:bullseye
  allow_failure: true
89 90
  variables:
    EXP_DEPS: libhandy-1-dev:i386/experimental libhandy-1-0:i386/experimental gir1.2-handy-1:i386/experimental
91 92 93
  before_script:
    - export DEBIAN_FRONTEND=noninteractive
    - echo "deb [arch=i386] http://deb.debian.org/debian/ testing main" > /etc/apt/sources.list.d/i386.list
94
    - echo "deb [arch=amd64 arch=i386] http://deb.debian.org/debian/ experimental main" >> /etc/apt/sources.list.d/exp.list
95 96 97 98
    - apt-get -y update
    - apt-get -y install eatmydata
    - dpkg --add-architecture i386
    - eatmydata apt-get -y update
99
    - eatmydata apt-get -y -o APT::Immediate-Configure=false install $EXP_DEPS
100
    - DEB_BUILD_PROFILES=nodoc,nocheck eatmydata apt-get -y -a i386 -o APT::Immediate-Configure=false build-dep .
101 102 103 104 105 106 107 108 109 110 111 112 113 114
    - eatmydata apt-get -y install $DEPS crossbuild-essential-i386
  script:
    - git submodule update --recursive
    - 'echo "Build opts: ${BUILD_OPTS}"'
    - /usr/share/meson/debcrossgen --arch i386 -o cross-i386.txt
    - meson ${BUILD_OPTS} . _build --cross-file cross-i386.txt
    - ninja -C _build
  artifacts:
    paths:
      - _build
  except:
    variables:
      - $PKG_ONLY == "1"

115 116
unit-test:native-debian-bullseye:
  <<: *tags
Guido Gunther's avatar
Guido Gunther committed
117
  stage: test+docs
118
  image: debian:bullseye
119
  needs:
120
    - build:native-debian-bullseye
121 122
  <<: *bullseye_vars
  <<: *test_step
123
  coverage: '/^lines:\s+([\d.]+\%)\s+/'
124 125 126 127
  artifacts:
    when: always
    paths:
      - _build
128 129 130
  except:
    variables:
      - $PKG_ONLY == "1"
131

Guido Gunther's avatar
Guido Gunther committed
132 133 134 135
build-gtkdoc:
  <<: *tags
  image: debian:bullseye
  stage: test+docs
136
  needs:
Guido Gunther's avatar
Guido Gunther committed
137
    - build:native-debian-bullseye
138
  <<: *bullseye_vars
Guido Gunther's avatar
Guido Gunther committed
139
  script:
140
    - tools/doc-check
Guido Gunther's avatar
Guido Gunther committed
141 142 143 144
    - mv _build/docs/html/ _reference/
  artifacts:
    paths:
      - _reference
145 146 147
  except:
    variables:
      - $PKG_ONLY == "1"
Guido Gunther's avatar
Guido Gunther committed
148

149 150
check-po:
  <<: *tags
Guido Gunther's avatar
Guido Gunther committed
151
  stage: test+docs
152
  image: debian:bullseye
153
  needs:
154 155 156 157
    - build:native-debian-bullseye
  before_script:
    - apt-get -y update
    - apt-get -y install intltool
158
  <<: *bullseye_vars
159 160 161 162 163 164
  script:
    # barf on untranslated C files. Seems intltool
    # can't be told to exit with non-zero exit status
    # in this case
    - cd po/
    - intltool-update -m 2>&1 | grep -qs '/.*\.c' && { intltool-update -m; exit 1; } || exit 0
165 166 167
  except:
    variables:
      - $PKG_ONLY == "1"
168

Zander Brown's avatar
Zander Brown committed
169 170 171 172
check-license-headers:
  <<: *tags
  stage: test+docs
  image: debian:bullseye
173
  needs:
Zander Brown's avatar
Zander Brown committed
174 175 176 177 178 179 180 181 182 183
    - build:native-debian-bullseye
  <<: *bullseye_vars
  script:
    # Checks .c and .h files begin with a license header as
    # defined in HACKING.md
    - ./tools/check-license-headers.py
  except:
    variables:
      - $PKG_ONLY == "1"

184 185 186 187 188 189
build:native-alpinelinux-edge:
  <<: *tags
  stage: build
  image: alpine:edge
  allow_failure: true
  before_script:
190
    - echo "https://alpine.global.ssl.fastly.net/alpine/edge/testing" >> /etc/apk/repositories
191
    - apk -q add $ALPINE_EDGE_DEPS
192 193 194 195 196
  artifacts:
    paths:
      - _build
  script:
    - git submodule update --recursive
197
    - meson --werror . _build
198
    - ninja -C _build
199 200 201
  except:
    variables:
      - $PKG_ONLY == "1"
202 203 204

unit-test:native-alpinelinux-edge:
  <<: *tags
Guido Gunther's avatar
Guido Gunther committed
205
  stage: test+docs
206 207
  image: alpine:edge
  allow_failure: true
208
  needs:
209 210
    - build:native-alpinelinux-edge
  before_script:
211
    - echo "https://alpine.global.ssl.fastly.net/alpine/edge/testing" >> /etc/apk/repositories
212
    - apk -q add xvfb-run $ALPINE_EDGE_DEPS
213 214
  script:
    - export LC_ALL=C.UTF-8
215
    - ${XVFB_RUN} ninja -C _build test
216 217 218 219
  artifacts:
    when: always
    paths:
      - _build
220 221 222
  except:
    variables:
      - $PKG_ONLY == "1"
223

224 225
test:smoke:two-outputs:
  <<: *tags
Guido Gunther's avatar
Guido Gunther committed
226
  stage: test+docs
227
  image: debian:bullseye
228
  variables: *smoketest_vars
229
  needs:
230
    - build:native-debian-bullseye
231
  script:
232
    - export OUTDIR=output
233 234
    - export G_DEBUG=fatal-criticals
    - export WLR_X11_OUTPUTS=2
235 236
    - 'echo "SMOKE_PARAMS: $SMOKE_PARAMS"'
    - tests/smoke $SMOKE_PARAMS
237 238 239
  artifacts:
    paths:
      - output/*.log
240
      - output/*.png
241
    when: always
242 243 244
  except:
    variables:
      - $PKG_ONLY == "1"
245

246 247 248 249
package:deb-debian-bullseye:arm64:
  tags:
    - librem5:arm64
  variables:
250
    L5_DOCKER_IMAGE: debian:bullseye
251
    L5_ADD_SCRATCH_CI: 'false'
252 253 254
  before_script:
    - echo "deb http://deb.debian.org/debian/ experimental main" >> /etc/apt/sources.list.d/exp.list
    - apt-get -y update
255
    - apt-get -y install $EXP_DEPS
256
  extends: .l5-build-debian-package
257