xref: /openbmc/qemu/.gitlab-ci.yml (revision 53ba2eee)
1# Currently we have two build stages after our containers are built:
2#  - build (for traditional build and test or first stage build)
3#  - test (for test stages, using build artefacts from a build stage)
4stages:
5  - containers
6  - containers-layer2
7  - build
8  - test
9
10# We assume GitLab has it's own caching set up for RPM/APT repositories so we
11# just take care of avocado assets here.
12cache:
13  paths:
14    - $HOME/avocado/data/cache
15
16include:
17  - local: '/.gitlab-ci.d/edk2.yml'
18  - local: '/.gitlab-ci.d/opensbi.yml'
19  - local: '/.gitlab-ci.d/containers.yml'
20  - local: '/.gitlab-ci.d/crossbuilds.yml'
21
22.native_build_job_template: &native_build_job_definition
23  stage: build
24  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
25  before_script:
26    - JOBS=$(expr $(nproc) + 1)
27    - sed -i s,git.qemu.org/git,gitlab.com/qemu-project, .gitmodules
28  script:
29    - mkdir build
30    - cd build
31    - if test -n "$TARGETS";
32      then
33        ../configure --enable-werror $CONFIGURE_ARGS --target-list="$TARGETS" ;
34      else
35        ../configure --enable-werror $CONFIGURE_ARGS ;
36      fi || { cat config.log meson-logs/meson-log.txt && exit 1; }
37    - make -j"$JOBS"
38    - if test -n "$MAKE_CHECK_ARGS";
39      then
40        make -j"$JOBS" $MAKE_CHECK_ARGS ;
41      fi
42
43.native_test_job_template: &native_test_job_definition
44  stage: test
45  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
46  script:
47    - cd build
48    - find . -type f -exec touch {} +
49    - make $MAKE_CHECK_ARGS
50
51.acceptance_template: &acceptance_definition
52  cache:
53    key: "${CI_JOB_NAME}-cache"
54    paths:
55      - ${CI_PROJECT_DIR}/avocado-cache
56    policy: pull-push
57  artifacts:
58    paths:
59      - build/tests/results/latest/results.xml
60    reports:
61      junit: build/tests/results/latest/results.xml
62  before_script:
63    - mkdir -p ~/.config/avocado
64    - echo "[datadir.paths]" > ~/.config/avocado/avocado.conf
65    - echo "cache_dirs = ['${CI_PROJECT_DIR}/avocado-cache']"
66           >> ~/.config/avocado/avocado.conf
67    - if [ -d ${CI_PROJECT_DIR}/avocado-cache ]; then
68        du -chs ${CI_PROJECT_DIR}/avocado-cache ;
69      fi
70    - export AVOCADO_ALLOW_UNTRUSTED_CODE=1
71  after_script:
72    - cd build
73    - python3 -c 'import json; r = json.load(open("tests/results/latest/results.json")); [print(t["logfile"]) for t in r["tests"] if t["status"] not in ("PASS", "SKIP", "CANCEL")]' | xargs cat
74    - du -chs ${CI_PROJECT_DIR}/avocado-cache
75
76build-system-ubuntu:
77  <<: *native_build_job_definition
78  variables:
79    IMAGE: ubuntu2004
80    TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
81      moxie-softmmu microblazeel-softmmu mips64el-softmmu
82    MAKE_CHECK_ARGS: check-build
83  artifacts:
84    expire_in: 2 days
85    paths:
86      - build
87
88check-system-ubuntu:
89  <<: *native_test_job_definition
90  needs:
91    - job: build-system-ubuntu
92      artifacts: true
93  variables:
94    IMAGE: ubuntu2004
95    MAKE_CHECK_ARGS: check
96
97acceptance-system-ubuntu:
98  <<: *native_test_job_definition
99  needs:
100    - job: build-system-ubuntu
101      artifacts: true
102  variables:
103    IMAGE: ubuntu2004
104    MAKE_CHECK_ARGS: check-acceptance
105  <<: *acceptance_definition
106
107build-system-debian:
108  <<: *native_build_job_definition
109  variables:
110    IMAGE: debian-amd64
111    TARGETS: arm-softmmu avr-softmmu i386-softmmu mipsel-softmmu
112      riscv64-softmmu sh4eb-softmmu sparc-softmmu xtensaeb-softmmu
113    MAKE_CHECK_ARGS: check-build
114  artifacts:
115    expire_in: 2 days
116    paths:
117      - build
118
119check-system-debian:
120  <<: *native_test_job_definition
121  needs:
122    - job: build-system-debian
123      artifacts: true
124  variables:
125    IMAGE: debian-amd64
126    MAKE_CHECK_ARGS: check
127
128acceptance-system-debian:
129  <<: *native_test_job_definition
130  needs:
131    - job: build-system-debian
132      artifacts: true
133  variables:
134    IMAGE: debian-amd64
135    MAKE_CHECK_ARGS: check-acceptance
136  <<: *acceptance_definition
137
138build-system-fedora:
139  <<: *native_build_job_definition
140  variables:
141    IMAGE: fedora
142    CONFIGURE_ARGS: --disable-gcrypt --enable-nettle
143    TARGETS: tricore-softmmu microblaze-softmmu mips-softmmu
144      xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
145    MAKE_CHECK_ARGS: check-build
146  artifacts:
147    expire_in: 2 days
148    paths:
149      - build
150
151check-system-fedora:
152  <<: *native_test_job_definition
153  needs:
154    - job: build-system-fedora
155      artifacts: true
156  variables:
157    IMAGE: fedora
158    MAKE_CHECK_ARGS: check
159
160acceptance-system-fedora:
161  <<: *native_test_job_definition
162  needs:
163    - job: build-system-fedora
164      artifacts: true
165  variables:
166    IMAGE: fedora
167    MAKE_CHECK_ARGS: check-acceptance
168  <<: *acceptance_definition
169
170build-system-centos:
171  <<: *native_build_job_definition
172  variables:
173    IMAGE: centos8
174    CONFIGURE_ARGS: --disable-nettle --enable-gcrypt
175    TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
176      x86_64-softmmu rx-softmmu sh4-softmmu nios2-softmmu
177    MAKE_CHECK_ARGS: check-build
178  artifacts:
179    expire_in: 2 days
180    paths:
181      - build
182
183check-system-centos:
184  <<: *native_test_job_definition
185  needs:
186    - job: build-system-centos
187      artifacts: true
188  variables:
189    IMAGE: centos8
190    MAKE_CHECK_ARGS: check
191
192acceptance-system-centos:
193  <<: *native_test_job_definition
194  needs:
195    - job: build-system-centos
196      artifacts: true
197  variables:
198    IMAGE: centos8
199    MAKE_CHECK_ARGS: check-acceptance
200  <<: *acceptance_definition
201
202build-disabled:
203  <<: *native_build_job_definition
204  variables:
205    IMAGE: fedora
206    CONFIGURE_ARGS: --disable-attr --disable-avx2 --disable-bochs
207      --disable-brlapi --disable-bzip2 --disable-cap-ng --disable-capstone
208      --disable-cloop --disable-coroutine-pool --disable-curl --disable-curses
209      --disable-dmg --disable-docs --disable-glusterfs --disable-gnutls
210      --disable-gtk --disable-guest-agent --disable-iconv --disable-kvm
211      --disable-libiscsi --disable-libpmem --disable-libssh --disable-libusb
212      --disable-libxml2 --disable-linux-aio --disable-live-block-migration
213      --disable-lzo --disable-malloc-trim --disable-mpath --disable-nettle
214      --disable-numa --disable-parallels --disable-pie --disable-qcow1
215      --disable-qed --disable-qom-cast-debug --disable-rbd --disable-rdma
216      --disable-replication --disable-sdl --disable-seccomp --disable-sheepdog
217      --disable-slirp --disable-smartcard --disable-snappy --disable-spice
218      --disable-strip --disable-tpm --disable-usb-redir --disable-vdi
219      --disable-vhost-crypto --disable-vhost-net --disable-vhost-scsi
220      --disable-vhost-user --disable-vhost-vdpa --disable-vhost-vsock
221      --disable-virglrenderer --disable-vnc --disable-vte --disable-vvfat
222      --disable-xen --disable-zstd
223    TARGETS: arm-softmmu i386-softmmu ppc64-softmmu mips64-softmmu
224      s390x-softmmu i386-linux-user
225    MAKE_CHECK_ARGS: check-qtest SPEED=slow
226
227build-tcg-disabled:
228  <<: *native_build_job_definition
229  variables:
230    IMAGE: centos8
231  script:
232    - mkdir build
233    - cd build
234    - ../configure --disable-tcg --audio-drv-list="" || { cat config.log meson-logs/meson-log.txt && exit 1; }
235    - make -j"$JOBS"
236    - make check-unit
237    - make check-qapi-schema
238    - cd tests/qemu-iotests/
239    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
240            052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
241            170 171 183 184 192 194 197 208 215 221 222 226 227 236 253 277
242    - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122
243            124 132 139 142 144 145 151 152 155 157 165 194 196 197 200 202
244            208 209 215 216 218 222 227 234 246 247 248 250 254 255 257 258
245            260 261 262 263 264 270 272 273 277 279
246
247build-user:
248  <<: *native_build_job_definition
249  variables:
250    IMAGE: debian-all-test-cross
251    CONFIGURE_ARGS: --disable-tools --disable-system
252    MAKE_CHECK_ARGS: check-tcg
253
254# Run check-tcg against linux-user (with plugins)
255# we skip sparc64-linux-user until it has been fixed somewhat
256# we skip cris-linux-user as it doesn't use the common run loop
257build-user-plugins:
258  <<: *native_build_job_definition
259  variables:
260    IMAGE: debian-all-test-cross
261    CONFIGURE_ARGS: --disable-tools --disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user
262    MAKE_CHECK_ARGS: check-tcg
263  timeout: 1h 30m
264
265build-clang:
266  <<: *native_build_job_definition
267  variables:
268    IMAGE: fedora
269    CONFIGURE_ARGS: --cc=clang --cxx=clang++
270    TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
271      ppc-softmmu s390x-softmmu arm-linux-user
272    MAKE_CHECK_ARGS: check
273
274# These targets are on the way out
275build-deprecated:
276  <<: *native_build_job_definition
277  variables:
278    IMAGE: debian-all-test-cross
279    CONFIGURE_ARGS: --disable-docs --disable-tools
280    MAKE_CHECK_ARGS: build-tcg
281    TARGETS: ppc64abi32-linux-user tilegx-linux-user lm32-softmmu
282      unicore32-softmmu
283  artifacts:
284    expire_in: 2 days
285    paths:
286      - build
287
288# We split the check-tcg step as test failures are expected but we still
289# want to catch the build breaking.
290check-deprecated:
291  <<: *native_test_job_definition
292  needs:
293    - job: build-deprecated
294      artifacts: true
295  variables:
296    IMAGE: debian-all-test-cross
297    MAKE_CHECK_ARGS: check-tcg
298  allow_failure: true
299
300build-oss-fuzz:
301  <<: *native_build_job_definition
302  variables:
303    IMAGE: fedora
304  script:
305    - mkdir build-oss-fuzz
306    - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
307      ./scripts/oss-fuzz/build.sh
308    - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
309    - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
310                      | grep -v slirp); do
311        grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
312        echo Testing ${fuzzer} ... ;
313        "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
314      done
315    # Unrelated to fuzzer: run some tests with -fsanitize=address
316    - cd build-oss-fuzz && make check-qtest-i386 check-unit
317
318build-tci:
319  <<: *native_build_job_definition
320  variables:
321    IMAGE: fedora
322  script:
323    - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
324    - mkdir build
325    - cd build
326    - ../configure --enable-tcg-interpreter
327        --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)" || { cat config.log meson-logs/meson-log.txt && exit 1; }
328    - make -j"$JOBS"
329    - make run-tcg-tests-x86_64-softmmu
330    - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
331    - for tg in $TARGETS ; do
332        export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
333        ./tests/qtest/boot-serial-test || exit 1 ;
334        ./tests/qtest/cdrom-test || exit 1 ;
335      done
336    - QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
337    - QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
338
339# Most jobs test latest gcrypt or nettle builds
340#
341# These jobs test old gcrypt and nettle from RHEL7
342# which had some API differences.
343build-crypto-old-nettle:
344  <<: *native_build_job_definition
345  variables:
346    IMAGE: centos7
347    TARGETS: x86_64-softmmu x86_64-linux-user
348    CONFIGURE_ARGS: --disable-gcrypt --enable-nettle
349    MAKE_CHECK_ARGS: check-build
350  artifacts:
351    paths:
352      - build
353
354check-crypto-old-nettle:
355  <<: *native_test_job_definition
356  needs:
357    - job: build-crypto-old-nettle
358      artifacts: true
359  variables:
360    IMAGE: centos7
361    MAKE_CHECK_ARGS: check
362
363
364build-crypto-old-gcrypt:
365  <<: *native_build_job_definition
366  variables:
367    IMAGE: centos7
368    TARGETS: x86_64-softmmu x86_64-linux-user
369    CONFIGURE_ARGS: --disable-nettle --enable-gcrypt
370    MAKE_CHECK_ARGS: check-build
371  artifacts:
372    paths:
373      - build
374
375check-crypto-old-gcrypt:
376  <<: *native_test_job_definition
377  needs:
378    - job: build-crypto-old-gcrypt
379      artifacts: true
380  variables:
381    IMAGE: centos7
382    MAKE_CHECK_ARGS: check
383
384
385build-crypto-only-gnutls:
386  <<: *native_build_job_definition
387  variables:
388    IMAGE: centos7
389    TARGETS: x86_64-softmmu x86_64-linux-user
390    CONFIGURE_ARGS: --disable-nettle --disable-gcrypt --enable-gnutls
391    MAKE_CHECK_ARGS: check-build
392  artifacts:
393    paths:
394      - build
395
396check-crypto-only-gnutls:
397  <<: *native_test_job_definition
398  needs:
399    - job: build-crypto-only-gnutls
400      artifacts: true
401  variables:
402    IMAGE: centos7
403    MAKE_CHECK_ARGS: check
404
405
406check-patch:
407  stage: build
408  image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
409  script: .gitlab-ci.d/check-patch.py
410  except:
411    variables:
412      - $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
413  variables:
414    GIT_DEPTH: 1000
415  allow_failure: true
416
417check-dco:
418  stage: build
419  image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
420  script: .gitlab-ci.d/check-dco.py
421  except:
422    variables:
423      - $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
424  variables:
425    GIT_DEPTH: 1000
426