efi_loader: Work-around build issue due to missing hash_calculate()
[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   variables:
193     TEST_PY_BD: "sandbox_noinst"
194     TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
195   <<: *buildman_and_testpy_dfn
196
197 evb-ast2500 test.py:
198   variables:
199     TEST_PY_BD: "evb-ast2500"
200     TEST_PY_ID: "--id qemu"
201   <<: *buildman_and_testpy_dfn
202
203 sandbox_flattree test.py:
204   variables:
205     TEST_PY_BD: "sandbox_flattree"
206   <<: *buildman_and_testpy_dfn
207
208 integratorcp_cm926ejs test.py:
209   variables:
210     TEST_PY_BD: "integratorcp_cm926ejs"
211     TEST_PY_TEST_SPEC: "not sleep"
212     TEST_PY_ID: "--id qemu"
213   <<: *buildman_and_testpy_dfn
214
215 qemu_arm test.py:
216   variables:
217     TEST_PY_BD: "qemu_arm"
218     TEST_PY_TEST_SPEC: "not sleep"
219   <<: *buildman_and_testpy_dfn
220
221 qemu_arm64 test.py:
222   variables:
223     TEST_PY_BD: "qemu_arm64"
224     TEST_PY_TEST_SPEC: "not sleep"
225   <<: *buildman_and_testpy_dfn
226
227 qemu_malta test.py:
228   variables:
229     TEST_PY_BD: "malta"
230     TEST_PY_TEST_SPEC: "not sleep and not efi"
231     TEST_PY_ID: "--id qemu"
232   <<: *buildman_and_testpy_dfn
233
234 qemu_maltael test.py:
235   variables:
236     TEST_PY_BD: "maltael"
237     TEST_PY_TEST_SPEC: "not sleep and not efi"
238     TEST_PY_ID: "--id qemu"
239   <<: *buildman_and_testpy_dfn
240
241 qemu_malta64 test.py:
242   variables:
243     TEST_PY_BD: "malta64"
244     TEST_PY_TEST_SPEC: "not sleep and not efi"
245     TEST_PY_ID: "--id qemu"
246   <<: *buildman_and_testpy_dfn
247
248 qemu_malta64el test.py:
249   variables:
250     TEST_PY_BD: "malta64el"
251     TEST_PY_TEST_SPEC: "not sleep and not efi"
252     TEST_PY_ID: "--id qemu"
253   <<: *buildman_and_testpy_dfn
254
255 qemu-ppce500 test.py:
256   variables:
257     TEST_PY_BD: "qemu-ppce500"
258     TEST_PY_TEST_SPEC: "not sleep"
259   <<: *buildman_and_testpy_dfn
260
261 qemu-riscv32 test.py:
262   variables:
263     TEST_PY_BD: "qemu-riscv32"
264     TEST_PY_TEST_SPEC: "not sleep"
265   <<: *buildman_and_testpy_dfn
266
267 qemu-riscv64 test.py:
268   variables:
269     TEST_PY_BD: "qemu-riscv64"
270     TEST_PY_TEST_SPEC: "not sleep"
271   <<: *buildman_and_testpy_dfn
272
273 qemu-riscv32_spl test.py:
274   variables:
275     TEST_PY_BD: "qemu-riscv32_spl"
276     TEST_PY_TEST_SPEC: "not sleep"
277   <<: *buildman_and_testpy_dfn
278
279 qemu-riscv64_spl test.py:
280   variables:
281     TEST_PY_BD: "qemu-riscv64_spl"
282     TEST_PY_TEST_SPEC: "not sleep"
283   <<: *buildman_and_testpy_dfn
284
285 qemu-x86 test.py:
286   variables:
287     TEST_PY_BD: "qemu-x86"
288     TEST_PY_TEST_SPEC: "not sleep"
289   <<: *buildman_and_testpy_dfn
290
291 qemu-x86_64 test.py:
292   variables:
293     TEST_PY_BD: "qemu-x86_64"
294     TEST_PY_TEST_SPEC: "not sleep"
295   <<: *buildman_and_testpy_dfn
296
297 r2dplus_i82557c test.py:
298   variables:
299     TEST_PY_BD: "r2dplus"
300     TEST_PY_ID: "--id i82557c_qemu"
301   <<: *buildman_and_testpy_dfn
302
303 r2dplus_pcnet test.py:
304   variables:
305     TEST_PY_BD: "r2dplus"
306     TEST_PY_ID: "--id pcnet_qemu"
307   <<: *buildman_and_testpy_dfn
308
309 r2dplus_rtl8139 test.py:
310   variables:
311     TEST_PY_BD: "r2dplus"
312     TEST_PY_ID: "--id rtl8139_qemu"
313   <<: *buildman_and_testpy_dfn
314
315 r2dplus_tulip test.py:
316   variables:
317     TEST_PY_BD: "r2dplus"
318     TEST_PY_ID: "--id tulip_qemu"
319   <<: *buildman_and_testpy_dfn
320
321 xilinx_zynq_virt test.py:
322   variables:
323     TEST_PY_BD: "xilinx_zynq_virt"
324     TEST_PY_TEST_SPEC: "not sleep"
325     TEST_PY_ID: "--id qemu"
326   <<: *buildman_and_testpy_dfn
327
328 xilinx_versal_virt test.py:
329   variables:
330     TEST_PY_BD: "xilinx_versal_virt"
331     TEST_PY_TEST_SPEC: "not sleep"
332     TEST_PY_ID: "--id qemu"
333   <<: *buildman_and_testpy_dfn
334
335 xtfpga test.py:
336   variables:
337     TEST_PY_BD: "xtfpga"
338     TEST_PY_TEST_SPEC: "not sleep"
339     TEST_PY_ID: "--id qemu"
340   <<: *buildman_and_testpy_dfn