xref: /openbmc/qemu/.gitlab-ci.d/buildtest.yml (revision 9f2b8488)
1include:
2  - local: '/.gitlab-ci.d/buildtest-template.yml'
3
4build-system-alpine:
5  extends:
6    - .native_build_job_template
7    - .native_build_artifact_template
8  needs:
9    - job: amd64-alpine-container
10  variables:
11    IMAGE: alpine
12    TARGETS: avr-softmmu loongarch64-softmmu mips64-softmmu mipsel-softmmu
13    MAKE_CHECK_ARGS: check-build
14    CONFIGURE_ARGS: --enable-docs --enable-trace-backends=log,simple,syslog
15
16check-system-alpine:
17  extends: .native_test_job_template
18  needs:
19    - job: build-system-alpine
20      artifacts: true
21  variables:
22    IMAGE: alpine
23    MAKE_CHECK_ARGS: check-unit check-qtest
24
25avocado-system-alpine:
26  extends: .avocado_test_job_template
27  needs:
28    - job: build-system-alpine
29      artifacts: true
30  variables:
31    IMAGE: alpine
32    MAKE_CHECK_ARGS: check-avocado
33    AVOCADO_TAGS: arch:avr arch:loongarch64 arch:mips64 arch:mipsel
34
35build-system-ubuntu:
36  extends:
37    - .native_build_job_template
38    - .native_build_artifact_template
39  needs:
40    job: amd64-ubuntu2204-container
41  variables:
42    IMAGE: ubuntu2204
43    CONFIGURE_ARGS: --enable-docs
44    TARGETS: alpha-softmmu microblazeel-softmmu mips64el-softmmu
45    MAKE_CHECK_ARGS: check-build
46
47check-system-ubuntu:
48  extends: .native_test_job_template
49  needs:
50    - job: build-system-ubuntu
51      artifacts: true
52  variables:
53    IMAGE: ubuntu2204
54    MAKE_CHECK_ARGS: check
55
56avocado-system-ubuntu:
57  extends: .avocado_test_job_template
58  needs:
59    - job: build-system-ubuntu
60      artifacts: true
61  variables:
62    IMAGE: ubuntu2204
63    MAKE_CHECK_ARGS: check-avocado
64    AVOCADO_TAGS: arch:alpha arch:microblazeel arch:mips64el
65
66build-system-debian:
67  extends:
68    - .native_build_job_template
69    - .native_build_artifact_template
70  needs:
71    job: amd64-debian-container
72  variables:
73    IMAGE: debian
74    CONFIGURE_ARGS: --with-coroutine=sigaltstack
75    TARGETS: arm-softmmu i386-softmmu riscv64-softmmu sh4eb-softmmu
76      sparc-softmmu xtensa-softmmu
77    MAKE_CHECK_ARGS: check-build
78
79check-system-debian:
80  extends: .native_test_job_template
81  needs:
82    - job: build-system-debian
83      artifacts: true
84  variables:
85    IMAGE: debian
86    MAKE_CHECK_ARGS: check
87
88avocado-system-debian:
89  extends: .avocado_test_job_template
90  needs:
91    - job: build-system-debian
92      artifacts: true
93  variables:
94    IMAGE: debian
95    MAKE_CHECK_ARGS: check-avocado
96    AVOCADO_TAGS: arch:arm arch:i386 arch:riscv64 arch:sh4 arch:sparc arch:xtensa
97
98crash-test-debian:
99  extends: .native_test_job_template
100  needs:
101    - job: build-system-debian
102      artifacts: true
103  variables:
104    IMAGE: debian
105  script:
106    - cd build
107    - make NINJA=":" check-venv
108    - pyvenv/bin/python3 scripts/device-crash-test -q --tcg-only ./qemu-system-i386
109
110build-system-fedora:
111  extends:
112    - .native_build_job_template
113    - .native_build_artifact_template
114  needs:
115    job: amd64-fedora-container
116  variables:
117    IMAGE: fedora
118    CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs
119    TARGETS: microblaze-softmmu mips-softmmu
120      xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
121    MAKE_CHECK_ARGS: check-build
122
123check-system-fedora:
124  extends: .native_test_job_template
125  needs:
126    - job: build-system-fedora
127      artifacts: true
128  variables:
129    IMAGE: fedora
130    MAKE_CHECK_ARGS: check
131
132avocado-system-fedora:
133  extends: .avocado_test_job_template
134  needs:
135    - job: build-system-fedora
136      artifacts: true
137  variables:
138    IMAGE: fedora
139    MAKE_CHECK_ARGS: check-avocado
140    AVOCADO_TAGS: arch:microblaze arch:mips arch:xtensa arch:m68k
141      arch:riscv32 arch:ppc arch:sparc64
142
143crash-test-fedora:
144  extends: .native_test_job_template
145  needs:
146    - job: build-system-fedora
147      artifacts: true
148  variables:
149    IMAGE: fedora
150  script:
151    - cd build
152    - make NINJA=":" check-venv
153    - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-ppc
154    - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-riscv32
155
156build-system-centos:
157  extends:
158    - .native_build_job_template
159    - .native_build_artifact_template
160  needs:
161    job: amd64-centos9-container
162  variables:
163    IMAGE: centos9
164    CONFIGURE_ARGS: --disable-nettle --enable-gcrypt --enable-vfio-user-server
165      --enable-modules --enable-trace-backends=dtrace --enable-docs
166    TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
167      x86_64-softmmu rx-softmmu sh4-softmmu
168    MAKE_CHECK_ARGS: check-build
169
170# Previous QEMU release. Used for cross-version migration tests.
171build-previous-qemu:
172  extends: .native_build_job_template
173  artifacts:
174    when: on_success
175    expire_in: 2 days
176    paths:
177      - build-previous
178    exclude:
179      - build-previous/**/*.p
180      - build-previous/**/*.a.p
181      - build-previous/**/*.c.o
182      - build-previous/**/*.c.o.d
183  needs:
184    job: amd64-opensuse-leap-container
185  variables:
186    IMAGE: opensuse-leap
187    TARGETS: x86_64-softmmu aarch64-softmmu
188    # Override the default flags as we need more to grab the old version
189    GIT_FETCH_EXTRA_FLAGS: --prune --quiet
190  before_script:
191    - export QEMU_PREV_VERSION="$(sed 's/\([0-9.]*\)\.[0-9]*/v\1.0/' VERSION)"
192    - git remote add upstream https://gitlab.com/qemu-project/qemu
193    - git fetch upstream refs/tags/$QEMU_PREV_VERSION:refs/tags/$QEMU_PREV_VERSION
194    - git checkout $QEMU_PREV_VERSION
195  after_script:
196    - mv build build-previous
197
198.migration-compat-common:
199  extends: .common_test_job_template
200  needs:
201    - job: build-previous-qemu
202    - job: build-system-opensuse
203  # The old QEMU could have bugs unrelated to migration that are
204  # already fixed in the current development branch, so this test
205  # might fail.
206  allow_failure: true
207  variables:
208    IMAGE: opensuse-leap
209    MAKE_CHECK_ARGS: check-build
210  script:
211    # Use the migration-tests from the older QEMU tree. This avoids
212    # testing an old QEMU against new features/tests that it is not
213    # compatible with.
214    - cd build-previous
215    # old to new
216    - QTEST_QEMU_BINARY_SRC=./qemu-system-${TARGET}
217          QTEST_QEMU_BINARY=../build/qemu-system-${TARGET} ./tests/qtest/migration-test
218    # new to old
219    - QTEST_QEMU_BINARY_DST=./qemu-system-${TARGET}
220          QTEST_QEMU_BINARY=../build/qemu-system-${TARGET} ./tests/qtest/migration-test
221
222# This job needs to be disabled until we can have an aarch64 CPU model that
223# will both (1) support both KVM and TCG, and (2) provide a stable ABI.
224# Currently only "-cpu max" can provide (1), however it doesn't guarantee
225# (2).  Mark this test skipped until later.
226migration-compat-aarch64:
227  extends: .migration-compat-common
228  variables:
229    TARGET: aarch64
230    QEMU_JOB_SKIPPED: 1
231
232migration-compat-x86_64:
233  extends: .migration-compat-common
234  variables:
235    TARGET: x86_64
236
237check-system-centos:
238  extends: .native_test_job_template
239  needs:
240    - job: build-system-centos
241      artifacts: true
242  variables:
243    IMAGE: centos9
244    MAKE_CHECK_ARGS: check
245
246avocado-system-centos:
247  extends: .avocado_test_job_template
248  needs:
249    - job: build-system-centos
250      artifacts: true
251  variables:
252    IMAGE: centos9
253    MAKE_CHECK_ARGS: check-avocado
254    AVOCADO_TAGS: arch:ppc64 arch:or1k arch:s390x arch:x86_64 arch:rx
255      arch:sh4
256
257build-system-opensuse:
258  extends:
259    - .native_build_job_template
260    - .native_build_artifact_template
261  needs:
262    job: amd64-opensuse-leap-container
263  variables:
264    IMAGE: opensuse-leap
265    TARGETS: s390x-softmmu x86_64-softmmu aarch64-softmmu
266    MAKE_CHECK_ARGS: check-build
267
268check-system-opensuse:
269  extends: .native_test_job_template
270  needs:
271    - job: build-system-opensuse
272      artifacts: true
273  variables:
274    IMAGE: opensuse-leap
275    MAKE_CHECK_ARGS: check
276
277avocado-system-opensuse:
278  extends: .avocado_test_job_template
279  needs:
280    - job: build-system-opensuse
281      artifacts: true
282  variables:
283    IMAGE: opensuse-leap
284    MAKE_CHECK_ARGS: check-avocado
285    AVOCADO_TAGS: arch:s390x arch:x86_64 arch:aarch64
286
287#
288# Flaky tests. We don't run these by default and they are allow fail
289# but often the CI system is the only way to trigger the failures.
290#
291
292build-system-flaky:
293  extends:
294    - .native_build_job_template
295    - .native_build_artifact_template
296  needs:
297    job: amd64-debian-container
298  variables:
299    IMAGE: debian
300    QEMU_JOB_OPTIONAL: 1
301    TARGETS: aarch64-softmmu arm-softmmu mips64el-softmmu
302      ppc64-softmmu rx-softmmu s390x-softmmu sh4-softmmu x86_64-softmmu
303    MAKE_CHECK_ARGS: check-build
304
305avocado-system-flaky:
306  extends: .avocado_test_job_template
307  needs:
308    - job: build-system-flaky
309      artifacts: true
310  allow_failure: true
311  variables:
312    IMAGE: debian
313    MAKE_CHECK_ARGS: check-avocado
314    QEMU_JOB_OPTIONAL: 1
315    QEMU_TEST_FLAKY_TESTS: 1
316    AVOCADO_TAGS: flaky
317
318# This jobs explicitly disable TCG (--disable-tcg), KVM is detected by
319# the configure script. The container doesn't contain Xen headers so
320# Xen accelerator is not detected / selected. As result it build the
321# i386-softmmu and x86_64-softmmu with KVM being the single accelerator
322# available.
323# Also use a different coroutine implementation (which is only really of
324# interest to KVM users, i.e. with TCG disabled)
325build-tcg-disabled:
326  extends: .native_build_job_template
327  needs:
328    job: amd64-centos9-container
329  variables:
330    IMAGE: centos9
331  script:
332    - mkdir build
333    - cd build
334    - ../configure --disable-tcg --audio-drv-list="" --with-coroutine=ucontext
335                   --disable-docs --disable-sdl --disable-gtk --disable-vnc
336      || { cat config.log meson-logs/meson-log.txt && exit 1; }
337    - make -j"$JOBS"
338    - make check-unit
339    - make check-qapi-schema
340    - cd tests/qemu-iotests/
341    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
342            052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
343            170 171 184 192 194 208 221 226 227 236 253 277 image-fleecing
344    - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122
345            124 132 139 142 144 145 151 152 155 157 165 194 196 200 202
346            208 209 216 218 227 234 246 247 248 250 254 255 257 258
347            260 261 262 263 264 270 272 273 277 279 image-fleecing
348
349build-user:
350  extends: .native_build_job_template
351  needs:
352    job: amd64-debian-user-cross-container
353  variables:
354    IMAGE: debian-all-test-cross
355    CONFIGURE_ARGS: --disable-tools --disable-system
356      --target-list-exclude=alpha-linux-user,sh4-linux-user
357    MAKE_CHECK_ARGS: check-tcg
358
359build-user-static:
360  extends: .native_build_job_template
361  needs:
362    job: amd64-debian-user-cross-container
363  variables:
364    IMAGE: debian-all-test-cross
365    CONFIGURE_ARGS: --disable-tools --disable-system --static
366      --target-list-exclude=alpha-linux-user,sh4-linux-user
367    MAKE_CHECK_ARGS: check-tcg
368
369# targets stuck on older compilers
370build-legacy:
371  extends: .native_build_job_template
372  needs:
373    job: amd64-debian-legacy-cross-container
374  variables:
375    IMAGE: debian-legacy-test-cross
376    TARGETS: alpha-linux-user alpha-softmmu sh4-linux-user
377    CONFIGURE_ARGS: --disable-tools
378    MAKE_CHECK_ARGS: check-tcg
379
380build-user-hexagon:
381  extends: .native_build_job_template
382  needs:
383    job: hexagon-cross-container
384  variables:
385    IMAGE: debian-hexagon-cross
386    TARGETS: hexagon-linux-user
387    CONFIGURE_ARGS: --disable-tools --disable-docs --enable-debug-tcg
388    MAKE_CHECK_ARGS: check-tcg
389
390# Build the softmmu targets we have check-tcg tests and compilers in
391# our omnibus all-test-cross container. Those targets that haven't got
392# Debian cross compiler support need to use special containers.
393build-some-softmmu:
394  extends: .native_build_job_template
395  needs:
396    job: amd64-debian-user-cross-container
397  variables:
398    IMAGE: debian-all-test-cross
399    CONFIGURE_ARGS: --disable-tools --enable-debug
400    TARGETS: arm-softmmu aarch64-softmmu i386-softmmu riscv64-softmmu
401      s390x-softmmu x86_64-softmmu
402    MAKE_CHECK_ARGS: check-tcg
403
404build-loongarch64:
405  extends: .native_build_job_template
406  needs:
407    job: loongarch-debian-cross-container
408  variables:
409    IMAGE: debian-loongarch-cross
410    CONFIGURE_ARGS: --disable-tools --enable-debug
411    TARGETS: loongarch64-linux-user loongarch64-softmmu
412    MAKE_CHECK_ARGS: check-tcg
413
414# We build tricore in a very minimal tricore only container
415build-tricore-softmmu:
416  extends: .native_build_job_template
417  needs:
418    job: tricore-debian-cross-container
419  variables:
420    IMAGE: debian-tricore-cross
421    CONFIGURE_ARGS: --disable-tools --disable-fdt --enable-debug
422    TARGETS: tricore-softmmu
423    MAKE_CHECK_ARGS: check-tcg
424
425clang-system:
426  extends: .native_build_job_template
427  needs:
428    job: amd64-fedora-container
429  variables:
430    IMAGE: fedora
431    CONFIGURE_ARGS: --cc=clang --cxx=clang++
432      --extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
433      --extra-cflags=-fno-sanitize=function
434    TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu s390x-softmmu
435    MAKE_CHECK_ARGS: check-qtest check-tcg
436
437clang-user:
438  extends: .native_build_job_template
439  needs:
440    job: amd64-debian-user-cross-container
441  timeout: 70m
442  variables:
443    IMAGE: debian-all-test-cross
444    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --disable-system
445      --target-list-exclude=alpha-linux-user,microblazeel-linux-user,aarch64_be-linux-user,i386-linux-user,m68k-linux-user,mipsn32el-linux-user,xtensaeb-linux-user
446      --extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
447    MAKE_CHECK_ARGS: check-unit check-tcg
448
449# Set LD_JOBS=1 because this requires LTO and ld consumes a large amount of memory.
450# On gitlab runners, default value sometimes end up calling 2 lds concurrently and
451# triggers an Out-Of-Memory error
452#
453# Since slirp callbacks are used in QEMU Timers, we cannot use libslirp with
454# CFI builds, and thus have to disable it here.
455#
456# Split in three sets of build/check/avocado to limit the execution time of each
457# job
458build-cfi-aarch64:
459  extends:
460    - .native_build_job_template
461    - .native_build_artifact_template
462  needs:
463  - job: amd64-fedora-container
464  variables:
465    LD_JOBS: 1
466    AR: llvm-ar
467    IMAGE: fedora
468    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
469      --enable-safe-stack --disable-slirp
470    TARGETS: aarch64-softmmu
471    MAKE_CHECK_ARGS: check-build
472    # FIXME: This job is often failing, likely due to out-of-memory problems in
473    # the constrained containers of the shared runners. Thus this is marked as
474    # skipped until the situation has been solved.
475    QEMU_JOB_SKIPPED: 1
476  timeout: 90m
477
478check-cfi-aarch64:
479  extends: .native_test_job_template
480  needs:
481    - job: build-cfi-aarch64
482      artifacts: true
483  variables:
484    IMAGE: fedora
485    MAKE_CHECK_ARGS: check
486
487avocado-cfi-aarch64:
488  extends: .avocado_test_job_template
489  needs:
490    - job: build-cfi-aarch64
491      artifacts: true
492  variables:
493    IMAGE: fedora
494    MAKE_CHECK_ARGS: check-avocado
495
496build-cfi-ppc64-s390x:
497  extends:
498    - .native_build_job_template
499    - .native_build_artifact_template
500  needs:
501  - job: amd64-fedora-container
502  variables:
503    LD_JOBS: 1
504    AR: llvm-ar
505    IMAGE: fedora
506    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
507      --enable-safe-stack --disable-slirp
508    TARGETS: ppc64-softmmu s390x-softmmu
509    MAKE_CHECK_ARGS: check-build
510    # FIXME: This job is often failing, likely due to out-of-memory problems in
511    # the constrained containers of the shared runners. Thus this is marked as
512    # skipped until the situation has been solved.
513    QEMU_JOB_SKIPPED: 1
514  timeout: 80m
515
516check-cfi-ppc64-s390x:
517  extends: .native_test_job_template
518  needs:
519    - job: build-cfi-ppc64-s390x
520      artifacts: true
521  variables:
522    IMAGE: fedora
523    MAKE_CHECK_ARGS: check
524
525avocado-cfi-ppc64-s390x:
526  extends: .avocado_test_job_template
527  needs:
528    - job: build-cfi-ppc64-s390x
529      artifacts: true
530  variables:
531    IMAGE: fedora
532    MAKE_CHECK_ARGS: check-avocado
533
534build-cfi-x86_64:
535  extends:
536    - .native_build_job_template
537    - .native_build_artifact_template
538  needs:
539  - job: amd64-fedora-container
540  variables:
541    LD_JOBS: 1
542    AR: llvm-ar
543    IMAGE: fedora
544    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
545      --enable-safe-stack --disable-slirp
546    TARGETS: x86_64-softmmu
547    MAKE_CHECK_ARGS: check-build
548  timeout: 70m
549
550check-cfi-x86_64:
551  extends: .native_test_job_template
552  needs:
553    - job: build-cfi-x86_64
554      artifacts: true
555  variables:
556    IMAGE: fedora
557    MAKE_CHECK_ARGS: check
558
559avocado-cfi-x86_64:
560  extends: .avocado_test_job_template
561  needs:
562    - job: build-cfi-x86_64
563      artifacts: true
564  variables:
565    IMAGE: fedora
566    MAKE_CHECK_ARGS: check-avocado
567
568tsan-build:
569  extends: .native_build_job_template
570  needs:
571    job: amd64-ubuntu2204-container
572  variables:
573    IMAGE: ubuntu2204
574    CONFIGURE_ARGS: --enable-tsan --cc=clang --cxx=clang++
575          --enable-trace-backends=ust --disable-slirp
576    TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user
577    # Remove when we switch to a distro with clang >= 18
578    # https://github.com/google/sanitizers/issues/1716
579    MAKE: setarch -R make
580
581# gcov is a GCC features
582gcov:
583  extends: .native_build_job_template
584  needs:
585    job: amd64-ubuntu2204-container
586  timeout: 80m
587  variables:
588    IMAGE: ubuntu2204
589    CONFIGURE_ARGS: --enable-gcov
590    TARGETS: aarch64-softmmu ppc64-softmmu s390x-softmmu x86_64-softmmu
591    MAKE_CHECK_ARGS: check-unit check-softfloat
592  after_script:
593    - cd build
594    - gcovr --xml-pretty --exclude-unreachable-branches --print-summary
595        -o coverage.xml --root ${CI_PROJECT_DIR} . *.p
596  coverage: /^\s*lines:\s*\d+.\d+\%/
597  artifacts:
598    name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
599    when: always
600    expire_in: 2 days
601    paths:
602      - build/meson-logs/testlog.txt
603    reports:
604      junit: build/meson-logs/testlog.junit.xml
605      coverage_report:
606        coverage_format: cobertura
607        path: build/coverage.xml
608
609build-oss-fuzz:
610  extends: .native_build_job_template
611  needs:
612    job: amd64-fedora-container
613  variables:
614    IMAGE: fedora
615  script:
616    - mkdir build-oss-fuzz
617    - export LSAN_OPTIONS=suppressions=scripts/oss-fuzz/lsan_suppressions.txt
618    - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
619      ./scripts/oss-fuzz/build.sh
620    - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
621    - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
622                      | grep -v slirp); do
623        grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
624        echo Testing ${fuzzer} ... ;
625        "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
626      done
627
628build-tci:
629  extends: .native_build_job_template
630  needs:
631    job: amd64-debian-user-cross-container
632  variables:
633    IMAGE: debian-all-test-cross
634  script:
635    - TARGETS="aarch64 arm hppa m68k microblaze ppc64 s390x x86_64"
636    - mkdir build
637    - cd build
638    - ../configure --enable-tcg-interpreter --disable-kvm --disable-docs --disable-gtk --disable-vnc
639        --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
640        || { cat config.log meson-logs/meson-log.txt && exit 1; }
641    - make -j"$JOBS"
642    - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
643    - for tg in $TARGETS ; do
644        export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
645        ./tests/qtest/boot-serial-test || exit 1 ;
646        ./tests/qtest/cdrom-test || exit 1 ;
647      done
648    - QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
649    - QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
650    - make check-tcg
651
652# Check our reduced build configurations
653# requires libfdt: aarch64, arm, loongarch64, microblaze, microblazeel,
654#   or1k, ppc64, riscv32, riscv64, rx
655# fails qtest without boards: i386, x86_64
656build-without-defaults:
657  extends: .native_build_job_template
658  needs:
659    job: amd64-centos9-container
660  variables:
661    IMAGE: centos9
662    CONFIGURE_ARGS:
663      --without-default-devices
664      --without-default-features
665      --disable-fdt
666      --disable-pie
667      --disable-qom-cast-debug
668      --disable-strip
669    TARGETS: alpha-softmmu avr-softmmu cris-softmmu hppa-softmmu m68k-softmmu
670      mips-softmmu mips64-softmmu mipsel-softmmu mips64el-softmmu
671      ppc-softmmu s390x-softmmu sh4-softmmu sh4eb-softmmu sparc-softmmu
672      sparc64-softmmu tricore-softmmu xtensa-softmmu xtensaeb-softmmu
673      hexagon-linux-user i386-linux-user s390x-linux-user
674    MAKE_CHECK_ARGS: check
675
676build-libvhost-user:
677  extends: .base_job_template
678  stage: build
679  image: $CI_REGISTRY_IMAGE/qemu/fedora:$QEMU_CI_CONTAINER_TAG
680  needs:
681    job: amd64-fedora-container
682  script:
683    - mkdir subprojects/libvhost-user/build
684    - cd subprojects/libvhost-user/build
685    - meson
686    - ninja
687
688# No targets are built here, just tools, docs, and unit tests. This
689# also feeds into the eventual documentation deployment steps later
690build-tools-and-docs-debian:
691  extends:
692    - .native_build_job_template
693    - .native_build_artifact_template
694  needs:
695    job: amd64-debian-container
696    # when running on 'master' we use pre-existing container
697    optional: true
698  variables:
699    IMAGE: debian
700    MAKE_CHECK_ARGS: check-unit ctags TAGS cscope
701    CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools
702    QEMU_JOB_PUBLISH: 1
703
704# Prepare for GitLab pages deployment. Anything copied into the
705# "public" directory will be deployed to $USER.gitlab.io/$PROJECT
706#
707# GitLab publishes from any branch that triggers a CI pipeline
708#
709# For the main repo we don't want to publish from 'staging'
710# since that content may not be pushed, nor do we wish to
711# publish from 'stable-NNN' branches as that content is outdated.
712# Thus we restrict to just the default branch
713#
714# For contributor forks we want to publish from any repo so
715# that users can see the results of their commits, regardless
716# of what topic branch they're currently using
717pages:
718  extends: .base_job_template
719  image: $CI_REGISTRY_IMAGE/qemu/debian:$QEMU_CI_CONTAINER_TAG
720  stage: test
721  needs:
722    - job: build-tools-and-docs-debian
723  script:
724    - mkdir -p public
725    # HTML-ised source tree
726    - make gtags
727    # We unset variables to work around a bug in some htags versions
728    # which causes it to fail when the environment is large
729    - CI_COMMIT_MESSAGE= CI_COMMIT_TAG_MESSAGE= htags
730        -anT --tree-view=filetree -m qemu_init
731        -t "Welcome to the QEMU sourcecode"
732    - mv HTML public/src
733    # Project documentation
734    - make -C build install DESTDIR=$(pwd)/temp-install
735    - mv temp-install/usr/local/share/doc/qemu/* public/
736  artifacts:
737    when: on_success
738    paths:
739      - public
740  variables:
741    QEMU_JOB_PUBLISH: 1
742
743coverity:
744  image: $CI_REGISTRY_IMAGE/qemu/fedora:$QEMU_CI_CONTAINER_TAG
745  stage: build
746  allow_failure: true
747  timeout: 3h
748  needs:
749    - job: amd64-fedora-container
750      optional: true
751  before_script:
752    - dnf install -y curl wget
753  script:
754    # would be nice to cancel the job if over quota (https://gitlab.com/gitlab-org/gitlab/-/issues/256089)
755    # for example:
756    #   curl --request POST --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_SERVER_URL}/api/v4/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID}/cancel
757    - 'scripts/coverity-scan/run-coverity-scan --check-upload-only || { exitcode=$?; if test $exitcode = 1; then
758        exit 0;
759      else
760        exit $exitcode;
761      fi; };
762      scripts/coverity-scan/run-coverity-scan --update-tools-only > update-tools.log 2>&1 || { cat update-tools.log; exit 1; };
763      scripts/coverity-scan/run-coverity-scan --no-update-tools'
764  rules:
765    - if: '$COVERITY_TOKEN == null'
766      when: never
767    - if: '$COVERITY_EMAIL == null'
768      when: never
769    # Never included on upstream pipelines, except for schedules
770    - if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_PIPELINE_SOURCE == "schedule"'
771      when: on_success
772    - if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM'
773      when: never
774    # Forks don't get any pipeline unless QEMU_CI=1 or QEMU_CI=2 is set
775    - if: '$QEMU_CI != "1" && $QEMU_CI != "2"'
776      when: never
777    # Always manual on forks even if $QEMU_CI == "2"
778    - when: manual
779