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