summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 5591da74afa533b33eb4d04b822f3d2f711c9757 (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
# Copyright © 2015-2018 Collabora Ltd.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

include:
  - project: 'freedesktop/ci-templates'
    ref: 957024f97e7b0f2cedc9ef29c6970fbeadd9326c
    file:
      - '/templates/debian.yml'
      - '/templates/opensuse.yml'

image: debian:bullseye-slim

stages:
  - 'build docker'
  - build

variables:
  ci_in_docker: "yes"
  ci_local_packages: "yes"
  ci_parallel: "2"
  ci_sudo: "yes"
  ###
  # IMPORTANT
  # These are the version tags for the docker images the CI runs against.
  # If you are hacking on them or need a them to rebuild, its enough
  # to change any part of the string of the image you want.
  ###
  WINDOWS_TAG: "2022-01-07.1"

  UPSTREAM_BRANCH: 'master'
  UPSTREAM_REPO: 'dbus/dbus'
  WINDOWS_AMD64_SUFFIX: 'amd64/windows'
  WINDOWS_IMAGE: "$CI_REGISTRY_IMAGE/$WINDOWS_AMD64_SUFFIX:$WINDOWS_TAG-$UPSTREAM_BRANCH"
  WINDOWS_UPSTREAM_IMAGE: "$CI_REGISTRY/$UPSTREAM_REPO/$WINDOWS_AMD64_SUFFIX:$WINDOWS_TAG-$UPSTREAM_BRANCH"

.debian-vars:
  variables:
    FDO_DISTRIBUTION_VERSION: 'bullseye-slim'
    FDO_DISTRIBUTION_TAG: '2022-04-17' # Bump this version on every ci-install.sh change

.opensuse-vars:
  variables:
    FDO_DISTRIBUTION_VERSION: 'leap'
    FDO_DISTRIBUTION_TAG: '2022-05-14' # Bump this version on every ci-install.sh change

.cmake-common:
  variables:
    # Default to generating JUnit XML output for all CMake jobs.
    # This works fine even for older versions of CMake since the extra arguments
    # to CTest are ignored and a missing JUnit XML file does not fail the build.
    ci_cmake_junit_output: "$CI_PROJECT_DIR/test-results.xml"
    ci_buildsys: "cmake"
  artifacts:
    name: dbus-$CI_JOB_NAME
    when: always
    paths:
      - $CI_PROJECT_DIR/test-results.xml
    reports:
      junit: $CI_PROJECT_DIR/test-results.xml

windows amd64 image:
  stage: "build docker"
  variables:
    # this file needs to be relative to docker/windows/ subdir
    # as it makes life easier in the powershell script
    DOCKERFILE: "tools/docker/windows/Dockerfile"
  timeout: 2h 30m
  tags:
    - windows
    - shell
    - "1809"
  script:
    # We need to pass an array and to resolve the env vars, so we can't use a variable:
    - $DOCKER_BUILD_ARGS = @("--build-arg", "DEFAULT_BRANCH=$UPSTREAM_BRANCH")

    - "& tools/docker/windows/container.ps1 $CI_REGISTRY $CI_REGISTRY_USER $CI_REGISTRY_PASSWORD $WINDOWS_IMAGE $WINDOWS_UPSTREAM_IMAGE $DOCKERFILE"
    - |
      if (!($?)) {
        echo "Failed to build the image"
        Exit 1
      }

.unix-host-build:
  stage: build
  # No need to wait for the Windows Docker image to be built
  needs: []
  cache:
    key: ${CI_JOB_NAME}
    paths:
      - .ccache/
  before_script:
    - ./tools/ci-install.sh
    - mkdir -p .ccache
    - export CCACHE_BASEDIR="$(pwd)"
    - export CCACHE_DIR="$CCACHE_BASEDIR/.ccache"
    # Debian's ccache package creates symlinks here for all supported
    # compilers
    - export PATH="/usr/lib/ccache:$PATH"
  script:
    - chown -R user .
    - runuser -u user ./tools/ci-build.sh

debian image:
  extends:
    - .fdo.container-build@debian
    - .debian-vars
  variables:
    FDO_DISTRIBUTION_EXEC: './tools/ci-install.sh'
  stage: 'build docker'

.debian-build:
  needs: ["debian image"]
  extends:
    - .fdo.distribution-image@debian
    - .debian-vars
    - .unix-host-build
  stage: build

debian autotools production:
  extends: .debian-build
  variables:
    ci_variant: "production"

debian autotools debug:
  extends: .debian-build
  variables:
    ci_variant: "debug"

debian autotools reduced:
  extends: .debian-build
  when: manual
  variables:
    ci_variant: "reduced"

debian autotools legacy:
  extends: .debian-build
  when: manual
  variables:
    ci_variant: "legacy"

debian cmake:
  extends:
    - .cmake-common
    - .debian-build
  when: manual
  variables:
    ci_buildsys: "cmake-dist"

debian mingw32 autotools debug:
  extends: .debian-build
  variables:
    ci_host: "i686-w64-mingw32"
    ci_variant: "debug"

debian mingw32 cmake:
  extends:
    - .cmake-common
    - .debian-build
  when: manual
  variables:
    ci_host: "i686-w64-mingw32"

debian mingw64 autotools:
  extends: .debian-build
  variables:
    ci_host: "x86_64-w64-mingw32"

debian mingw64 cmake debug:
  extends:
    - .cmake-common
    - .debian-build
  when: manual
  variables:
    ci_buildsys: "cmake"
    ci_host: "x86_64-w64-mingw32"
    ci_variant: "debug"

debian buster autotools:
  extends: .debian-build
  when: manual
  image: "debian:buster-slim"

opensuse image:
  extends:
    - .fdo.container-build@opensuse
    - .opensuse-vars
  variables:
    FDO_DISTRIBUTION_EXEC: './tools/ci-install.sh'
  stage: 'build docker'

.suse-build:
  needs: ["opensuse image"]
  extends:
    - .fdo.distribution-image@opensuse
    - .opensuse-vars
    - .unix-host-build
  stage: build

opensuse cmake:
  extends:
    - .cmake-common
    - .suse-build
  variables:
    ci_local_packages: "no"

opensuse mingw32 cmake:
  extends:
    - .cmake-common
    - .suse-build
  when: manual
  variables:
    ci_host: "i686-w64-mingw32"
    ci_local_packages: "no"

opensuse mingw64 cmake debug:
  extends:
    - .cmake-common
    - .suse-build
  variables:
    ci_host: "x86_64-w64-mingw32"
    ci_local_packages: "no"
    ci_variant: "debug"

.ubuntu-build:
  extends: .unix-host-build
  image: "ubuntu:latest"
  variables:
    ci_distro: "ubuntu"

ubuntu jammy autotools:
  extends: .ubuntu-build
  when: manual
  image: "ubuntu:jammy"
  variables:
    ci_suite: "jammy"

.win-build:
  image: $WINDOWS_IMAGE
  stage: build
  tags:
    - 'docker'
    - 'windows'
    - '1809'
  needs:
    - "windows amd64 image"
  timeout: '2h'
  before_script:
    - $ErrorActionPreference = "Stop"
    - $WarningPreference = "Stop"
    - $env:DBUS_TEST_MALLOC_FAILURES = 0
    - $env:PATH += ";C:\bin"

windows msys64 ucrt64 cmake:
  extends: .win-build
  script:
    - $env:MSYSTEM = "UCRT64"
    - $env:CHERE_INVOKING = "1"
    - $env:MSYS2_PATH_TYPE = "inherit"
    - $env:PATH += ";C:\msys64\usr\bin"
    # FIXME: glib from msys2 has issues, disable it for now
    - C:\msys64\usr\bin\bash -lc 'cmake -G \"MinGW Makefiles\" -S . -B build -DDBUS_WITH_GLIB=OFF && cmake --build build --config Release'

windows vs15-64 cmake:
  extends:
    - .cmake-common
    - .win-build
  script:
    - cmake -DCMAKE_PREFIX_PATH=C:/ -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Debug -DDBUS_ENABLE_VERBOSE_MODE=OFF -S . -B build
    - cmake --build build --config Debug
    - cmake --install build --config Debug
    # FIXME: a few tests timeout on gitlab runner for unknown reason
    - cd build ; ctest -C Debug -VV --timeout 1200 -E '(dbus-daemon|monitor)' --output-junit $ci_cmake_junit_output

# vim:set sw=2 sts=2 et: