gitlab: add avocado asset caching
[qemu.git] / .gitlab-ci.yml
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)
4 stages:
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.
13 cache:
14   paths:
15     - $HOME/avocado/data/cache
16
17 include:
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 $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
56 build-system-ubuntu-main:
57   <<: *native_build_job_definition
58   variables:
59     IMAGE: ubuntu2004
60     TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu lm32-softmmu
61       moxie-softmmu microblazeel-softmmu mips64el-softmmu m68k-softmmu ppc-softmmu
62       riscv64-softmmu sparc-softmmu
63   artifacts:
64     paths:
65       - build
66
67 check-system-ubuntu-main:
68   <<: *native_test_job_definition
69   needs:
70     - job: build-system-ubuntu-main
71       artifacts: true
72   variables:
73     IMAGE: ubuntu2004
74     MAKE_CHECK_ARGS: check
75
76 acceptance-system-ubuntu-main:
77   <<: *native_test_job_definition
78   needs:
79     - job: build-system-ubuntu-main
80       artifacts: true
81   variables:
82     IMAGE: ubuntu2004
83     MAKE_CHECK_ARGS: check-acceptance
84   <<: *post_acceptance
85
86 build-system-fedora-alt:
87   <<: *native_build_job_definition
88   variables:
89     IMAGE: fedora
90     TARGETS: tricore-softmmu unicore32-softmmu microblaze-softmmu mips-softmmu
91       riscv32-softmmu s390x-softmmu sh4-softmmu sparc64-softmmu x86_64-softmmu
92       xtensa-softmmu nios2-softmmu or1k-softmmu
93   artifacts:
94     paths:
95       - build
96
97 check-system-fedora-alt:
98   <<: *native_test_job_definition
99   needs:
100     - job: build-system-fedora-alt
101       artifacts: true
102   variables:
103     IMAGE: fedora
104     MAKE_CHECK_ARGS: check
105
106 acceptance-system-fedora-alt:
107   <<: *native_test_job_definition
108   needs:
109     - job: build-system-fedora-alt
110       artifacts: true
111   variables:
112     IMAGE: fedora
113     MAKE_CHECK_ARGS: check-acceptance
114   <<: *post_acceptance
115
116 build-disabled:
117   <<: *native_build_job_definition
118   variables:
119     IMAGE: fedora
120     CONFIGURE_ARGS: --disable-rdma --disable-slirp --disable-curl
121       --disable-capstone --disable-live-block-migration --disable-glusterfs
122       --disable-replication --disable-coroutine-pool --disable-smartcard
123       --disable-guest-agent --disable-curses --disable-libxml2 --disable-tpm
124       --disable-qom-cast-debug --disable-spice --disable-vhost-vsock
125       --disable-vhost-net --disable-vhost-crypto --disable-vhost-user
126     TARGETS: i386-softmmu ppc64-softmmu mips64-softmmu i386-linux-user
127     MAKE_CHECK_ARGS: check-qtest SPEED=slow
128
129 build-tcg-disabled:
130   <<: *native_build_job_definition
131   variables:
132     IMAGE: centos8
133   script:
134     - mkdir build
135     - cd build
136     - ../configure --disable-tcg --audio-drv-list=""
137     - make -j"$JOBS"
138     - make check-unit
139     - make check-qapi-schema
140     - cd tests/qemu-iotests/
141     - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
142             052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
143             170 171 183 184 192 194 197 208 215 221 222 226 227 236 253 277
144     - ./check -qcow2 028 051 056 057 058 065 067 068 082 085 091 095 096 102 122
145             124 132 139 142 144 145 151 152 155 157 165 194 196 197 200 202
146             208 209 215 216 218 222 227 234 246 247 248 250 254 255 257 258
147             260 261 262 263 264 270 272 273 277 279
148
149 build-user:
150   <<: *native_build_job_definition
151   variables:
152     IMAGE: debian-all-test-cross
153     CONFIGURE_ARGS: --disable-tools --disable-system
154     MAKE_CHECK_ARGS: check-tcg
155
156 build-clang:
157   <<: *native_build_job_definition
158   variables:
159     IMAGE: fedora
160     CONFIGURE_ARGS: --cc=clang --cxx=clang++
161     TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
162       ppc-softmmu s390x-softmmu x86_64-softmmu arm-linux-user
163     MAKE_CHECK_ARGS: check
164
165 build-tci:
166   <<: *native_build_job_definition
167   variables:
168     IMAGE: fedora
169   script:
170     - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
171     - mkdir build
172     - cd build
173     - ../configure --enable-tcg-interpreter
174         --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
175     - make -j"$JOBS"
176     - make run-tcg-tests-x86_64-softmmu
177     - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
178     - for tg in $TARGETS ; do
179         export QTEST_QEMU_BINARY="${tg}-softmmu/qemu-system-${tg}" ;
180         ./tests/qtest/boot-serial-test || exit 1 ;
181         ./tests/qtest/cdrom-test || exit 1 ;
182       done
183     - QTEST_QEMU_BINARY="x86_64-softmmu/qemu-system-x86_64" ./tests/qtest/pxe-test
184     - QTEST_QEMU_BINARY="s390x-softmmu/qemu-system-s390x" ./tests/qtest/pxe-test -m slow