Merge remote-tracking branch 'remotes/cohuck-gitlab/tags/s390x-20210121' into staging
[qemu.git] / .gitlab-ci.yml
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)
4 stages:
5   - containers
6   - containers-layer2
7   - build
8   - test
9
10 include:
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
75 build-system-alpine:
76   <<: *native_build_job_definition
77   variables:
78     IMAGE: alpine
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       - .git-submodule-status
87       - build
88
89 check-system-alpine:
90   <<: *native_test_job_definition
91   needs:
92     - job: build-system-alpine
93       artifacts: true
94   variables:
95     IMAGE: alpine
96     MAKE_CHECK_ARGS: check
97
98 acceptance-system-alpine:
99   <<: *native_test_job_definition
100   needs:
101     - job: build-system-alpine
102       artifacts: true
103   variables:
104     IMAGE: alpine
105     MAKE_CHECK_ARGS: check-acceptance
106   <<: *acceptance_definition
107
108 build-system-ubuntu:
109   <<: *native_build_job_definition
110   variables:
111     IMAGE: ubuntu2004
112     TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
113       moxie-softmmu microblazeel-softmmu mips64el-softmmu
114     MAKE_CHECK_ARGS: check-build
115   artifacts:
116     expire_in: 2 days
117     paths:
118       - build
119
120 check-system-ubuntu:
121   <<: *native_test_job_definition
122   needs:
123     - job: build-system-ubuntu
124       artifacts: true
125   variables:
126     IMAGE: ubuntu2004
127     MAKE_CHECK_ARGS: check
128
129 acceptance-system-ubuntu:
130   <<: *native_test_job_definition
131   needs:
132     - job: build-system-ubuntu
133       artifacts: true
134   variables:
135     IMAGE: ubuntu2004
136     MAKE_CHECK_ARGS: check-acceptance
137   <<: *acceptance_definition
138
139 build-system-debian:
140   <<: *native_build_job_definition
141   variables:
142     IMAGE: debian-amd64
143     TARGETS: arm-softmmu avr-softmmu i386-softmmu mipsel-softmmu
144       riscv64-softmmu sh4eb-softmmu sparc-softmmu xtensaeb-softmmu
145     MAKE_CHECK_ARGS: check-build
146   artifacts:
147     expire_in: 2 days
148     paths:
149       - build
150
151 check-system-debian:
152   <<: *native_test_job_definition
153   needs:
154     - job: build-system-debian
155       artifacts: true
156   variables:
157     IMAGE: debian-amd64
158     MAKE_CHECK_ARGS: check
159
160 # No targets are built here, just tools, docs, and unit tests. This
161 # also feeds into the eventual documentation deployment steps later
162 build-tools-and-docs-debian:
163   <<: *native_build_job_definition
164   variables:
165     IMAGE: debian-amd64
166     MAKE_CHECK_ARGS: check-unit check-softfloat ctags TAGS cscope
167     CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools
168   artifacts:
169     expire_in: 2 days
170     paths:
171       - build
172
173 acceptance-system-debian:
174   <<: *native_test_job_definition
175   needs:
176     - job: build-system-debian
177       artifacts: true
178   variables:
179     IMAGE: debian-amd64
180     MAKE_CHECK_ARGS: check-acceptance
181   <<: *acceptance_definition
182
183 build-system-fedora:
184   <<: *native_build_job_definition
185   variables:
186     IMAGE: fedora
187     CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs
188     TARGETS: tricore-softmmu microblaze-softmmu mips-softmmu
189       xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
190     MAKE_CHECK_ARGS: check-build
191   artifacts:
192     expire_in: 2 days
193     paths:
194       - build
195
196 check-system-fedora:
197   <<: *native_test_job_definition
198   needs:
199     - job: build-system-fedora
200       artifacts: true
201   variables:
202     IMAGE: fedora
203     MAKE_CHECK_ARGS: check
204
205 acceptance-system-fedora:
206   <<: *native_test_job_definition
207   needs:
208     - job: build-system-fedora
209       artifacts: true
210   variables:
211     IMAGE: fedora
212     MAKE_CHECK_ARGS: check-acceptance
213   <<: *acceptance_definition
214
215 build-system-centos:
216   <<: *native_build_job_definition
217   variables:
218     IMAGE: centos8
219     CONFIGURE_ARGS: --disable-nettle --enable-gcrypt
220     TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
221       x86_64-softmmu rx-softmmu sh4-softmmu nios2-softmmu
222     MAKE_CHECK_ARGS: check-build
223   artifacts:
224     expire_in: 2 days
225     paths:
226       - build
227
228 check-system-centos:
229   <<: *native_test_job_definition
230   needs:
231     - job: build-system-centos
232       artifacts: true
233   variables:
234     IMAGE: centos8
235     MAKE_CHECK_ARGS: check
236
237 acceptance-system-centos:
238   <<: *native_test_job_definition
239   needs:
240     - job: build-system-centos
241       artifacts: true
242   variables:
243     IMAGE: centos8
244     MAKE_CHECK_ARGS: check-acceptance
245   <<: *acceptance_definition
246
247 build-system-opensuse:
248   <<: *native_build_job_definition
249   variables:
250     IMAGE: opensuse-leap
251     TARGETS: s390x-softmmu x86_64-softmmu aarch64-softmmu
252     MAKE_CHECK_ARGS: check-build
253   artifacts:
254     expire_in: 2 days
255     paths:
256       - build
257
258 check-system-opensuse:
259   <<: *native_test_job_definition
260   needs:
261     - job: build-system-opensuse
262       artifacts: true
263   variables:
264     IMAGE: opensuse-leap
265     MAKE_CHECK_ARGS: check
266
267 acceptance-system-opensuse:
268    <<: *native_test_job_definition
269    needs:
270      - job: build-system-opensuse
271        artifacts: true
272    variables:
273      IMAGE: opensuse-leap
274      MAKE_CHECK_ARGS: check-acceptance
275    <<: *acceptance_definition
276
277
278 build-disabled:
279   <<: *native_build_job_definition
280   variables:
281     IMAGE: fedora
282     CONFIGURE_ARGS:
283       --disable-attr
284       --disable-auth-pam
285       --disable-avx2
286       --disable-bochs
287       --disable-brlapi
288       --disable-bzip2
289       --disable-cap-ng
290       --disable-capstone
291       --disable-cloop
292       --disable-coroutine-pool
293       --disable-curl
294       --disable-curses
295       --disable-dmg
296       --disable-docs
297       --disable-gcrypt
298       --disable-glusterfs
299       --disable-gnutls
300       --disable-gtk
301       --disable-guest-agent
302       --disable-iconv
303       --disable-keyring
304       --disable-kvm
305       --disable-libiscsi
306       --disable-libpmem
307       --disable-libssh
308       --disable-libudev
309       --disable-libusb
310       --disable-libxml2
311       --disable-linux-aio
312       --disable-live-block-migration
313       --disable-lzo
314       --disable-malloc-trim
315       --disable-mpath
316       --disable-nettle
317       --disable-numa
318       --disable-opengl
319       --disable-parallels
320       --disable-pie
321       --disable-qcow1
322       --disable-qed
323       --disable-qom-cast-debug
324       --disable-rbd
325       --disable-rdma
326       --disable-replication
327       --disable-sdl
328       --disable-seccomp
329       --disable-sheepdog
330       --disable-slirp
331       --disable-smartcard
332       --disable-snappy
333       --disable-sparse
334       --disable-spice
335       --disable-strip
336       --disable-tpm
337       --disable-usb-redir
338       --disable-vdi
339       --disable-vhost-crypto
340       --disable-vhost-net
341       --disable-vhost-scsi
342       --disable-vhost-user
343       --disable-vhost-vdpa
344       --disable-vhost-vsock
345       --disable-virglrenderer
346       --disable-vnc
347       --disable-vte
348       --disable-vvfat
349       --disable-xen
350       --disable-zstd
351     TARGETS: arm-softmmu i386-softmmu ppc64-softmmu mips64-softmmu
352       s390x-softmmu i386-linux-user
353     MAKE_CHECK_ARGS: check-qtest SPEED=slow
354
355 # This jobs explicitly disable TCG (--disable-tcg), KVM is detected by
356 # the configure script. The container doesn't contain Xen headers so
357 # Xen accelerator is not detected / selected. As result it build the
358 # i386-softmmu and x86_64-softmmu with KVM being the single accelerator
359 # available.
360 build-tcg-disabled:
361   <<: *native_build_job_definition
362   variables:
363     IMAGE: centos8
364   script:
365     - mkdir build
366     - cd build
367     - ../configure --disable-tcg --audio-drv-list="" || { cat config.log meson-logs/meson-log.txt && exit 1; }
368     - make -j"$JOBS"
369     - make check-unit
370     - make check-qapi-schema
371     - cd tests/qemu-iotests/
372     - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
373             052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
374             170 171 183 184 192 194 197 208 215 221 222 226 227 236 253 277
375     - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122
376             124 132 139 142 144 145 151 152 155 157 165 194 196 197 200 202
377             208 209 215 216 218 222 227 234 246 247 248 250 254 255 257 258
378             260 261 262 263 264 270 272 273 277 279
379
380 build-user:
381   <<: *native_build_job_definition
382   variables:
383     IMAGE: debian-all-test-cross
384     CONFIGURE_ARGS: --disable-tools --disable-system
385     MAKE_CHECK_ARGS: check-tcg
386
387 build-user-static:
388   <<: *native_build_job_definition
389   variables:
390     IMAGE: debian-all-test-cross
391     CONFIGURE_ARGS: --disable-tools --disable-system --static
392     MAKE_CHECK_ARGS: check-tcg
393
394 # Only build the softmmu targets we have check-tcg tests for
395 build-some-softmmu:
396   <<: *native_build_job_definition
397   variables:
398     IMAGE: debian-all-test-cross
399     CONFIGURE_ARGS: --disable-tools --enable-debug-tcg
400     TARGETS: xtensa-softmmu arm-softmmu aarch64-softmmu alpha-softmmu
401     MAKE_CHECK_ARGS: check-tcg
402
403 # Run check-tcg against linux-user (with plugins)
404 # we skip sparc64-linux-user until it has been fixed somewhat
405 # we skip cris-linux-user as it doesn't use the common run loop
406 build-user-plugins:
407   <<: *native_build_job_definition
408   variables:
409     IMAGE: debian-all-test-cross
410     CONFIGURE_ARGS: --disable-tools --disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user
411     MAKE_CHECK_ARGS: check-tcg
412   timeout: 1h 30m
413
414 build-some-softmmu-plugins:
415   <<: *native_build_job_definition
416   variables:
417     IMAGE: debian-all-test-cross
418     CONFIGURE_ARGS: --disable-tools --disable-user --enable-plugins --enable-debug-tcg
419     TARGETS: xtensa-softmmu arm-softmmu aarch64-softmmu alpha-softmmu
420     MAKE_CHECK_ARGS: check-tcg
421
422 build-clang:
423   <<: *native_build_job_definition
424   variables:
425     IMAGE: fedora
426     CONFIGURE_ARGS: --cc=clang --cxx=clang++
427     TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
428       ppc-softmmu s390x-softmmu arm-linux-user
429     MAKE_CHECK_ARGS: check
430
431 # These targets are on the way out
432 build-deprecated:
433   <<: *native_build_job_definition
434   variables:
435     IMAGE: debian-all-test-cross
436     CONFIGURE_ARGS: --disable-docs --disable-tools
437     MAKE_CHECK_ARGS: build-tcg
438     TARGETS: ppc64abi32-linux-user tilegx-linux-user lm32-softmmu
439       unicore32-softmmu
440   artifacts:
441     expire_in: 2 days
442     paths:
443       - build
444
445 # We split the check-tcg step as test failures are expected but we still
446 # want to catch the build breaking.
447 check-deprecated:
448   <<: *native_test_job_definition
449   needs:
450     - job: build-deprecated
451       artifacts: true
452   variables:
453     IMAGE: debian-all-test-cross
454     MAKE_CHECK_ARGS: check-tcg
455   allow_failure: true
456
457 build-oss-fuzz:
458   <<: *native_build_job_definition
459   variables:
460     IMAGE: fedora
461   script:
462     - mkdir build-oss-fuzz
463     - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
464       ./scripts/oss-fuzz/build.sh
465     - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
466     - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
467                       | grep -v slirp); do
468         grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
469         echo Testing ${fuzzer} ... ;
470         "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
471       done
472     # Unrelated to fuzzer: run some tests with -fsanitize=address
473     - cd build-oss-fuzz && make check-qtest-i386 check-unit
474
475 build-tci:
476   <<: *native_build_job_definition
477   variables:
478     IMAGE: fedora
479   script:
480     - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
481     - mkdir build
482     - cd build
483     - ../configure --enable-tcg-interpreter
484         --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)" || { cat config.log meson-logs/meson-log.txt && exit 1; }
485     - make -j"$JOBS"
486     - make run-tcg-tests-x86_64-softmmu
487     - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
488     - for tg in $TARGETS ; do
489         export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
490         ./tests/qtest/boot-serial-test || exit 1 ;
491         ./tests/qtest/cdrom-test || exit 1 ;
492       done
493     - QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
494     - QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
495
496 # Alternate coroutines implementations are only really of interest to KVM users
497 # However we can't test against KVM on Gitlab-CI so we can only run unit tests
498 build-coroutine-ucontext:
499   <<: *native_build_job_definition
500   variables:
501     IMAGE: ubuntu2004
502     CONFIGURE_ARGS: --with-coroutine=ucontext --disable-tcg
503     MAKE_CHECK_ARGS: check-unit
504
505 build-coroutine-sigaltstack:
506   <<: *native_build_job_definition
507   variables:
508     IMAGE: ubuntu2004
509     CONFIGURE_ARGS: --with-coroutine=sigaltstack --disable-tcg
510     MAKE_CHECK_ARGS: check-unit
511
512 # Most jobs test latest gcrypt or nettle builds
513 #
514 # These jobs test old gcrypt and nettle from RHEL7
515 # which had some API differences.
516 build-crypto-old-nettle:
517   <<: *native_build_job_definition
518   variables:
519     IMAGE: centos7
520     TARGETS: x86_64-softmmu x86_64-linux-user
521     CONFIGURE_ARGS: --disable-gcrypt --enable-nettle
522     MAKE_CHECK_ARGS: check-build
523   artifacts:
524     paths:
525       - build
526
527 check-crypto-old-nettle:
528   <<: *native_test_job_definition
529   needs:
530     - job: build-crypto-old-nettle
531       artifacts: true
532   variables:
533     IMAGE: centos7
534     MAKE_CHECK_ARGS: check
535
536
537 build-crypto-old-gcrypt:
538   <<: *native_build_job_definition
539   variables:
540     IMAGE: centos7
541     TARGETS: x86_64-softmmu x86_64-linux-user
542     CONFIGURE_ARGS: --disable-nettle --enable-gcrypt
543     MAKE_CHECK_ARGS: check-build
544   artifacts:
545     paths:
546       - build
547
548 check-crypto-old-gcrypt:
549   <<: *native_test_job_definition
550   needs:
551     - job: build-crypto-old-gcrypt
552       artifacts: true
553   variables:
554     IMAGE: centos7
555     MAKE_CHECK_ARGS: check
556
557
558 build-crypto-only-gnutls:
559   <<: *native_build_job_definition
560   variables:
561     IMAGE: centos7
562     TARGETS: x86_64-softmmu x86_64-linux-user
563     CONFIGURE_ARGS: --disable-nettle --disable-gcrypt --enable-gnutls
564     MAKE_CHECK_ARGS: check-build
565   artifacts:
566     paths:
567       - build
568
569 check-crypto-only-gnutls:
570   <<: *native_test_job_definition
571   needs:
572     - job: build-crypto-only-gnutls
573       artifacts: true
574   variables:
575     IMAGE: centos7
576     MAKE_CHECK_ARGS: check
577
578 # We don't need to exercise every backend with every front-end
579 build-trace-multi-user:
580   <<: *native_build_job_definition
581   variables:
582     IMAGE: ubuntu2004
583     CONFIGURE_ARGS: --enable-trace-backends=log,simple,syslog --disable-system
584
585 build-trace-ftrace-system:
586   <<: *native_build_job_definition
587   variables:
588     IMAGE: ubuntu2004
589     CONFIGURE_ARGS: --enable-trace-backends=ftrace --target-list=x86_64-softmmu
590
591 build-trace-ust-system:
592   <<: *native_build_job_definition
593   variables:
594     IMAGE: ubuntu2004
595     CONFIGURE_ARGS: --enable-trace-backends=ust --target-list=x86_64-softmmu
596
597 # Check our reduced build configurations
598 build-without-default-devices:
599   <<: *native_build_job_definition
600   variables:
601     IMAGE: centos8
602     CONFIGURE_ARGS: --without-default-devices --disable-user
603
604 build-without-default-features:
605   <<: *native_build_job_definition
606   variables:
607     IMAGE: debian-amd64
608     CONFIGURE_ARGS: --without-default-features --disable-user
609     MAKE_CHECK_ARGS: check-unit
610
611 check-patch:
612   stage: build
613   image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
614   script: .gitlab-ci.d/check-patch.py
615   except:
616     variables:
617       - $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
618   variables:
619     GIT_DEPTH: 1000
620   allow_failure: true
621
622 check-dco:
623   stage: build
624   image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
625   script: .gitlab-ci.d/check-dco.py
626   except:
627     variables:
628       - $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
629   variables:
630     GIT_DEPTH: 1000
631
632 build-libvhost-user:
633   stage: build
634   image: $CI_REGISTRY_IMAGE/qemu/fedora:latest
635   before_script:
636     - dnf install -y meson ninja-build
637   script:
638     - mkdir subprojects/libvhost-user/build
639     - cd subprojects/libvhost-user/build
640     - meson
641     - ninja
642
643 # Prepare for GitLab pages deployment. Anything copied into the
644 # "public" directory will be deployed to $USER.gitlab.io/$PROJECT
645 pages:
646   image: $CI_REGISTRY_IMAGE/qemu/debian-amd64:latest
647   stage: test
648   needs:
649     - job: build-tools-and-docs-debian
650   script:
651     - mkdir -p public
652     # HTML-ised source tree
653     - make gtags
654     - htags -anT --tree-view=filetree -m qemu_init
655         -t "Welcome to the QEMU sourcecode"
656     - mv HTML public/src
657     # Project documentation
658     - make -C build install DESTDIR=$(pwd)/temp-install
659     - mv temp-install/usr/local/share/doc/qemu/* public/
660   artifacts:
661     paths:
662       - public