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