summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 99a458342d139f7dbe905762e3355eae2e0f9a58 (plain)
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
416
417
418
419
420
421
422
include:
  - remote: "https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/290b79e0e78eab67a83766f4e9691be554fc4afd/templates/ci-fairy.yml"
  - remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/290b79e0e78eab67a83766f4e9691be554fc4afd/templates/alpine.yml'
  - remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/290b79e0e78eab67a83766f4e9691be554fc4afd/templates/fedora.yml'
  - remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/290b79e0e78eab67a83766f4e9691be554fc4afd/templates/ubuntu.yml'

variables:
  MESON_TEST_TIMEOUT_MULTIPLIER: 3
  # These can be used to see verbose log output from the functional-tests.
  # See HACKING.md for more information.
  TRACKER_DEBUG: ""

  # This can be used when debugging test failures that only occur within GitLab CI.
  MESON_TEST_EXTRA_ARGS: ""

stages:
  - review
  - prepare
  - code-review
  - build
  - test
  - analysis
  - website

.check-template: &check
  extends:
    - .fdo.ci-fairy
  artifacts:
    expire_in: 1 week
    paths:
      - check-junit-report.xml
    reports:
      junit: check-junit-report.xml

check-commit-log:
  variables:
    GIT_DEPTH: "100"
  stage: review
  script:
    - if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
      then
        ci-fairy check-commits --junit-xml=check-junit-report.xml ;
      else
        echo "Not a merge request" ;
      fi
  <<: *check

