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