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