xref: /openbmc/qemu/.gitlab-ci.yml (revision 3b9bd3f4)
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
10include:
11  - local: '/.gitlab-ci.d/edk2.yml'
12  - local: '/.gitlab-ci.d/opensbi.yml'
13  - local: '/.gitlab-ci.d/containers.yml'
14  - local: '/.gitlab-ci.d/crossbuilds.yml'
15
16.native_build_job_template: &native_build_job_definition
17  stage: build
18  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
19  before_script:
20    - JOBS=$(expr $(nproc) + 1)
21    - sed -i s,git.qemu.org/git,gitlab.com/qemu-project, .gitmodules
22  script:
23    - mkdir build
24    - cd build
25    - if test -n "$TARGETS";
26      then
27        ../configure --enable-werror $CONFIGURE_ARGS --target-list="$TARGETS" ;
28      else
29        ../configure --enable-werror $CONFIGURE_ARGS ;
30      fi || { cat config.log meson-logs/meson-log.txt && exit 1; }
31    - make -j"$JOBS"
32    - if test -n "$MAKE_CHECK_ARGS";
33      then
34        make -j"$JOBS" $MAKE_CHECK_ARGS ;
35      fi
36
37.native_test_job_template: &native_test_job_definition
38  stage: test
39  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
40  script:
41    - cd build
42    - find . -type f -exec touch {} +
43    - make $MAKE_CHECK_ARGS
44
45.acceptance_template: &acceptance_definition
46  cache:
47    key: "${CI_JOB_NAME}-cache"
48    paths:
49      - ${CI_PROJECT_DIR}/avocado-cache
50    policy: pull-push
51  artifacts:
52    name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
53    when: always
54    expire_in: 2 days
55    paths:
56      - build/tests/results/latest/results.xml
57      - build/tests/results/latest/test-results
58    reports:
59      junit: build/tests/results/latest/results.xml
60  before_script:
61    - mkdir -p ~/.config/avocado
62    - echo "[datadir.paths]" > ~/.config/avocado/avocado.conf
63    - echo "cache_dirs = ['${CI_PROJECT_DIR}/avocado-cache']"
64           >> ~/.config/avocado/avocado.conf
65    - echo -e '[job.output.testlogs]\nstatuses = ["FAIL"]'
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    - du -chs ${CI_PROJECT_DIR}/avocado-cache
74
75build-system-ubuntu:
76  <<: *native_build_job_definition
77  variables:
78    IMAGE: ubuntu2004
79    TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
80      moxie-softmmu microblazeel-softmmu mips64el-softmmu
81    MAKE_CHECK_ARGS: check-build
82    CONFIGURE_ARGS: --enable-docs
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    CONFIGURE_ARGS: --enable-docs
115  artifacts:
116    expire_in: 2 days
117    paths:
118      - build
119
120check-system-debian:
121  <<: *native_test_job_definition
122  needs:
123    - job: build-system-debian
124      artifacts: true
125  variables:
126    IMAGE: debian-amd64
127    MAKE_CHECK_ARGS: check
128
129acceptance-system-debian:
130  <<: *native_test_job_definition
131  needs:
132    - job: build-system-debian
133      artifacts: true
134  variables:
135    IMAGE: debian-amd64
136    MAKE_CHECK_ARGS: check-acceptance
137  <<: *acceptance_definition
138
139build-system-fedora:
140  <<: *native_build_job_definition
141  variables:
142    IMAGE: fedora
143    CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs
144    TARGETS: tricore-softmmu microblaze-softmmu mips-softmmu
145      xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
146    MAKE_CHECK_ARGS: check-build
147  artifacts:
148    expire_in: 2 days
149    paths:
150      - build
151
152check-system-fedora:
153  <<: *native_test_job_definition
154  needs:
155    - job: build-system-fedora
156      artifacts: true
157  variables:
158    IMAGE: fedora
159    MAKE_CHECK_ARGS: check
160
161acceptance-system-fedora:
162  <<: *native_test_job_definition
163  needs:
164    - job: build-system-fedora
165      artifacts: true
166  variables:
167    IMAGE: fedora
168    MAKE_CHECK_ARGS: check-acceptance
169  <<: *acceptance_definition
170
171build-system-centos:
172  <<: *native_build_job_definition
173  variables:
174    IMAGE: centos8
175    CONFIGURE_ARGS: --disable-nettle --enable-gcrypt
176    TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
177      x86_64-softmmu rx-softmmu sh4-softmmu nios2-softmmu
178    MAKE_CHECK_ARGS: check-build
179  artifacts:
180    expire_in: 2 days
181    paths:
182      - build
183
184check-system-centos:
185  <<: *native_test_job_definition
186  needs:
187    - job: build-system-centos
188      artifacts: true
189  variables:
190    IMAGE: centos8
191    MAKE_CHECK_ARGS: check
192
193acceptance-system-centos:
194  <<: *native_test_job_definition
195  needs:
196    - job: build-system-centos
197      artifacts: true
198  variables:
199    IMAGE: centos8
200    MAKE_CHECK_ARGS: check-acceptance
201  <<: *acceptance_definition
202
203build-disabled:
204  <<: *native_build_job_definition
205  variables:
206    IMAGE: fedora
207    CONFIGURE_ARGS:
208      --disable-attr
209      --disable-auth-pam
210      --disable-avx2
211      --disable-bochs
212      --disable-brlapi
213      --disable-bzip2
214      --disable-cap-ng
215      --disable-capstone
216      --disable-cloop
217      --disable-coroutine-pool
218      --disable-curl
219      --disable-curses
220      --disable-dmg
221      --disable-docs
222      --disable-gcrypt
223      --disable-glusterfs
224      --disable-gnutls
225      --disable-gtk
226      --disable-guest-agent
227      --disable-iconv
228      --disable-keyring
229      --disable-kvm
230      --disable-libiscsi
231      --disable-libpmem
232      --disable-libssh
233      --disable-libudev
234      --disable-libusb
235      --disable-libxml2
236      --disable-linux-aio
237      --disable-live-block-migration
238      --disable-lzo
239      --disable-malloc-trim
240      --disable-mpath
241      --disable-nettle
242      --disable-numa
243      --disable-opengl
244      --disable-parallels
245      --disable-pie
246      --disable-qcow1
247      --disable-qed
248      --disable-qom-cast-debug
249      --disable-rbd
250      --disable-rdma
251      --disable-replication
252      --disable-sdl
253      --disable-seccomp
254      --disable-sheepdog
255      --disable-slirp
256      --disable-smartcard
257      --disable-snappy
258      --disable-sparse
259      --disable-spice
260      --disable-strip
261      --disable-tpm
262      --disable-usb-redir
263      --disable-vdi
264      --disable-vhost-crypto
265      --disable-vhost-net
266      --disable-vhost-scsi
267      --disable-vhost-user
268      --disable-vhost-vdpa
269      --disable-vhost-vsock
270      --disable-virglrenderer
271      --disable-vnc
272      --disable-vte
273      --disable-vvfat
274      --disable-xen
275      --disable-zstd
276    TARGETS: arm-softmmu i386-softmmu ppc64-softmmu mips64-softmmu
277      s390x-softmmu i386-linux-user
278    MAKE_CHECK_ARGS: check-qtest SPEED=slow
279
280# This jobs explicitly disable TCG (--disable-tcg), KVM is detected by
281# the configure script. The container doesn't contain Xen headers so
282# Xen accelerator is not detected / selected. As result it build the
283# i386-softmmu and x86_64-softmmu with KVM being the single accelerator
284# available.
285build-tcg-disabled:
286  <<: *native_build_job_definition
287  variables:
288    IMAGE: centos8
289  script:
290    - mkdir build
291    - cd build
292    - ../configure --disable-tcg --audio-drv-list="" || { cat config.log meson-logs/meson-log.txt && exit 1; }
293    - make -j"$JOBS"
294    - make check-unit
295    - make check-qapi-schema
296    - cd tests/qemu-iotests/
297    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
298            052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
299            170 171 183 184 192 194 197 208 215 221 222 226 227 236 253 277
300    - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122
301            124 132 139 142 144 145 151 152 155 157 165 194 196 197 200 202
302            208 209 215 216 218 222 227 234 246 247 248 250 254 255 257 258
303            260 261 262 263 264 270 272 273 277 279
304
305build-user:
306  <<: *native_build_job_definition
307  variables:
308    IMAGE: debian-all-test-cross
309    CONFIGURE_ARGS: --disable-tools --disable-system
310    MAKE_CHECK_ARGS: check-tcg
311
312build-user-static:
313  <<: *native_build_job_definition
314  variables:
315    IMAGE: debian-all-test-cross
316    CONFIGURE_ARGS: --disable-tools --disable-system --static
317    MAKE_CHECK_ARGS: check-tcg
318
319# Only build the softmmu targets we have check-tcg tests for
320build-some-softmmu:
321  <<: *native_build_job_definition
322  variables:
323    IMAGE: debian-all-test-cross
324    CONFIGURE_ARGS: --disable-tools --enable-debug-tcg
325    TARGETS: xtensa-softmmu arm-softmmu aarch64-softmmu alpha-softmmu
326    MAKE_CHECK_ARGS: check-tcg
327
328# Run check-tcg against linux-user (with plugins)
329# we skip sparc64-linux-user until it has been fixed somewhat
330# we skip cris-linux-user as it doesn't use the common run loop
331build-user-plugins:
332  <<: *native_build_job_definition
333  variables:
334    IMAGE: debian-all-test-cross
335    CONFIGURE_ARGS: --disable-tools --disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user
336    MAKE_CHECK_ARGS: check-tcg
337  timeout: 1h 30m
338
339build-some-softmmu-plugins:
340  <<: *native_build_job_definition
341  variables:
342    IMAGE: debian-all-test-cross
343    CONFIGURE_ARGS: --disable-tools --disable-user --enable-plugins --enable-debug-tcg
344    TARGETS: xtensa-softmmu arm-softmmu aarch64-softmmu alpha-softmmu
345    MAKE_CHECK_ARGS: check-tcg
346
347build-clang:
348  <<: *native_build_job_definition
349  variables:
350    IMAGE: fedora
351    CONFIGURE_ARGS: --cc=clang --cxx=clang++
352    TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
353      ppc-softmmu s390x-softmmu arm-linux-user
354    MAKE_CHECK_ARGS: check
355
356# These targets are on the way out
357build-deprecated:
358  <<: *native_build_job_definition
359  variables:
360    IMAGE: debian-all-test-cross
361    CONFIGURE_ARGS: --disable-docs --disable-tools
362    MAKE_CHECK_ARGS: build-tcg
363    TARGETS: ppc64abi32-linux-user tilegx-linux-user lm32-softmmu
364      unicore32-softmmu
365  artifacts:
366    expire_in: 2 days
367    paths:
368      - build
369
370# We split the check-tcg step as test failures are expected but we still
371# want to catch the build breaking.
372check-deprecated:
373  <<: *native_test_job_definition
374  needs:
375    - job: build-deprecated
376      artifacts: true
377  variables:
378    IMAGE: debian-all-test-cross
379    MAKE_CHECK_ARGS: check-tcg
380  allow_failure: true
381
382build-oss-fuzz:
383  <<: *native_build_job_definition
384  variables:
385    IMAGE: fedora
386  script:
387    - mkdir build-oss-fuzz
388    - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
389      ./scripts/oss-fuzz/build.sh
390    - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
391    - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
392                      | grep -v slirp); do
393        grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
394        echo Testing ${fuzzer} ... ;
395        "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
396      done
397    # Unrelated to fuzzer: run some tests with -fsanitize=address
398    - cd build-oss-fuzz && make check-qtest-i386 check-unit
399
400build-tci:
401  <<: *native_build_job_definition
402  variables:
403    IMAGE: fedora
404  script:
405    - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
406    - mkdir build
407    - cd build
408    - ../configure --enable-tcg-interpreter
409        --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)" || { cat config.log meson-logs/meson-log.txt && exit 1; }
410    - make -j"$JOBS"
411    - make run-tcg-tests-x86_64-softmmu
412    - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
413    - for tg in $TARGETS ; do
414        export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
415        ./tests/qtest/boot-serial-test || exit 1 ;
416        ./tests/qtest/cdrom-test || exit 1 ;
417      done
418    - QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
419    - QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
420
421# Alternate coroutines implementations are only really of interest to KVM users
422# However we can't test against KVM on Gitlab-CI so we can only run unit tests
423build-coroutine-ucontext:
424  <<: *native_build_job_definition
425  variables:
426    IMAGE: ubuntu2004
427    CONFIGURE_ARGS: --with-coroutine=ucontext --disable-tcg
428    MAKE_CHECK_ARGS: check-unit
429
430build-coroutine-sigaltstack:
431  <<: *native_build_job_definition
432  variables:
433    IMAGE: ubuntu2004
434    CONFIGURE_ARGS: --with-coroutine=sigaltstack --disable-tcg
435    MAKE_CHECK_ARGS: check-unit
436
437# Most jobs test latest gcrypt or nettle builds
438#
439# These jobs test old gcrypt and nettle from RHEL7
440# which had some API differences.
441build-crypto-old-nettle:
442  <<: *native_build_job_definition
443  variables:
444    IMAGE: centos7
445    TARGETS: x86_64-softmmu x86_64-linux-user
446    CONFIGURE_ARGS: --disable-gcrypt --enable-nettle
447    MAKE_CHECK_ARGS: check-build
448  artifacts:
449    paths:
450      - build
451
452check-crypto-old-nettle:
453  <<: *native_test_job_definition
454  needs:
455    - job: build-crypto-old-nettle
456      artifacts: true
457  variables:
458    IMAGE: centos7
459    MAKE_CHECK_ARGS: check
460
461
462build-crypto-old-gcrypt:
463  <<: *native_build_job_definition
464  variables:
465    IMAGE: centos7
466    TARGETS: x86_64-softmmu x86_64-linux-user
467    CONFIGURE_ARGS: --disable-nettle --enable-gcrypt
468    MAKE_CHECK_ARGS: check-build
469  artifacts:
470    paths:
471      - build
472
473check-crypto-old-gcrypt:
474  <<: *native_test_job_definition
475  needs:
476    - job: build-crypto-old-gcrypt
477      artifacts: true
478  variables:
479    IMAGE: centos7
480    MAKE_CHECK_ARGS: check
481
482
483build-crypto-only-gnutls:
484  <<: *native_build_job_definition
485  variables:
486    IMAGE: centos7
487    TARGETS: x86_64-softmmu x86_64-linux-user
488    CONFIGURE_ARGS: --disable-nettle --disable-gcrypt --enable-gnutls
489    MAKE_CHECK_ARGS: check-build
490  artifacts:
491    paths:
492      - build
493
494check-crypto-only-gnutls:
495  <<: *native_test_job_definition
496  needs:
497    - job: build-crypto-only-gnutls
498      artifacts: true
499  variables:
500    IMAGE: centos7
501    MAKE_CHECK_ARGS: check
502
503# We don't need to exercise every backend with every front-end
504build-trace-multi-user:
505  <<: *native_build_job_definition
506  variables:
507    IMAGE: ubuntu2004
508    CONFIGURE_ARGS: --enable-trace-backends=log,simple,syslog --disable-system
509
510build-trace-ftrace-system:
511  <<: *native_build_job_definition
512  variables:
513    IMAGE: ubuntu2004
514    CONFIGURE_ARGS: --enable-trace-backends=ftrace --target-list=x86_64-softmmu
515
516build-trace-ust-system:
517  <<: *native_build_job_definition
518  variables:
519    IMAGE: ubuntu2004
520    CONFIGURE_ARGS: --enable-trace-backends=ust --target-list=x86_64-softmmu
521
522# Check our reduced build configurations
523build-without-default-devices:
524  <<: *native_build_job_definition
525  variables:
526    IMAGE: centos8
527    CONFIGURE_ARGS: --without-default-devices --disable-user
528
529build-without-default-features:
530  <<: *native_build_job_definition
531  variables:
532    IMAGE: debian-amd64
533    CONFIGURE_ARGS: --without-default-features --disable-user
534    MAKE_CHECK_ARGS: check-unit
535
536check-patch:
537  stage: build
538  image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
539  script: .gitlab-ci.d/check-patch.py
540  except:
541    variables:
542      - $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
543  variables:
544    GIT_DEPTH: 1000
545  allow_failure: true
546
547check-dco:
548  stage: build
549  image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
550  script: .gitlab-ci.d/check-dco.py
551  except:
552    variables:
553      - $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
554  variables:
555    GIT_DEPTH: 1000
556
557build-libvhost-user:
558  stage: build
559  image: $CI_REGISTRY_IMAGE/qemu/fedora:latest
560  before_script:
561    - dnf install -y meson ninja-build
562  script:
563    - mkdir subprojects/libvhost-user/build
564    - cd subprojects/libvhost-user/build
565    - meson
566    - ninja
567
568pages:
569  image: $CI_REGISTRY_IMAGE/qemu/ubuntu2004:latest
570  stage: test
571  needs:
572    - job: build-system-ubuntu
573      artifacts: true
574  script:
575    - mkdir public
576    - mv build/docs/index.html public/
577    - for i in devel interop specs system tools user ; do mv build/docs/$i public/ ; done
578  artifacts:
579    paths:
580      - public
581