gitlab: Disable SDL when building sandbox
[oweals/u-boot.git] / .gitlab-ci.yml
1 # SPDX-License-Identifier: GPL-2.0+
2
3 # Grab our configured image.  The source for this is found at:
4 # https://gitlab.denx.de/u-boot/gitlab-ci-runner
5 image: trini/u-boot-gitlab-ci-runner:bionic-20200112-17Jan2020
6
7 # We run some tests in different order, to catch some failures quicker.
8 stages:
9   - testsuites
10   - test.py
11   - world build
12
13 .buildman_and_testpy_template: &buildman_and_testpy_dfn
14   tags: [ 'all' ]
15   stage: test.py
16   before_script:
17     # Clone uboot-test-hooks
18     - git clone --depth=1 git://github.com/swarren/uboot-test-hooks.git /tmp/uboot-test-hooks
19     - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
20     - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
21     - grub-mkimage --prefix="" -o ~/grub_x86.efi -O i386-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
22     - grub-mkimage --prefix="" -o ~/grub_x64.efi -O x86_64-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
23     - mkdir ~/grub2-arm
24     - ( cd ~/grub2-arm; wget -O - http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm | rpm2cpio | cpio -di )
25     - mkdir ~/grub2-arm64
26     - ( cd ~/grub2-arm64; wget -O - http://download.opensuse.org/ports/aarch64/distribution/leap/42.2/repo/oss/suse/aarch64/grub2-arm64-efi-2.02~beta2-87.1.aarch64.rpm | rpm2cpio | cpio -di )
27
28   after_script:
29     - rm -rf ~/grub2* /tmp/uboot-test-hooks /tmp/venv
30   script:
31     # From buildman, exit code 129 means warnings only.  If we've been asked to
32     # use clang only do one configuration.
33     - if [[ "${BUILDMAN}" != "" ]]; then
34         ret=0;
35         NO_SDL=1 tools/buildman/buildman -o /tmp -P -E ${BUILDMAN}
36           ${OVERRIDE}|| ret=$?;
37         if [[ $ret -ne 0 && $ret -ne 129 ]]; then
38           tools/buildman/buildman -o /tmp -sdeP ${BUILDMAN};
39           exit $ret;
40         fi;
41       fi
42     # "not a_test_which_does_not_exist" is a dummy -k parameter which will
43     # never prevent any test from running. That way, we can always pass
44     # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom
45     # value.
46     - virtualenv -p /usr/bin/python3 /tmp/venv
47     - . /tmp/venv/bin/activate
48     - pip install -r test/py/requirements.txt
49     - export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/${TEST_PY_BD};
50       export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
51       export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
52       if [[ "${TEST_PY_BD}" != "" ]]; then
53         ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
54           -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
55           --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
56         ret=$?;
57         if [[ $ret -ne 0 ]]; then
58           exit $ret;
59         fi;
60       fi;
61
62 build all 32bit ARM platforms:
63   tags: [ 'all' ]
64   stage: world build
65   script:
66     - ret=0;
67       ./tools/buildman/buildman -o /tmp -P -E arm -x aarch64 || ret=$?;
68       if [[ $ret -ne 0 && $ret -ne 129 ]]; then
69         ./tools/buildman/buildman -o /tmp -sdeP;
70         exit $ret;
71       fi;
72
73 build all 64bit ARM platforms:
74   tags: [ 'all' ]
75   stage: world build
76   script:
77     - virtualenv /tmp/venv
78     - . /tmp/venv/bin/activate
79     - pip install pyelftools
80     - ret=0;
81       ./tools/buildman/buildman -o /tmp -P -E aarch64 || ret=$?;
82       if [[ $ret -ne 0 && $ret -ne 129 ]]; then
83         ./tools/buildman/buildman -o /tmp -sdeP;
84         exit $ret;
85       fi;
86
87 build all PowerPC platforms:
88   tags: [ 'all' ]
89   stage: world build
90   script:
91     - ret=0;
92       ./tools/buildman/buildman -o /tmp -P -E powerpc || ret=$?;
93       if [[ $ret -ne 0 && $ret -ne 129 ]]; then
94         ./tools/buildman/buildman -o /tmp -sdeP;
95         exit $ret;
96       fi;
97
98 build all other platforms:
99   tags: [ 'all' ]
100   stage: world build
101   script:
102     - ret=0;
103       ./tools/buildman/buildman -o /tmp -P -E -x arm,powerpc || ret=$?;
104       if [[ $ret -ne 0 && $ret -ne 129 ]]; then
105         ./tools/buildman/buildman -o /tmp -sdeP;
106         exit $ret;
107       fi;
108
109 # QA jobs for code analytics
110 # static code analysis with cppcheck (we can add --enable=all later)
111 cppcheck:
112   tags: [ 'all' ]
113   stage: testsuites
114   script:
115     - cppcheck --force --quiet --inline-suppr .
116
117 # search for TODO within source tree
118 grep TODO/FIXME/HACK:
119   tags: [ 'all' ]
120   stage: testsuites
121   script:
122     - grep -r TODO .
123     - grep -r FIXME .
124     # search for HACK within source tree and ignore HACKKIT board
125     - grep -r HACK . | grep -v HACKKIT
126
127 # some statistics about the code base
128 sloccount:
129   tags: [ 'all' ]
130   stage: testsuites
131   script:
132     - sloccount .
133
134 # ensure all configs have MAINTAINERS entries
135 Check for configs without MAINTAINERS entry:
136   tags: [ 'all' ]
137   stage: testsuites
138   script:
139     - if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
140
141 # Ensure host tools build
142 Build tools-only:
143   tags: [ 'all' ]
144   stage: testsuites
145   script:
146     - make tools-only_config tools-only -j$(nproc)
147
148 # Ensure env tools build
149 Build envtools:
150   tags: [ 'all' ]
151   stage: testsuites
152   script:
153     - make tools-only_config envtools -j$(nproc)
154
155 Run binman, buildman, dtoc and patman testsuites:
156   tags: [ 'all' ]
157   stage: testsuites
158   script:
159     - git config --global user.name "GitLab CI Runner";
160       git config --global user.email trini@konsulko.com;
161       export USER=gitlab;
162       virtualenv /tmp/venv;
163       . /tmp/venv/bin/activate;
164       pip install pyelftools;
165       export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/sandbox_spl;
166       export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
167       export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
168       NO_SDL=1 ./tools/buildman/buildman -o /tmp -P sandbox_spl;
169       ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
170       ./tools/buildman/buildman -t;
171       ./tools/dtoc/dtoc -t;
172       ./tools/patman/patman --test
173
174 # Test sandbox with test.py
175 sandbox test.py:
176   tags: [ 'all' ]
177   variables:
178     TEST_PY_BD: "sandbox"
179     BUILDMAN: "^sandbox$"
180   <<: *buildman_and_testpy_dfn
181
182 sandbox with clang test.py:
183   tags: [ 'all' ]
184   variables:
185     TEST_PY_BD: "sandbox"
186     BUILDMAN: "^sandbox$"
187     OVERRIDE: "-O clang-7"
188   <<: *buildman_and_testpy_dfn
189
190 sandbox_spl test.py:
191   tags: [ 'all' ]
192   variables:
193     TEST_PY_BD: "sandbox_spl"
194     BUILDMAN: "^sandbox_spl$"
195     TEST_PY_TEST_SPEC: "test_ofplatdata"
196   <<: *buildman_and_testpy_dfn
197
198 evb-ast2500 test.py:
199   tags: [ 'all' ]
200   variables:
201     TEST_PY_BD: "evb-ast2500"
202     TEST_PY_ID: "--id qemu"
203     BUILDMAN: "^evb-ast2500$"
204   <<: *buildman_and_testpy_dfn
205
206 sandbox_flattree test.py:
207   tags: [ 'all' ]
208   variables:
209     TEST_PY_BD: "sandbox_flattree"
210     BUILDMAN: "^sandbox_flattree$"
211   <<: *buildman_and_testpy_dfn
212
213 vexpress_ca15_tc2 test.py:
214   tags: [ 'all' ]
215   variables:
216     TEST_PY_BD: "vexpress_ca15_tc2"
217     TEST_PY_ID: "--id qemu"
218     BUILDMAN: "^vexpress_ca15_tc2$"
219   <<: *buildman_and_testpy_dfn
220
221 vexpress_ca9x4 test.py:
222   tags: [ 'all' ]
223   variables:
224     TEST_PY_BD: "vexpress_ca9x4"
225     TEST_PY_ID: "--id qemu"
226     BUILDMAN: "^vexpress_ca9x4$"
227   <<: *buildman_and_testpy_dfn
228
229 integratorcp_cm926ejs test.py:
230   tags: [ 'all' ]
231   variables:
232     TEST_PY_BD: "integratorcp_cm926ejs"
233     TEST_PY_TEST_SPEC: "not sleep"
234     TEST_PY_ID: "--id qemu"
235     BUILDMAN: "^integratorcp_cm926ejs$"
236   <<: *buildman_and_testpy_dfn
237
238 qemu_arm test.py:
239   tags: [ 'all' ]
240   variables:
241     TEST_PY_BD: "qemu_arm"
242     TEST_PY_TEST_SPEC: "not sleep"
243     BUILDMAN: "^qemu_arm$"
244   <<: *buildman_and_testpy_dfn
245
246 qemu_arm64 test.py:
247   tags: [ 'all' ]
248   variables:
249     TEST_PY_BD: "qemu_arm64"
250     TEST_PY_TEST_SPEC: "not sleep"
251     BUILDMAN: "^qemu_arm64$"
252   <<: *buildman_and_testpy_dfn
253
254 qemu_mips test.py:
255   tags: [ 'all' ]
256   variables:
257     TEST_PY_BD: "qemu_mips"
258     TEST_PY_TEST_SPEC: "not sleep"
259     BUILDMAN: "^qemu_mips$"
260   <<: *buildman_and_testpy_dfn
261
262 qemu_mipsel test.py:
263   tags: [ 'all' ]
264   variables:
265     TEST_PY_BD: "qemu_mipsel"
266     TEST_PY_TEST_SPEC: "not sleep"
267     BUILDMAN: "^qemu_mipsel$"
268   <<: *buildman_and_testpy_dfn
269
270 qemu_mips64 test.py:
271   tags: [ 'all' ]
272   variables:
273     TEST_PY_BD: "qemu_mips64"
274     TEST_PY_TEST_SPEC: "not sleep"
275     BUILDMAN: "^qemu_mips64$"
276   <<: *buildman_and_testpy_dfn
277
278 qemu_mips64el test.py:
279   tags: [ 'all' ]
280   variables:
281     TEST_PY_BD: "qemu_mips64el"
282     TEST_PY_TEST_SPEC: "not sleep"
283     BUILDMAN: "^qemu_mips64el$"
284   <<: *buildman_and_testpy_dfn
285
286 qemu-ppce500 test.py:
287   tags: [ 'all' ]
288   variables:
289     TEST_PY_BD: "qemu-ppce500"
290     TEST_PY_TEST_SPEC: "not sleep"
291     BUILDMAN: "^qemu-ppce500$"
292   <<: *buildman_and_testpy_dfn
293
294 qemu-riscv64 test.py:
295   tags: [ 'all' ]
296   variables:
297     TEST_PY_BD: "qemu-riscv64"
298     TEST_PY_TEST_SPEC: "not sleep"
299     BUILDMAN: "^qemu-riscv64$"
300   <<: *buildman_and_testpy_dfn
301
302 qemu-x86 test.py:
303   tags: [ 'all' ]
304   variables:
305     TEST_PY_BD: "qemu-x86"
306     TEST_PY_TEST_SPEC: "not sleep"
307     BUILDMAN: "^qemu-x86$"
308   <<: *buildman_and_testpy_dfn
309
310 qemu-x86_64 test.py:
311   tags: [ 'all' ]
312   variables:
313     TEST_PY_BD: "qemu-x86_64"
314     TEST_PY_TEST_SPEC: "not sleep"
315     BUILDMAN: "^qemu-x86_64$"
316   <<: *buildman_and_testpy_dfn
317
318 zynq_zc702 test.py:
319   tags: [ 'all' ]
320   variables:
321     TEST_PY_BD: "zynq_zc702"
322     TEST_PY_TEST_SPEC: "not sleep"
323     TEST_PY_ID: "--id qemu"
324     BUILDMAN: "^zynq_zc702$"
325   <<: *buildman_and_testpy_dfn
326
327 xilinx_versal_virt test.py:
328   tags: [ 'all' ]
329   variables:
330     TEST_PY_BD: "xilinx_versal_virt"
331     TEST_PY_TEST_SPEC: "not sleep"
332     TEST_PY_ID: "--id qemu"
333     BUILDMAN: "^xilinx_versal_virt$"
334   <<: *buildman_and_testpy_dfn
335
336 xtfpga test.py:
337   tags: [ 'all' ]
338   variables:
339     TEST_PY_BD: "xtfpga"
340     TEST_PY_TEST_SPEC: "not sleep"
341     TEST_PY_ID: "--id qemu"
342     BUILDMAN: "^xtfpga$"
343   <<: *buildman_and_testpy_dfn