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