xref: /openbmc/qemu/.gitlab-ci.yml (revision 036a80cd)
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
10# We assume GitLab has it's own caching set up for RPM/APT repositories so we
11# just take care of avocado assets here.
12cache:
13  paths:
14    - $HOME/avocado/data/cache
15
16include:
17  - local: '/.gitlab-ci.d/edk2.yml'
18  - local: '/.gitlab-ci.d/opensbi.yml'
19  - local: '/.gitlab-ci.d/containers.yml'
20  - local: '/.gitlab-ci.d/crossbuilds.yml'
21
22.native_build_job_template: &native_build_job_definition
23  stage: build
24  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
25  before_script:
26    - JOBS=$(expr $(nproc) + 1)
27  script:
28    - mkdir build
29    - cd build
30    - if test -n "$TARGETS";
31      then
32        ../configure --enable-werror $CONFIGURE_ARGS --target-list="$TARGETS" ;
33      else
34        ../configure --enable-werror $CONFIGURE_ARGS ;
35      fi || { cat config.log meson-logs/meson-log.txt && exit 1; }
36    - make -j"$JOBS"
37    - if test -n "$MAKE_CHECK_ARGS";
38      then
39        make -j"$JOBS" $MAKE_CHECK_ARGS ;
40      fi
41
42.native_test_job_template: &native_test_job_definition
43  stage: test
44  image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
45  script:
46    - cd build
47    - find . -type f -exec touch {} +
48    - make $MAKE_CHECK_ARGS
49
50.acceptance_template: &acceptance_definition
51  cache:
52    key: "${CI_JOB_NAME}-cache"
53    paths:
54      - ${CI_PROJECT_DIR}/avocado-cache
55    policy: pull-push
56  artifacts:
57    paths:
58      - build/tests/results/latest/results.xml
59    reports:
60      junit: build/tests/results/latest/results.xml
61  before_script:
62    - mkdir -p ~/.config/avocado
63    - echo "[datadir.paths]" > ~/.config/avocado/avocado.conf
64    - echo "cache_dirs = ['${CI_PROJECT_DIR}/avocado-cache']"
65           >> ~/.config/avocado/avocado.conf
66    - if [ -d ${CI_PROJECT_DIR}/avocado-cache ]; then
67        du -chs ${CI_PROJECT_DIR}/avocado-cache ;
68      fi
69    - export AVOCADO_ALLOW_UNTRUSTED_CODE=1
70  after_script:
71    - cd build
72    - python3 -c 'import json; r = json.load(open("tests/results/latest/results.json")); [print(t["logfile"]) for t in r["tests"] if t["status"] not in ("PASS", "SKIP", "CANCEL")]' | xargs cat
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  artifacts:
83    expire_in: 2 days
84    paths:
85      - build
86
87check-system-ubuntu:
88  <<: *native_test_job_definition
89  needs:
90    - job: build-system-ubuntu
91      artifacts: true
92  variables:
93    IMAGE: ubuntu2004
94    MAKE_CHECK_ARGS: check
95
96acceptance-system-ubuntu:
97  <<: *native_test_job_definition
98  needs:
99    - job: build-system-ubuntu
100      artifacts: true
101  variables:
102    IMAGE: ubuntu2004
103    MAKE_CHECK_ARGS: check-acceptance
104  <<: *acceptance_definition
105
106build-system-debian:
107  <<: *native_build_job_definition
108  variables:
109    IMAGE: debian-amd64
110    TARGETS: arm-softmmu avr-softmmu i386-softmmu mipsel-softmmu
111      riscv64-softmmu sh4eb-softmmu sparc-softmmu xtensaeb-softmmu
112    MAKE_CHECK_ARGS: check-build
113  artifacts:
114    expire_in: 2 days
115    paths:
116      - build
117
118check-system-debian:
119  <<: *native_test_job_definition
120  needs:
121    - job: build-system-debian
122      artifacts: true
123  variables:
124    IMAGE: debian-amd64
125    MAKE_CHECK_ARGS: check
126
127acceptance-system-debian:
128  <<: *native_test_job_definition
129  needs:
130    - job: build-system-debian
131      artifacts: true
132  variables:
133    IMAGE: debian-amd64
134    MAKE_CHECK_ARGS: check-acceptance
135  <<: *acceptance_definition
136
137build-system-fedora:
138  <<: *native_build_job_definition
139  variables:
140    IMAGE: fedora
141    CONFIGURE_ARGS: --disable-gcrypt --enable-nettle
142    TARGETS: tricore-softmmu microblaze-softmmu mips-softmmu
143      xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
144    MAKE_CHECK_ARGS: check-build
145  artifacts:
146    expire_in: 2 days
147    paths:
148      - build
149
150check-system-fedora:
151  <<: *native_test_job_definition
152  needs:
153    - job: build-system-fedora
154      artifacts: true
155  variables:
156    IMAGE: fedora
157    MAKE_CHECK_ARGS: check
158
159acceptance-system-fedora:
160  <<: *native_test_job_definition
161  needs:
162    - job: build-system-fedora
163      artifacts: true
164  variables:
165    IMAGE: fedora
166    MAKE_CHECK_ARGS: check-acceptance
167  <<: *acceptance_definition
168
169build-system-centos:
170  <<: *native_build_job_definition
171  variables:
172    IMAGE: centos8
173    CONFIGURE_ARGS: --disable-nettle --enable-gcrypt
174    TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
175      x86_64-softmmu rx-softmmu sh4-softmmu nios2-softmmu
176    MAKE_CHECK_ARGS: check-build
177  artifacts:
178    expire_in: 2 days
179    paths:
180      - build
181
182check-system-centos:
183  <<: *native_test_job_definition
184  needs:
185    - job: build-system-centos
186      artifacts: true
187  variables:
188    IMAGE: centos8
189    MAKE_CHECK_ARGS: check
190
191acceptance-system-centos:
192  <<: *native_test_job_definition
193  needs:
194    - job: build-system-centos
195      artifacts: true
196  variables:
197    IMAGE: centos8
198    MAKE_CHECK_ARGS: check-acceptance
199  <<: *acceptance_definition
200
201build-disabled:
202  <<: *native_build_job_definition
203  variables:
204    IMAGE: fedora
205    CONFIGURE_ARGS: --disable-attr --disable-avx2 --disable-bochs
206      --disable-brlapi --disable-bzip2 --disable-cap-ng --disable-capstone
207      --disable-cloop --disable-coroutine-pool --disable-curl --disable-curses
208      --disable-dmg --disable-docs --disable-glusterfs --disable-gnutls
209      --disable-gtk --disable-guest-agent --disable-iconv --disable-kvm
210      --disable-libiscsi --disable-libpmem --disable-libssh --disable-libusb
211      --disable-libxml2 --disable-linux-aio --disable-live-block-migration
212      --disable-lzo --disable-malloc-trim --disable-mpath --disable-nettle
213      --disable-numa --disable-parallels --disable-pie --disable-qcow1
214      --disable-qed --disable-qom-cast-debug --disable-rbd --disable-rdma
215      --disable-replication --disable-sdl --disable-seccomp --disable-sheepdog
216      --disable-slirp --disable-smartcard --disable-snappy --disable-spice
217      --disable-strip --disable-tpm --disable-usb-redir --disable-vdi
218      --disable-vhost-crypto --disable-vhost-net --disable-vhost-scsi
219      --disable-vhost-user --disable-vhost-vdpa --disable-vhost-vsock
220      --disable-virglrenderer --disable-vnc --disable-vte --disable-vvfat
221      --disable-xen --disable-zstd
222    TARGETS: arm-softmmu i386-softmmu ppc64-softmmu mips64-softmmu
223      s390x-softmmu i386-linux-user
224    MAKE_CHECK_ARGS: check-qtest SPEED=slow
225
226build-tcg-disabled:
227  <<: *native_build_job_definition
228  variables:
229    IMAGE: centos8
230  script:
231    - mkdir build
232    - cd build
233    - ../configure --disable-tcg --audio-drv-list="" || { cat config.log meson-logs/meson-log.txt && exit 1; }
234    - make -j"$JOBS"
235    - make check-unit
236    - make check-qapi-schema
237    - cd tests/qemu-iotests/
238    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
239            052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
240            170 171 183 184 192 194 197 208 215 221 222 226 227 236 253 277
241    - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122
242            124 132 139 142 144 145 151 152 155 157 165 194 196 197 200 202
243            208 209 215 216 218 222 227 234 246 247 248 250 254 255 257 258
244            260 261 262 263 264 270 272 273 277 279
245
246build-user:
247  <<: *native_build_job_definition
248  variables:
249    IMAGE: debian-all-test-cross
250    CONFIGURE_ARGS: --disable-tools --disable-system
251    MAKE_CHECK_ARGS: check-tcg
252
253# Run check-tcg against linux-user (with plugins)
254# we skip sparc64-linux-user until it has been fixed somewhat
255# we skip cris-linux-user as it doesn't use the common run loop
256build-user-plugins:
257  <<: *native_build_job_definition
258  variables:
259    IMAGE: debian-all-test-cross
260    CONFIGURE_ARGS: --disable-tools --disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user
261    MAKE_CHECK_ARGS: check-tcg
262  timeout: 1h 30m
263
264build-clang:
265  <<: *native_build_job_definition
266  variables:
267    IMAGE: fedora
268    CONFIGURE_ARGS: --cc=clang --cxx=clang++
269    TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
270      ppc-softmmu s390x-softmmu arm-linux-user
271    MAKE_CHECK_ARGS: check
272
273# These targets are on the way out
274build-deprecated:
275  <<: *native_build_job_definition
276  variables:
277    IMAGE: debian-all-test-cross
278    CONFIGURE_ARGS: --disable-docs --disable-tools
279    MAKE_CHECK_ARGS: build-tcg
280    TARGETS: ppc64abi32-linux-user tilegx-linux-user lm32-softmmu
281      unicore32-softmmu
282  artifacts:
283    expire_in: 2 days
284    paths:
285      - build
286
287# We split the check-tcg step as test failures are expected but we still
288# want to catch the build breaking.
289check-deprecated:
290  <<: *native_test_job_definition
291  needs:
292    - job: build-deprecated
293      artifacts: true
294  variables:
295    IMAGE: debian-all-test-cross
296    MAKE_CHECK_ARGS: check-tcg
297  allow_failure: true
298
299build-oss-fuzz:
300  <<: *native_build_job_definition
301  variables:
302    IMAGE: fedora
303  script:
304    - mkdir build-oss-fuzz
305    - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
306      ./scripts/oss-fuzz/build.sh
307    - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
308    - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
309                      | grep -v slirp); do
310        grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
311        echo Testing ${fuzzer} ... ;
312        "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
313      done
314    # Unrelated to fuzzer: run some tests with -fsanitize=address
315    - cd build-oss-fuzz && make check-qtest-i386 check-unit
316
317build-tci:
318  <<: *native_build_job_definition
319  variables:
320    IMAGE: fedora
321  script:
322    - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
323    - mkdir build
324    - cd build
325    - ../configure --enable-tcg-interpreter
326        --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)" || { cat config.log meson-logs/meson-log.txt && exit 1; }
327    - make -j"$JOBS"
328    - make run-tcg-tests-x86_64-softmmu
329    - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
330    - for tg in $TARGETS ; do
331        export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
332        ./tests/qtest/boot-serial-test || exit 1 ;
333        ./tests/qtest/cdrom-test || exit 1 ;
334      done
335    - QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
336    - QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
337
338# Most jobs test latest gcrypt or nettle builds
339#
340# These jobs test old gcrypt and nettle from RHEL7
341# which had some API differences.
342build-crypto-old-nettle:
343  <<: *native_build_job_definition
344  variables:
345    IMAGE: centos7
346    TARGETS: x86_64-softmmu x86_64-linux-user
347    CONFIGURE_ARGS: --disable-gcrypt --enable-nettle
348    MAKE_CHECK_ARGS: check-build
349  artifacts:
350    paths:
351      - build
352
353check-crypto-old-nettle:
354  <<: *native_test_job_definition
355  needs:
356    - job: build-crypto-old-nettle
357      artifacts: true
358  variables:
359    IMAGE: centos7
360    MAKE_CHECK_ARGS: check
361
362
363build-crypto-old-gcrypt:
364  <<: *native_build_job_definition
365  variables:
366    IMAGE: centos7
367    TARGETS: x86_64-softmmu x86_64-linux-user
368    CONFIGURE_ARGS: --disable-nettle --enable-gcrypt
369    MAKE_CHECK_ARGS: check-build
370  artifacts:
371    paths:
372      - build
373
374check-crypto-old-gcrypt:
375  <<: *native_test_job_definition
376  needs:
377    - job: build-crypto-old-gcrypt
378      artifacts: true
379  variables:
380    IMAGE: centos7
381    MAKE_CHECK_ARGS: check
382
383
384build-crypto-only-gnutls:
385  <<: *native_build_job_definition
386  variables:
387    IMAGE: centos7
388    TARGETS: x86_64-softmmu x86_64-linux-user
389    CONFIGURE_ARGS: --disable-nettle --disable-gcrypt --enable-gnutls
390    MAKE_CHECK_ARGS: check-build
391  artifacts:
392    paths:
393      - build
394
395check-crypto-only-gnutls:
396  <<: *native_test_job_definition
397  needs:
398    - job: build-crypto-only-gnutls
399      artifacts: true
400  variables:
401    IMAGE: centos7
402    MAKE_CHECK_ARGS: check
403
404
405check-patch:
406  stage: build
407  image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
408  script: .gitlab-ci.d/check-patch.py
409  except:
410    variables:
411      - $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
412  variables:
413    GIT_DEPTH: 1000
414  allow_failure: true
415
416check-dco:
417  stage: build
418  image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
419  script: .gitlab-ci.d/check-dco.py
420  except:
421    variables:
422      - $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
423  variables:
424    GIT_DEPTH: 1000
425