summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: eadda00c9993cc969ae8395c3537c96a5eca4b2a (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
stages:
  - prebuild
  - 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"

.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 |
  if test "$RPM" = "skip"; then
    exit 0
  fi
  pushd .
  cd build
  sed -i -e 's/BuildRequires: *osinfo-db.*//' *.spec*
  $NINJA dist
  rpmbuild --clean --define "_topdir `pwd`/rpmbuild" -ta meson-dist/*.tar.xz
  popd

.libosinfo-mingw-build: &libosinfo-mingw-build |
  pushd .
  mkdir build
  cd build
  meson .. . --cross-file=/usr/share/mingw/toolchain-$CROSS.meson --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: quay.io/libvirt/buildenv-libosinfo-$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: quay.io/libvirt/buildenv-libosinfo-$NAME-cross-$CROSS:latest
  cache:
    paths:
      - ccache
    key: "$CI_JOB_NAME"
  script:
    - *multilib
    - *native-environment
    - *osinfo-db-tools-build
    - *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-7:
  <<: *native-build-job
  variables:
    NAME: centos-7
    RPM: skip

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

debian-9:
  <<: *native-build-job
  variables:
    NAME: debian-9
    RPM: skip

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

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

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

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

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: mingw64

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

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

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