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