xref: /qemu/.gitlab-ci.yml (revision 5ab04d5e)
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
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
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  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    - if [ -d ${CI_PROJECT_DIR}/avocado-cache ]; then
62        du -chs ${CI_PROJECT_DIR}/avocado-cache ;
63      fi
64  after_script:
65    - cd build
66    - 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
67    - du -chs ${CI_PROJECT_DIR}/avocado-cache
68
69build-system-ubuntu:
70  <<: *native_build_job_definition
71  variables:
72    IMAGE: ubuntu2004
73    TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
74      moxie-softmmu microblazeel-softmmu mips64el-softmmu
75    MAKE_CHECK_ARGS: check-build
76  artifacts:
77    paths:
78      - build
79
80check-system-ubuntu:
81  <<: *native_test_job_definition
82  needs:
83    - job: build-system-ubuntu
84      artifacts: true
85  variables:
86    IMAGE: ubuntu2004
87    MAKE_CHECK_ARGS: check
88
89acceptance-system-ubuntu:
90  <<: *native_test_job_definition
91  needs:
92    - job: build-system-ubuntu
93      artifacts: true
94  variables:
95    IMAGE: ubuntu2004
96    MAKE_CHECK_ARGS: check-acceptance
97  <<: *acceptance_definition
98
99build-system-debian:
100  <<: *native_build_job_definition
101  variables:
102    IMAGE: debian-amd64
103    TARGETS: arm-softmmu avr-softmmu i386-softmmu mipsel-softmmu
104      riscv64-softmmu sh4eb-softmmu sparc-softmmu xtensaeb-softmmu
105    MAKE_CHECK_ARGS: check-build
106  artifacts:
107    paths:
108      - build
109
110check-system-debian:
111  <<: *native_test_job_definition
112  needs:
113    - job: build-system-debian
114      artifacts: true
115  variables:
116    IMAGE: debian-amd64
117    MAKE_CHECK_ARGS: check
118
119acceptance-system-debian:
120  <<: *native_test_job_definition
121  needs:
122    - job: build-system-debian
123      artifacts: true
124  variables:
125    IMAGE: debian-amd64
126    MAKE_CHECK_ARGS: check-acceptance
127  <<: *acceptance_definition
128
129build-system-fedora:
130  <<: *native_build_job_definition
131  variables:
132    IMAGE: fedora
133    TARGETS: tricore-softmmu unicore32-softmmu microblaze-softmmu mips-softmmu
134      xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
135    MAKE_CHECK_ARGS: check-build
136  artifacts:
137    paths:
138      - build
139
140check-system-fedora:
141  <<: *native_test_job_definition
142  needs:
143    - job: build-system-fedora
144      artifacts: true
145  variables:
146    IMAGE: fedora
147    MAKE_CHECK_ARGS: check
148
149acceptance-system-fedora:
150  <<: *native_test_job_definition
151  needs:
152    - job: build-system-fedora
153      artifacts: true
154  variables:
155    IMAGE: fedora
156    MAKE_CHECK_ARGS: check-acceptance
157  <<: *acceptance_definition
158
159build-system-centos:
160  <<: *native_build_job_definition
161  variables:
162    IMAGE: centos8
163    TARGETS: ppc64-softmmu lm32-softmmu or1k-softmmu s390x-softmmu
164      x86_64-softmmu rx-softmmu sh4-softmmu nios2-softmmu
165    MAKE_CHECK_ARGS: check-build
166  artifacts:
167    paths:
168      - build
169
170check-system-centos:
171  <<: *native_test_job_definition
172  needs:
173    - job: build-system-centos
174      artifacts: true
175  variables:
176    IMAGE: centos8
177    MAKE_CHECK_ARGS: check
178
179acceptance-system-centos:
180  <<: *native_test_job_definition
181  needs:
182    - job: build-system-centos
183      artifacts: true
184  variables:
185    IMAGE: centos8
186    MAKE_CHECK_ARGS: check-acceptance
187  <<: *acceptance_definition
188
189build-disabled:
190  <<: *native_build_job_definition
191  variables:
192    IMAGE: fedora
193    CONFIGURE_ARGS: --disable-attr --disable-avx2 --disable-bochs
194      --disable-brlapi --disable-bzip2 --disable-cap-ng --disable-capstone
195      --disable-cloop --disable-coroutine-pool --disable-curl --disable-curses
196      --disable-dmg --disable-docs --disable-glusterfs --disable-gnutls
197      --disable-gtk --disable-guest-agent --disable-iconv --disable-kvm
198      --disable-libiscsi --disable-libpmem --disable-libssh --disable-libusb
199      --disable-libxml2 --disable-linux-aio --disable-live-block-migration
200      --disable-lzo --disable-malloc-trim --disable-mpath --disable-nettle
201      --disable-numa --disable-parallels --disable-pie --disable-qcow1
202      --disable-qed --disable-qom-cast-debug --disable-rbd --disable-rdma
203      --disable-replication --disable-sdl --disable-seccomp --disable-sheepdog
204      --disable-slirp --disable-smartcard --disable-snappy --disable-spice
205      --disable-strip --disable-tpm --disable-usb-redir --disable-vdi
206      --disable-vhost-crypto --disable-vhost-net --disable-vhost-scsi
207      --disable-vhost-user --disable-vhost-vdpa --disable-vhost-vsock
208      --disable-virglrenderer --disable-vnc --disable-vte --disable-vvfat
209      --disable-xen --disable-zstd
210    TARGETS: arm-softmmu i386-softmmu ppc64-softmmu mips64-softmmu
211      s390x-softmmu i386-linux-user
212    MAKE_CHECK_ARGS: check-qtest SPEED=slow
213
214build-tcg-disabled:
215  <<: *native_build_job_definition
216  variables:
217    IMAGE: centos8
218  script:
219    - mkdir build
220    - cd build
221    - ../configure --disable-tcg --audio-drv-list=""
222    - make -j"$JOBS"
223    - make check-unit
224    - make check-qapi-schema
225    - cd tests/qemu-iotests/
226    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
227            052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
228            170 171 183 184 192 194 197 208 215 221 222 226 227 236 253 277
229    - ./check -qcow2 028 051 056 057 058 065 067 068 082 085 091 095 096 102 122
230            124 132 139 142 144 145 151 152 155 157 165 194 196 197 200 202
231            208 209 215 216 218 222 227 234 246 247 248 250 254 255 257 258
232            260 261 262 263 264 270 272 273 277 279
233
234build-user:
235  <<: *native_build_job_definition
236  variables:
237    IMAGE: debian-all-test-cross
238    CONFIGURE_ARGS: --disable-tools --disable-system
239    MAKE_CHECK_ARGS: check-tcg
240
241build-clang:
242  <<: *native_build_job_definition
243  variables:
244    IMAGE: fedora
245    CONFIGURE_ARGS: --cc=clang --cxx=clang++
246    TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
247      ppc-softmmu s390x-softmmu arm-linux-user
248    MAKE_CHECK_ARGS: check
249
250build-oss-fuzz:
251  <<: *native_build_job_definition
252  variables:
253    IMAGE: fedora
254  script:
255    - mkdir build-oss-fuzz
256    - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
257      ./scripts/oss-fuzz/build.sh
258    - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
259    - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
260                      | grep -v slirp); do
261        grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
262        echo Testing ${fuzzer} ... ;
263        "${fuzzer}" -runs=1000 -seed=1 || exit 1 ;
264      done
265    # Unrelated to fuzzer: run some tests with -fsanitize=address
266    - cd build-oss-fuzz && make check-qtest-i386 check-unit
267
268build-tci:
269  <<: *native_build_job_definition
270  variables:
271    IMAGE: fedora
272  script:
273    - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
274    - mkdir build
275    - cd build
276    - ../configure --enable-tcg-interpreter
277        --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
278    - make -j"$JOBS"
279    - make run-tcg-tests-x86_64-softmmu
280    - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
281    - for tg in $TARGETS ; do
282        export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
283        ./tests/qtest/boot-serial-test || exit 1 ;
284        ./tests/qtest/cdrom-test || exit 1 ;
285      done
286    - QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
287    - QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
288