summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 71cb9eb372433847832669c894a4c73d9f2ab243 (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
stages:
  - prebuild
  - containers
  - builds

.multilib: &multilib |
  dpkg_architecture=$(which dpkg-architecture 2>/dev/null || true)
  rpm=$(which rpm 2>/dev/null || true)
  if test -x "$dpkg_architecture"; then
    multilib=$(dpkg-architecture -q DEB_TARGET_MULTIARCH);
  elif test -x "$rpm"; then
    multilib=$(rpm --eval '%{_lib}');
  fi

.native-environment: &native-environment |
  export VIRT_PREFIX="$HOME/build/libvirt"
  export PATH="$VIRT_PREFIX/bin:$PATH"
  export C_INCLUDE_PATH="$VIRT_PREFIX/include"
  export LD_LIBRARY_PATH="$VIRT_PREFIX/$multilib"
  export PKG_CONFIG_PATH="$VIRT_PREFIX/$multilib/pkgconfig"
  export XDG_DATA_DIRS="$VIRT_PREFIX/share:/usr/share:/usr/local/share"
  export GI_TYPELIB_PATH="$VIRT_PREFIX/$multilib/girepository-1.0"
  export OSINFO_SYSTEM_DIR="$VIRT_PREFIX/share/osinfo"
  export MAKEFLAGS="-j $(getconf _NPROCESSORS_ONLN)"
  export CCACHE_BASEDIR="$(pwd)"
  export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
  export CCACHE_MAXSIZE="50M"
  export PATH="$CCACHE_WRAPPERSDIR:$PATH"

.mingw-environment: &mingw-environment |
  export VIRT_PREFIX="$VIRT_PREFIX/$ABI/sys-root/mingw"
  export PKG_CONFIG_PATH="$VIRT_PREFIX/lib/pkgconfig"

.container_job_template: &container_job_definition
  image: docker:stable
  stage: containers
  services:
    - name: registry.gitlab.com/libvirt/libvirt-ci/docker-dind:master
      alias: docker
  before_script:
    - export TAG="$CI_REGISTRY_IMAGE/ci-$NAME:latest"
    - export COMMON_TAG="$CI_REGISTRY/libosinfo/libosinfo/ci-$NAME:latest"
    - docker info
    - docker login registry.gitlab.com -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
  script:
    - docker pull "$TAG" || docker pull "$COMMON_TAG" || true
    - docker build --cache-from "$TAG" --cache-from "$COMMON_TAG" --tag "$TAG" -f "ci/containers/ci-$NAME.Dockerfile" ci
    - docker push "$TAG"
  after_script:
    - docker logout

.osinfo-db-tools-build: &osinfo-db-tools-build |
  pushd /tmp/
  git clone https://gitlab.com/libosinfo/osinfo-db-tools.git
  cd osinfo-db-tools
  mkdir build
  cd build
  meson .. . --prefix=$VIRT_PREFIX --werror
  $NINJA install
  popd

.osinfo-db-build: &osinfo-db-build |
  pushd /tmp/
  git clone https://gitlab.com/libosinfo/osinfo-db.git
  cd osinfo-db
  mkdir build
  cd build
  $MAKE -f ../Makefile VPATH=..
  $MAKE -f ../Makefile VPATH=.. check
  $MAKE -f ../Makefile VPATH=.. install OSINFO_DB_TARGET="--system"
  popd

.libosinfo-build: &libosinfo-build |
  pushd .
  mkdir build
  cd build
  meson .. . --prefix=$VIRT_PREFIX --werror
  $NINJA
  $NINJA install
  popd

.libosinfo-check: &libosinfo-check |
  pushd .
  cd build
  $NINJA test
  popd

.libosinfo-rpm: &libosinfo-rpm |
  pushd .
  cd build
  $NINJA dist
  if test -x /usr/bin/rpmbuild && test "$RPM" != "skip"; then
    rpmbuild --nodeps -ta meson-dist/*.tar.xz
  fi
  popd

.libosinfo-mingw-build: &libosinfo-mingw-build |
  pushd .
  mkdir build
  cd build
  meson .. . $MESON_OPTS --prefix=$VIRT_PREFIX -Denable-gtk-doc=false -Denable-tests=false -Denable-introspection=disabled -Denable-vala=disabled --werror
  $NINJA
  $NINJA install
  popd

.native-build-job: &native-build-job
  stage: builds
  image: $CI_REGISTRY_IMAGE/ci-$NAME:latest
  cache:
    paths:
      - ccache
    key: "$CI_JOB_NAME"
  script:
    - *multilib
    - *native-environment
    - *osinfo-db-tools-build
    - *osinfo-db-build
    - *libosinfo-build
    - *libosinfo-check
    - *libosinfo-rpm

.mingw-build-job: &mingw-build-job
  stage: builds
  image: $CI_REGISTRY_IMAGE/ci-$NAME:latest
  cache:
    paths:
      - ccache
    key: "$CI_JOB_NAME"
  script:
    - *multilib
    - *native-environment
    - *osinfo-db-build
    - *mingw-environment
    - *libosinfo-mingw-build

# Check that all commits are signed-off for the DCO.
# Skip on "libosinfo" namespace, since we only need to run
# this test on developer's personal forks from which
# merge requests are submitted
check-dco:
  stage: prebuild
  image: registry.gitlab.com/libvirt/libvirt-ci/check-dco:master
  script:
    - /check-dco libosinfo
  except:
    variables:
      - $CI_PROJECT_NAMESPACE == "libosinfo"


centos-8-container:
  <<: *container_job_definition
  variables:
    NAME: centos-8

centos-stream-container:
  <<: *container_job_definition
  variables:
    NAME: centos-stream

debian-10-container:
  <<: *container_job_definition
  variables:
    NAME: debian-10

debian-sid-container:
  <<: *container_job_definition
  variables:
    NAME: debian-sid

fedora-32-container:
  <<: *container_job_definition
  variables:
    NAME: fedora-32

fedora-33-container:
  <<: *container_job_definition
  variables:
    NAME: fedora-33

fedora-rawhide-container:
  <<: *container_job_definition
  variables:
    NAME: fedora-rawhide

fedora-rawhide-cross-mingw32-container:
  <<: *container_job_definition
  variables:
    NAME: fedora-rawhide-cross-mingw32

fedora-rawhide-cross-mingw64-container:
  <<: *container_job_definition
  variables:
    NAME: fedora-rawhide-cross-mingw64

opensuse-151-container:
  <<: *container_job_definition
  variables:
    NAME: opensuse-151

ubuntu-1804-container:
  <<: *container_job_definition
  variables:
    NAME: ubuntu-1804

ubuntu-2004-container:
  <<: *container_job_definition
  variables:
    NAME: ubuntu-2004


centos-8:
  <<: *native-build-job
  variables:
    NAME: centos-8
    RPM: skip

centos-stream:
  <<: *native-build-job
  variables:
    NAME: centos-stream
    RPM: skip

debian-10:
  <<: *native-build-job
  variables:
    NAME: debian-10

debian-sid:
  <<: *native-build-job
  variables:
    NAME: debian-sid

fedora-32:
  <<: *native-build-job
  variables:
    NAME: fedora-32

fedora-33:
  <<: *native-build-job
  variables:
    NAME: fedora-33

fedora-rawhide:
  <<: *native-build-job
  variables:
    NAME: fedora-rawhide

fedora-rawhide-cross-mingw32:
  <<: *mingw-build-job
  variables:
    NAME: fedora-rawhide-cross-mingw32

fedora-rawhide-cross-mingw64:
  <<: *mingw-build-job
  variables:
    NAME: fedora-rawhide-cross-mingw32

opensuse-151:
  <<: *native-build-job
  variables:
    NAME: opensuse-151
    RPM: skip

ubuntu-1804:
  script:
  <<: *native-build-job
  variables:
    NAME: ubuntu-1804

ubuntu-2004:
  <<: *native-build-job
  variables:
    NAME: ubuntu-2004