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