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