check-merge-request:
  variables:
    GIT_STRATEGY: none
  stage: review
  script:
    - if [[ x"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "x" ]] ;
      then
        ci-fairy check-merge-request --require-allow-collaboration --junit-xml=check-junit-report.xml ;
      else
        echo "Not a merge request" ;
      fi
  <<: *check

.tracker.fedora@common:
  variables:
    BASE_TAG: '2021-08-23.0'
    FDO_UPSTREAM_REPO: GNOME/tracker
    FDO_DISTRIBUTION_PACKAGES: 'clang clang-analyzer gcovr git libasan libubsan python3-gobject python3-pip umockdev-devel xmlto uncrustify patch diffutils cmake python-devel glib2-doc'
    FDO_DISTRIBUTION_EXEC: |
      dnf install -y 'dnf-command(builddep)' &&
      dnf builddep -y tracker tracker-miners --setopt=install_weak_deps=False &&
      dnf clean all &&
      pip3 install beautifulsoup4 mkdocs mkdocs-cinder tap.py meson hotdoc

.tracker.ubuntu@common:
  variables:
    BASE_TAG: '2021-05-15.5'
    FDO_UPSTREAM_REPO: GNOME/tracker
    FDO_DISTRIBUTION_PACKAGES: 'python3-tap umockdev libumockdev-dev upower asciidoc-base git'
    FDO_DISTRIBUTION_EXEC: |
      export DEBIAN_FRONTEND=noninteractive &&
      sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list &&
      apt-get -yq update && apt-get -yq upgrade &&
      apt-get -yq build-dep tracker tracker-miners

.tracker.alpine@common:
  variables:
    BASE_TAG: '2021-05-15.5'
    FDO_UPSTREAM_REPO: GNOME/tracker
    FDO_DISTRIBUTION_PACKAGES: 'alpine-sdk asciidoc bash-completion dbus dbus-dev git glib-dev gobject-introspection-dev gtk-doc icu-dev json-glib-dev libsoup-dev libxml2-dev meson py3-gobject3 py3-setuptools py3-tappy sqlite-dev vala'

.tracker.fedora:34@x86_64:
  extends: .tracker.fedora@common
  variables:
    FDO_DISTRIBUTION_VERSION: 34
    FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"

.tracker.fedora:rawhide@x86_64:
  extends: .tracker.fedora@common
  variables:
    FDO_DISTRIBUTION_VERSION: rawhide
    FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"

.tracker.fedora:34@aarch64:
  extends: .tracker.fedora@common
  variables:
    FDO_DISTRIBUTION_VERSION: 34
    FDO_DISTRIBUTION_TAG: "aarch64-${BASE_TAG}"
  tags:
    - aarch64

.tracker.ubuntu:rolling@x86_64:
  extends: .tracker.ubuntu@common
  variables:
    FDO_DISTRIBUTION_VERSION: rolling
    FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"

.tracker.alpine:edge@x86_64:
  extends: .tracker.alpine@common
  variables:
    FDO_DISTRIBUTION_VERSION: edge
    FDO_DISTRIBUTION_TAG: "x86_64-${BASE_TAG}"

build-fedora-container@x86_64:
  extends:
    - .fdo.container-build@fedora
    - .tracker.fedora:34@x86_64
  stage: prepare
  variables:
    GIT_STRATEGY: none
  needs:
    - check-commit-log
    - check-merge-request

build-fedora-rawhide-container@x86_64:
  extends:
    - .fdo.container-build@fedora
    - .tracker.fedora:rawhide@x86_64
  stage: prepare
  variables:
    GIT_STRATEGY: none
  allow_failure: true
  needs:
    - check-commit-log
    - check-merge-request

build-fedora-container@aarch64:
  extends:
    - .fdo.container-build@fedora
    - .tracker.fedora:34@aarch64
  stage: prepare
  variables:
    GIT_STRATEGY: none
  needs:
    - check-commit-log
    - check-merge-request

build-ubuntu-container@x86_64:
  extends:
    - .fdo.container-build@ubuntu
    - .tracker.ubuntu:rolling@x86_64
  stage: prepare
  variables:
    GIT_STRATEGY: none
  needs:
    - check-commit-log
    - check-merge-request

build-alpine-container@x86_64:
  extends:
    - .fdo.container-build@alpine
    - .tracker.alpine:edge@x86_64
  stage: prepare
  variables:
    GIT_STRATEGY: none
  needs:
    - check-commit-log
    - check-merge-request

check-code-style:
  extends:
    - .fdo.distribution-image@fedora
    - .tracker.fedora:34@x86_64
  needs:
    - build-fedora-container@x86_64
  stage: code-review
  script:
    - git fetch origin master;
      export common_parent_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}") <(git rev-list --first-parent HEAD) | head -1) ;
      python3 -u ./check-style.py --dry-run --sha $common_parent_sha ;
  allow_failure: true

.build-template: &build
  stage: build
  script:
    - meson . build -Ddocs=$([ -z "$NO_DOCS" ] && echo "true" || echo "false") -Db_lto=true -Dsystemd_user_services=false -Dtests_tap_protocol=true --prefix /usr
    - ninja -C build
    - |
      if [ -z "$NO_DOCS" ]; then ninja -C build docs/reference/libtracker-sparql/Tracker-doc; fi
  artifacts:
    expire_in: 1 day
    paths:
      - build

build-fedora@x86_64:
  extends:
    - .fdo.distribution-image@fedora
    - .tracker.fedora:34@x86_64
  needs:
    - build-fedora-container@x86_64
  <<: *build

build-fedora-rawhide@x86_64:
  extends:
    - .fdo.distribution-image@fedora
    - .tracker.fedora:rawhide@x86_64
  needs:
    - build-fedora-rawhide-container@x86_64
  allow_failure: true
  <<: *build

build-fedora@aarch64:
  extends:
    - .fdo.distribution-image@fedora
    - .tracker.fedora:34@aarch64
  needs:
    - build-fedora-container@aarch64
  allow_failure: true
  <<: *build

build-ubuntu-rolling@x86_64:
  extends:
    - .fdo.distribution-image@ubuntu
    - .tracker.ubuntu:rolling@x86_64
  needs:
    - build-ubuntu-container@x86_64
  variables:
    NO_DOCS: "true"
  <<: *build

build-alpine-edge@x86_64:
  extends:
    - .fdo.distribution-image@alpine
    - .tracker.alpine:edge@x86_64
  needs:
    - build-alpine-container@x86_64
  variables:
    NO_DOCS: "true"
  <<: *build

.test-template: &test
  stage: test
  variables:
    G_SLICE: "always-malloc"
    MALLOC_CHECK_: "3"
  script:
    - cd build
    - |
      # Remove the many "CI_" variables from the environment. Meson dumps the
      # whole environment for every failed test, and that gives a whole
      # screenful of junk each time unless we strip these.
      unset $(env|grep -o '^CI_[^=]*')
      env LANG=C.UTF-8 LC_ALL=C.UTF-8 dbus-run-session meson test --print-errorlogs ${MESON_TEST_EXTRA_ARGS}
  after_script:
    - |
      echo "Distribution: "
      echo
      egrep '^NAME=|^VERSION=' /etc/os-release
      echo
      echo "Test suite settings:"
      echo
      echo "G_MESSAGES_DEBUG: ${G_MESSAGES_DEBUG}"
      echo "TRACKER_DEBUG: ${TRACKER_DEBUG}"
      echo "MESON_TEST_EXTRA_ARGS: ${MESON_TEST_EXTRA_ARGS}"
      echo
      echo "These values can be set at https://gitlab.gnome.org/GNOME/tracker/pipelines/new"
  artifacts:
    expire_in: 1 day
    when: always
    paths:
    - build
    reports:
      junit: "build/meson-logs/testlog.junit.xml"

test-fedora@x86_64:
  extends:
    - .fdo.distribution-image@fedora
    - .tracker.fedora:34@x86_64
  needs:
    - build-fedora@x86_64
  <<: *test

test-fedora-rawhide@x86_64:
  extends:
    - .fdo.distribution-image@fedora
    - .tracker.fedora:rawhide@x86_64
  needs:
    - build-fedora-rawhide@x86_64
  allow_failure: true
  <<: *test

test-fedora@aarch64:
  extends:
    - .fdo.distribution-image@fedora
    - .tracker.fedora:34@aarch64
  needs:
    - build-fedora@aarch64
  allow_failure: true
  <<: *test

test-ubuntu@x86_64:
  extends:
    - .fdo.distribution-image@ubuntu
    - .tracker.ubuntu:rolling@x86_64
  needs:
    - build-ubuntu-rolling@x86_64
  <<: *test

test-alpine@x86_64:
  extends:
    - .fdo.distribution-image@alpine
    - .tracker.alpine:edge@x86_64
  needs:
    - build-alpine-edge@x86_64
  <<: *test

test-website:
  extends:
    - .fdo.distribution-image@fedora
    - .tracker.fedora:34@x86_64
  stage: test
  script:
    - export install_prefix="$(pwd)/tracker-install"
    # Build tracker and install.
    - mkdir website-build; pushd website-build; meson .. --prefix="$install_prefix"; ninja; ninja install; popd
    # Build tracker-miners and install any documentation from there as well.
    - .gitlab-ci/checkout-tracker-miners.sh
    - pushd extra/tracker-miners; mkdir build; pushd build; env PKG_CONFIG_PATH="$install_prefix/lib64/pkgconfig" meson .. --prefix="$install_prefix"; ninja install; popd; popd
    # Generate the website using mkdocs.
    - |
      export tracker_commit=$CI_COMMIT_SHA
      export tracker_miners_commit=$(git -C ./extra/tracker-miners rev-parse HEAD)
      ./docs/website/build.py --output=website --api-docs="$install_prefix/share/doc/Tracker/html" --tracker-commit=${tracker_commit} --man-pages ./docs/manpages/*.txt ./extra/tracker-miners/docs/manpages/*.txt
  artifacts:
    paths:
      - website
  needs:
    - build-fedora-container@x86_64

coverage-analysis:
  extends:
    - .fdo.distribution-image@fedora
    - .tracker.fedora:34@x86_64
  stage: analysis
  allow_failure: true
  script:
    - meson build -Db_coverage=true -Ddocs=false -Dsystemd_user_services=false -Dtests_tap_protocol=true --prefix /usr
    - cd build
    - ninja
    - env LANG=C.UTF-8 LC_ALL=C.UTF-8 dbus-run-session meson test --print-errorlogs ${MESON_TEST_EXTRA_ARGS}
    - mkdir -p coveragereport
    - gcovr --html-details --print-summary --root=.. --exclude=../docs/reference --exclude=../tests --exclude=../utils --exclude=../examples --exclude=.*_gresources\.c --exclude=.*enum-types\.c --output coveragereport/index.html
  coverage: '/^lines: (\d+\.\d+\%)/'
  artifacts:
    when: always
    paths:
    - build/coveragereport
  needs:
    - build-fedora-container@x86_64

coverity:
  extends:
    - .fdo.distribution-image@fedora
    - .tracker.fedora:34@x86_64
  stage: analysis
  allow_failure: true
  script:
    - curl https://scan.coverity.com/download/linux64 --data "token=$COVERITY_TOKEN&project=Tracker" --output /tmp/coverity_tool.tgz
    - tar zxf /tmp/coverity_tool.tgz
    - mkdir coverity-build
    - cd coverity-build
    - env CC=clang meson ..
    - ../cov-analysis-linux64-*/bin/cov-build --dir cov-int ninja
    - tar czf cov-int.tar.gz cov-int
    - curl https://scan.coverity.com/builds?project=Tracker
      --form token=$COVERITY_TOKEN --form email=carlosg@gnome.org
      --form file=@cov-int.tar.gz --form version="`git describe --tags`"
      --form description="gitlab CI build"
  needs:
    - build-fedora-container@x86_64
  only:
    - master
  except:
    changes:
      - po/*.po

static-scan:
  extends:
    - .fdo.distribution-image@fedora
    - .tracker.fedora:34@x86_64
  stage: analysis
  needs:
    - build-fedora-container@x86_64
  script:
    - meson --buildtype=debug _scan_build
    - ninja -C _scan_build scan-build
  artifacts:
    paths:
      - _scan_build/meson-logs
  allow_failure: true

pages:
  extends:
    - .fdo.distribution-image@fedora
    - .tracker.fedora:34@x86_64
  stage: website
  script:
    - mv website public
  artifacts:
    paths:
      - public
  needs:
    - test-website
  only:
    - master