8bc81dd74fdcd3f0164e201304a2c5c0c5973a2b
[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-20200311-10Apr2020
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     - cp /opt/grub/grubriscv64.efi ~/grub_riscv64.efi
24     - cp /opt/grub/grubriscv32.efi ~/grub_riscv32.efi
25     - cp /opt/grub/grubaa64.efi ~/grub_arm64.efi
26     - cp /opt/grub/grubarm.efi ~/grub_arm.efi
27     - if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
28         wget -O - https://github.com/riscv/opensbi/releases/download/v0.6/opensbi-0.6-rv32-bin.tar.xz | tar -C /tmp -xJ;
29         export OPENSBI=/tmp/opensbi-0.6-rv32-bin/platform/qemu/virt/firmware/fw_dynamic.bin;
30       fi
31     - if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]]; then
32         wget -O - https://github.com/riscv/opensbi/releases/download/v0.6/opensbi-0.6-rv64-bin.tar.xz | tar -C /tmp -xJ;
33         export OPENSBI=/tmp/opensbi-0.6-rv64-bin/platform/qemu/virt/firmware/fw_dynamic.bin;
34       fi
35
36   after_script:
37     - rm -rf /tmp/uboot-test-hooks /tmp/venv
38   script:
39     # From buildman, exit code 129 means warnings only.  If we've been asked to
40     # use clang only do one configuration.
41     - if [[ "${BUILDMAN}" != "" ]]; then
42         ret=0;
43         tools/buildman/buildman -o /tmp -P -E --board ${BUILDMAN} ${OVERRIDE}
44           || ret=$?;
45         if [[ $ret -ne 0 && $ret -ne 129 ]]; then
46           tools/buildman/buildman -o /tmp -sdeP --board ${BUILDMAN};
47           exit $ret;
48         fi;
49       fi
50     # "not a_test_which_does_not_exist" is a dummy -k parameter which will
51     # never prevent any test from running. That way, we can always pass
52     # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom
53     # value.
54     - virtualenv -p /usr/bin/python3 /tmp/venv
55     - . /tmp/venv/bin/activate
56     - pip install -r test/py/requirements.txt
57     - export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/${TEST_PY_BD};
58       export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
59       export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
60       if [[ "${TEST_PY_BD}" != "" ]]; then
61         ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
62           -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
63           --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
64         ret=$?;
65         if [[ $ret -ne 0 ]]; then
66           exit $ret;
67         fi;
68       fi;
69
70 build all 32bit ARM platforms:
71   tags: [ 'all' ]
72   stage: world build
73   script:
74     - ret=0;
75       ./tools/buildman/buildman -o /tmp -P -E arm -x aarch64 || ret=$?;
76       if [[ $ret -ne 0 && $ret -ne 129 ]]; then
77         ./tools/buildman/buildman -o /tmp -sdeP;
78         exit $ret;
79       fi;
80
81 build all 64bit ARM platforms:
82   tags: [ 'all' ]
83   stage: world build
84   script:
85     - virtualenv -p /usr/bin/python3 /tmp/venv
86     - . /tmp/venv/bin/activate
87     - pip install pyelftools
88     - ret=0;
89       ./tools/buildman/buildman -o /tmp -P -E aarch64 || ret=$?;
90       if [[ $ret -ne 0 && $ret -ne 129 ]]; then
91         ./tools/buildman/buildman -o /tmp -sdeP;
92         exit $ret;
93       fi;
94
95 build all PowerPC platforms:
96   tags: [ 'all' ]
97   stage: world build
98   script:
99     - ret=0;
100       ./tools/buildman/buildman -o /tmp -P -E powerpc || ret=$?;
101       if [[ $ret -ne 0 && $ret -ne 129 ]]; then
102         ./tools/buildman/buildman -o /tmp -sdeP;
103         exit $ret;
104       fi;
105
106 build all other platforms:
107   tags: [ 'all' ]
108   stage: world build
109   script:
110     - ret=0;
111       ./tools/buildman/buildman -o /tmp -P -E -x arm,powerpc || ret=$?;
112       if [[ $ret -ne 0 && $ret -ne 129 ]]; then
113         ./tools/buildman/buildman -o /tmp -sdeP;
114         exit $ret;
115       fi;
116
117 # QA jobs for code analytics
118 # static code analysis with cppcheck (we can add --enable=all later)
119 cppcheck:
120   tags: [ 'all' ]
121   stage: testsuites
122   script:
123     - cppcheck --force --quiet --inline-suppr .
124
125 # search for TODO within source tree
126 grep TODO/FIXME/HACK:
127   tags: [ 'all' ]
128   stage: testsuites
129   script:
130     - grep -r TODO .
131     - grep -r FIXME .
132     # search for HACK within source tree and ignore HACKKIT board
133     - grep -r HACK . | grep -v HACKKIT
134
135 # build HTML documentation
136 htmldocs:
137   tags: [ 'all' ]
138   stage: testsuites
139   script:
140     - make htmldocs
141
142 # some statistics about the code base
143 sloccount:
144   tags: [ 'all' ]
145   stage: testsuites
146   script:
147     - sloccount .
148
149 # ensure all configs have MAINTAINERS entries
150 Check for configs without MAINTAINERS entry:
151   tags: [ 'all' ]
152   stage: testsuites
153   script:
154     - if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
155
156 # Ensure host tools build
157 Build tools-only:
158   tags: [ 'all' ]
159   stage: testsuites
160   script:
161     - make tools-only_config tools-only -j$(nproc)
162
163 # Ensure env tools build
164 Build envtools:
165   tags: [ 'all' ]
166   stage: testsuites
167   script:
168     - make tools-only_config envtools -j$(nproc)
169
170 Run binman, buildman, dtoc, Kconfig and patman testsuites:
171   tags: [ 'all' ]
172   stage: testsuites
173   script:
174     - git config --global user.name "GitLab CI Runner";
175       git config --global user.email trini@konsulko.com;
176       export USER=gitlab;
177       virtualenv -p /usr/bin/python3 /tmp/venv;
178       . /tmp/venv/bin/activate;
179       pip install pyelftools pytest;
180       export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl;
181       export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
182       export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
183       ./tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w sandbox_spl;
184       ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
185       ./tools/buildman/buildman -t;
186       ./tools/dtoc/dtoc -t;
187       ./tools/patman/patman --test;
188       make testconfig
189
190 # Test sandbox with test.py
191 sandbox test.py:
192   tags: [ 'all' ]
193   variables:
194     TEST_PY_BD: "sandbox"
195     BUILDMAN: "sandbox"
196   <<: *buildman_and_testpy_dfn
197
198 sandbox with clang test.py:
199   tags: [ 'all' ]
200   variables:
201     TEST_PY_BD: "sandbox"
202     BUILDMAN: "sandbox"
203     OVERRIDE: "-O clang-7"
204   <<: *buildman_and_testpy_dfn
205
206 sandbox_spl test.py:
207   tags: [ 'all' ]
208   variables:
209     TEST_PY_BD: "sandbox_spl"
210     BUILDMAN: "sandbox_spl"
211     TEST_PY_TEST_SPEC: "test_ofplatdata"
212   <<: *buildman_and_testpy_dfn
213
214 evb-ast2500 test.py:
215   tags: [ 'all' ]
216   variables:
217     TEST_PY_BD: "evb-ast2500"
218     TEST_PY_ID: "--id qemu"
219     BUILDMAN: "evb-ast2500"
220   <<: *buildman_and_testpy_dfn
221
222 sandbox_flattree test.py:
223   tags: [ 'all' ]
224   variables:
225     TEST_PY_BD: "sandbox_flattree"
226     BUILDMAN: "sandbox_flattree"
227   <<: *buildman_and_testpy_dfn
228
229 vexpress_ca15_tc2 test.py:
230   tags: [ 'all' ]
231   variables:
232     TEST_PY_BD: "vexpress_ca15_tc2"
233     TEST_PY_ID: "--id qemu"
234     BUILDMAN: "vexpress_ca15_tc2"
235   <<: *buildman_and_testpy_dfn
236
237 vexpress_ca9x4 test.py:
238   tags: [ 'all' ]
239   variables:
240     TEST_PY_BD: "vexpress_ca9x4"
241     TEST_PY_ID: "--id qemu"
242     BUILDMAN: "vexpress_ca9x4"
243   <<: *buildman_and_testpy_dfn
244
245 integratorcp_cm926ejs test.py:
246   tags: [ 'all' ]
247   variables:
248     TEST_PY_BD: "integratorcp_cm926ejs"
249     TEST_PY_TEST_SPEC: "not sleep"
250     TEST_PY_ID: "--id qemu"
251     BUILDMAN: "integratorcp_cm926ejs"
252   <<: *buildman_and_testpy_dfn
253
254 qemu_arm test.py:
255   tags: [ 'all' ]
256   variables:
257     TEST_PY_BD: "qemu_arm"
258     TEST_PY_TEST_SPEC: "not sleep"
259     BUILDMAN: "qemu_arm"
260   <<: *buildman_and_testpy_dfn
261
262 qemu_arm64 test.py:
263   tags: [ 'all' ]
264   variables:
265     TEST_PY_BD: "qemu_arm64"
266     TEST_PY_TEST_SPEC: "not sleep"
267     BUILDMAN: "qemu_arm64"
268   <<: *buildman_and_testpy_dfn
269
270 qemu_mips test.py:
271   tags: [ 'all' ]
272   variables:
273     TEST_PY_BD: "qemu_mips"
274     TEST_PY_TEST_SPEC: "not sleep"
275     BUILDMAN: "qemu_mips"
276   <<: *buildman_and_testpy_dfn
277
278 qemu_mipsel test.py:
279   tags: [ 'all' ]
280   variables:
281     TEST_PY_BD: "qemu_mipsel"
282     TEST_PY_TEST_SPEC: "not sleep"
283     BUILDMAN: "qemu_mipsel"
284   <<: *buildman_and_testpy_dfn
285
286 qemu_mips64 test.py:
287   tags: [ 'all' ]
288   variables:
289     TEST_PY_BD: "qemu_mips64"
290     TEST_PY_TEST_SPEC: "not sleep"
291     BUILDMAN: "qemu_mips64"
292   <<: *buildman_and_testpy_dfn
293
294 qemu_mips64el test.py:
295   tags: [ 'all' ]
296   variables:
297     TEST_PY_BD: "qemu_mips64el"
298     TEST_PY_TEST_SPEC: "not sleep"
299     BUILDMAN: "qemu_mips64el"
300   <<: *buildman_and_testpy_dfn
301
302 qemu-ppce500 test.py:
303   tags: [ 'all' ]
304   variables:
305     TEST_PY_BD: "qemu-ppce500"
306     TEST_PY_TEST_SPEC: "not sleep"
307     BUILDMAN: "qemu-ppce500"
308   <<: *buildman_and_testpy_dfn
309
310 qemu-riscv32 test.py:
311   tags: [ 'all' ]
312   variables:
313     TEST_PY_BD: "qemu-riscv32"
314     TEST_PY_TEST_SPEC: "not sleep"
315     BUILDMAN: "qemu-riscv32"
316   <<: *buildman_and_testpy_dfn
317
318 qemu-riscv64 test.py:
319   tags: [ 'all' ]
320   variables:
321     TEST_PY_BD: "qemu-riscv64"
322     TEST_PY_TEST_SPEC: "not sleep"
323     BUILDMAN: "qemu-riscv64"
324   <<: *buildman_and_testpy_dfn
325
326 qemu-riscv32_spl test.py:
327   tags: [ 'all' ]
328   variables:
329     TEST_PY_BD: "qemu-riscv32_spl"
330     TEST_PY_TEST_SPEC: "not sleep"
331     BUILDMAN: "qemu-riscv32_spl"
332   <<: *buildman_and_testpy_dfn
333
334 qemu-riscv64_spl test.py:
335   tags: [ 'all' ]
336   variables:
337     TEST_PY_BD: "qemu-riscv64_spl"
338     TEST_PY_TEST_SPEC: "not sleep"
339     BUILDMAN: "qemu-riscv64_spl"
340   <<: *buildman_and_testpy_dfn
341
342 qemu-x86 test.py:
343   tags: [ 'all' ]
344   variables:
345     TEST_PY_BD: "qemu-x86"
346     TEST_PY_TEST_SPEC: "not sleep"
347     BUILDMAN: "qemu-x86"
348   <<: *buildman_and_testpy_dfn
349
350 qemu-x86_64 test.py:
351   tags: [ 'all' ]
352   variables:
353     TEST_PY_BD: "qemu-x86_64"
354     TEST_PY_TEST_SPEC: "not sleep"
355     BUILDMAN: "qemu-x86_64"
356   <<: *buildman_and_testpy_dfn
357
358 xilinx_zynq_virt test.py:
359   tags: [ 'all' ]
360   variables:
361     TEST_PY_BD: "xilinx_zynq_virt"
362     TEST_PY_TEST_SPEC: "not sleep"
363     TEST_PY_ID: "--id qemu"
364     BUILDMAN: "xilinx_zynq_virt"
365   <<: *buildman_and_testpy_dfn
366
367 xilinx_versal_virt test.py:
368   tags: [ 'all' ]
369   variables:
370     TEST_PY_BD: "xilinx_versal_virt"
371     TEST_PY_TEST_SPEC: "not sleep"
372     TEST_PY_ID: "--id qemu"
373     BUILDMAN: "xilinx_versal_virt"
374   <<: *buildman_and_testpy_dfn
375
376 xtfpga test.py:
377   tags: [ 'all' ]
378   variables:
379     TEST_PY_BD: "xtfpga"
380     TEST_PY_TEST_SPEC: "not sleep"
381     TEST_PY_ID: "--id qemu"
382     BUILDMAN: "xtfpga"
383   <<: *buildman_and_testpy_dfn