bff487404f30d0ea5521ade5c1a98ddfa841b1b0
[platform/kernel/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://source.denx.de/u-boot/gitlab-ci-runner
5 image: trini/u-boot-gitlab-ci-runner:bionic-20200807-02Sep2020
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   stage: test.py
15   before_script:
16     # Clone uboot-test-hooks
17     - git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks
18     - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
19     - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
20     - grub-mkimage --prefix="" -o ~/grub_x86.efi -O i386-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
21     - grub-mkimage --prefix="" -o ~/grub_x64.efi -O x86_64-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
22     - if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
23         wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
24         export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin;
25       fi
26     - if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]]; then
27         wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
28         export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin;
29       fi
30
31   after_script:
32     - rm -rf /tmp/uboot-test-hooks /tmp/venv
33   script:
34     # If we've been asked to use clang only do one configuration.
35     - export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD}
36     - tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e
37         --board ${TEST_PY_BD} ${OVERRIDE}
38     - cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/
39     - cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/
40     - cp /opt/grub/grubriscv64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_riscv64.efi
41     - cp /opt/grub/grubriscv32.efi $UBOOT_TRAVIS_BUILD_DIR/grub_riscv32.efi
42     - cp /opt/grub/grubaa64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi
43     - cp /opt/grub/grubarm.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi
44     - virtualenv -p /usr/bin/python3 /tmp/venv
45     - . /tmp/venv/bin/activate
46     - pip install -r test/py/requirements.txt
47     # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
48     - export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
49       export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
50       ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID}
51         ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"}
52         --build-dir "$UBOOT_TRAVIS_BUILD_DIR"
53
54 build all 32bit ARM platforms:
55   stage: world build
56   script:
57     - ret=0;
58       ./tools/buildman/buildman -o /tmp -P -E -W arm -x aarch64 || ret=$?;
59       if [[ $ret -ne 0 ]]; then
60         ./tools/buildman/buildman -o /tmp -seP;
61         exit $ret;
62       fi;
63
64 build all 64bit ARM platforms:
65   stage: world build
66   script:
67     - virtualenv -p /usr/bin/python3 /tmp/venv
68     - . /tmp/venv/bin/activate
69     - pip install pyelftools
70     - ret=0;
71       ./tools/buildman/buildman -o /tmp -P -E -W aarch64 || ret=$?;
72       if [[ $ret -ne 0 ]]; then
73         ./tools/buildman/buildman -o /tmp -seP;
74         exit $ret;
75       fi;
76
77 build all PowerPC platforms:
78   stage: world build
79   script:
80     - ret=0;
81       ./tools/buildman/buildman -o /tmp -P -E -W powerpc || ret=$?;
82       if [[ $ret -ne 0 ]]; then
83         ./tools/buildman/buildman -o /tmp -seP;
84         exit $ret;
85       fi;
86
87 build all other platforms:
88   stage: world build
89   script:
90     - ret=0;
91       ./tools/buildman/buildman -o /tmp -P -E -W -x arm,powerpc || ret=$?;
92       if [[ $ret -ne 0 ]]; then
93         ./tools/buildman/buildman -o /tmp -seP;
94         exit $ret;
95       fi;
96
97 # QA jobs for code analytics
98 # static code analysis with cppcheck (we can add --enable=all later)
99 cppcheck:
100   stage: testsuites
101   script:
102     - cppcheck -j$(nproc) --force --quiet --inline-suppr .
103
104 # search for TODO within source tree
105 grep TODO/FIXME/HACK:
106   stage: testsuites
107   script:
108     - grep -r TODO .
109     - grep -r FIXME .
110     # search for HACK within source tree and ignore HACKKIT board
111     - grep -r HACK . | grep -v HACKKIT
112
113 # build HTML documentation
114 htmldocs:
115   stage: testsuites
116   script:
117     - virtualenv -p /usr/bin/python3 /tmp/venvhtml
118     - . /tmp/venvhtml/bin/activate
119     - pip install -r doc/sphinx/requirements.txt
120     - make htmldocs
121
122 # some statistics about the code base
123 sloccount:
124   stage: testsuites
125   script:
126     - sloccount .
127
128 # ensure all configs have MAINTAINERS entries
129 Check for configs without MAINTAINERS entry:
130   stage: testsuites
131   script:
132     - if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
133
134 # Ensure host tools build
135 Build tools-only:
136   stage: testsuites
137   script:
138     - make tools-only_config tools-only -j$(nproc)
139
140 # Ensure env tools build
141 Build envtools:
142   stage: testsuites
143   script:
144     - make tools-only_config envtools -j$(nproc)
145
146 Run binman, buildman, dtoc, Kconfig and patman testsuites:
147   stage: testsuites
148   script:
149     - git config --global user.name "GitLab CI Runner";
150       git config --global user.email trini@konsulko.com;
151       export USER=gitlab;
152       virtualenv -p /usr/bin/python3 /tmp/venv;
153       . /tmp/venv/bin/activate;
154       pip install -r test/py/requirements.txt;
155       export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl;
156       export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
157       export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
158       ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w
159         --board sandbox_spl;
160       ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
161       ./tools/buildman/buildman -t;
162       ./tools/dtoc/dtoc -t;
163       ./tools/patman/patman test;
164       make testconfig
165
166 Run tests for Nokia RX-51 (aka N900):
167   stage: testsuites
168   script:
169     - ./tools/buildman/buildman --fetch-arch arm;
170       export PATH=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/:$PATH;
171       test/nokia_rx51_test.sh
172
173 # Test sandbox with test.py
174 sandbox test.py:
175   variables:
176     TEST_PY_BD: "sandbox"
177   <<: *buildman_and_testpy_dfn
178
179 sandbox with clang test.py:
180   variables:
181     TEST_PY_BD: "sandbox"
182     OVERRIDE: "-O clang-10"
183   <<: *buildman_and_testpy_dfn
184
185 sandbox_spl test.py:
186   variables:
187     TEST_PY_BD: "sandbox_spl"
188     TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
189   <<: *buildman_and_testpy_dfn
190
191 sandbox_noinst_test.py:
192   tags: [ 'all' ]
193   variables:
194     TEST_PY_BD: "sandbox_noinst"
195     TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
196   <<: *buildman_and_testpy_dfn
197
198 evb-ast2500 test.py:
199   variables:
200     TEST_PY_BD: "evb-ast2500"
201     TEST_PY_ID: "--id qemu"
202   <<: *buildman_and_testpy_dfn
203
204 sandbox_flattree test.py:
205   variables:
206     TEST_PY_BD: "sandbox_flattree"
207   <<: *buildman_and_testpy_dfn
208
209 integratorcp_cm926ejs test.py:
210   variables:
211     TEST_PY_BD: "integratorcp_cm926ejs"
212     TEST_PY_TEST_SPEC: "not sleep"
213     TEST_PY_ID: "--id qemu"
214   <<: *buildman_and_testpy_dfn
215
216 qemu_arm test.py:
217   variables:
218     TEST_PY_BD: "qemu_arm"
219     TEST_PY_TEST_SPEC: "not sleep"
220   <<: *buildman_and_testpy_dfn
221
222 qemu_arm64 test.py:
223   variables:
224     TEST_PY_BD: "qemu_arm64"
225     TEST_PY_TEST_SPEC: "not sleep"
226   <<: *buildman_and_testpy_dfn
227
228 qemu_mips test.py:
229   variables:
230     TEST_PY_BD: "qemu_mips"
231     TEST_PY_TEST_SPEC: "not sleep"
232   <<: *buildman_and_testpy_dfn
233
234 qemu_mipsel test.py:
235   variables:
236     TEST_PY_BD: "qemu_mipsel"
237     TEST_PY_TEST_SPEC: "not sleep"
238   <<: *buildman_and_testpy_dfn
239
240 qemu_mips64 test.py:
241   variables:
242     TEST_PY_BD: "qemu_mips64"
243     TEST_PY_TEST_SPEC: "not sleep"
244   <<: *buildman_and_testpy_dfn
245
246 qemu_mips64el test.py:
247   variables:
248     TEST_PY_BD: "qemu_mips64el"
249     TEST_PY_TEST_SPEC: "not sleep"
250   <<: *buildman_and_testpy_dfn
251
252 qemu_malta test.py:
253   variables:
254     TEST_PY_BD: "malta"
255     TEST_PY_TEST_SPEC: "not sleep and not efi"
256     TEST_PY_ID: "--id qemu"
257   <<: *buildman_and_testpy_dfn
258
259 qemu_maltael test.py:
260   variables:
261     TEST_PY_BD: "maltael"
262     TEST_PY_TEST_SPEC: "not sleep and not efi"
263     TEST_PY_ID: "--id qemu"
264   <<: *buildman_and_testpy_dfn
265
266 qemu_malta64 test.py:
267   variables:
268     TEST_PY_BD: "malta64"
269     TEST_PY_TEST_SPEC: "not sleep and not efi"
270     TEST_PY_ID: "--id qemu"
271   <<: *buildman_and_testpy_dfn
272
273 qemu_malta64el test.py:
274   variables:
275     TEST_PY_BD: "malta64el"
276     TEST_PY_TEST_SPEC: "not sleep and not efi"
277     TEST_PY_ID: "--id qemu"
278   <<: *buildman_and_testpy_dfn
279
280 qemu-ppce500 test.py:
281   variables:
282     TEST_PY_BD: "qemu-ppce500"
283     TEST_PY_TEST_SPEC: "not sleep"
284   <<: *buildman_and_testpy_dfn
285
286 qemu-riscv32 test.py:
287   variables:
288     TEST_PY_BD: "qemu-riscv32"
289     TEST_PY_TEST_SPEC: "not sleep"
290   <<: *buildman_and_testpy_dfn
291
292 qemu-riscv64 test.py:
293   variables:
294     TEST_PY_BD: "qemu-riscv64"
295     TEST_PY_TEST_SPEC: "not sleep"
296   <<: *buildman_and_testpy_dfn
297
298 qemu-riscv32_spl test.py:
299   variables:
300     TEST_PY_BD: "qemu-riscv32_spl"
301     TEST_PY_TEST_SPEC: "not sleep"
302   <<: *buildman_and_testpy_dfn
303
304 qemu-riscv64_spl test.py:
305   variables:
306     TEST_PY_BD: "qemu-riscv64_spl"
307     TEST_PY_TEST_SPEC: "not sleep"
308   <<: *buildman_and_testpy_dfn
309
310 qemu-x86 test.py:
311   variables:
312     TEST_PY_BD: "qemu-x86"
313     TEST_PY_TEST_SPEC: "not sleep"
314   <<: *buildman_and_testpy_dfn
315
316 qemu-x86_64 test.py:
317   variables:
318     TEST_PY_BD: "qemu-x86_64"
319     TEST_PY_TEST_SPEC: "not sleep"
320   <<: *buildman_and_testpy_dfn
321
322 r2dplus_i82557c test.py:
323   variables:
324     TEST_PY_BD: "r2dplus"
325     TEST_PY_ID: "--id i82557c_qemu"
326   <<: *buildman_and_testpy_dfn
327
328 r2dplus_pcnet test.py:
329   variables:
330     TEST_PY_BD: "r2dplus"
331     TEST_PY_ID: "--id pcnet_qemu"
332   <<: *buildman_and_testpy_dfn
333
334 r2dplus_rtl8139 test.py:
335   variables:
336     TEST_PY_BD: "r2dplus"
337     TEST_PY_ID: "--id rtl8139_qemu"
338   <<: *buildman_and_testpy_dfn
339
340 r2dplus_tulip test.py:
341   variables:
342     TEST_PY_BD: "r2dplus"
343     TEST_PY_ID: "--id tulip_qemu"
344   <<: *buildman_and_testpy_dfn
345
346 xilinx_zynq_virt test.py:
347   variables:
348     TEST_PY_BD: "xilinx_zynq_virt"
349     TEST_PY_TEST_SPEC: "not sleep"
350     TEST_PY_ID: "--id qemu"
351   <<: *buildman_and_testpy_dfn
352
353 xilinx_versal_virt test.py:
354   variables:
355     TEST_PY_BD: "xilinx_versal_virt"
356     TEST_PY_TEST_SPEC: "not sleep"
357     TEST_PY_ID: "--id qemu"
358   <<: *buildman_and_testpy_dfn
359
360 xtfpga test.py:
361   variables:
362     TEST_PY_BD: "xtfpga"
363     TEST_PY_TEST_SPEC: "not sleep"
364     TEST_PY_ID: "--id qemu"
365   <<: *buildman_and_testpy_dfn