gitlab-ci: Add USER environment variable to buildman/patman tests
[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:xenial-20190720-02Aug2019
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     - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
26     - grub-mkimage -o ~/grub_x64.efi -O x86_64-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
27     - mkdir ~/grub2-arm
28     - ( 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 )
29     - mkdir ~/grub2-arm64
30     - ( 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 )
31
32   after_script:
33     - rm -rf ~/grub2* /tmp/uboot-test-hooks /tmp/venv
34   script:
35     # From buildman, exit code 129 means warnings only.  If we've been asked to
36     # use clang only do one configuration.
37     - if [[ "${BUILDMAN}" != "" ]]; then
38         ret=0;
39         tools/buildman/buildman -P -E ${BUILDMAN} ${OVERRIDE}|| ret=$?;
40         if [[ $ret -ne 0 && $ret -ne 129 ]]; then
41           tools/buildman/buildman -sdeP ${BUILDMAN};
42           exit $ret;
43         fi;
44       fi
45     # "not a_test_which_does_not_exist" is a dummy -k parameter which will
46     # never prevent any test from running. That way, we can always pass
47     # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom
48     # value.
49     - export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/${TEST_PY_BD};
50       export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:/usr/bin:/bin;
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 plaforms:
63   tags: [ 'all' ]
64   stage: world build
65   script:
66     - ret=0;
67      ./tools/buildman/buildman -P -E arm -x aarch64 || ret=$?;
68      if [[ $ret -ne 0 && $ret -ne 129 ]]; then
69        ./tools/buildman/buildman -sdeP;
70        exit $ret;
71      fi;
72
73 build all 64bit ARM plaforms:
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 -P -E aarch64 || ret=$?;
82      if [[ $ret -ne 0 && $ret -ne 129 ]]; then
83        ./tools/buildman/buildman -sdeP;
84        exit $ret;
85      fi;
86
87 build all PowerPC plaforms:
88   tags: [ 'all' ]
89   stage: world build
90   script:
91     - ret=0;
92      ./tools/buildman/buildman -P -E powerpc || ret=$?;
93      if [[ $ret -ne 0 && $ret -ne 129 ]]; then
94        ./tools/buildman/buildman -sdeP;
95        exit $ret;
96      fi;
97
98 build all other plaforms:
99   tags: [ 'all' ]
100   stage: world build
101   script:
102     - ret=0;
103      ./tools/buildman/buildman -P -E -x arm,powerpc || ret=$?;
104      if [[ $ret -ne 0 && $ret -ne 129 ]]; then
105        ./tools/buildman/buildman -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 # Run various tool tests
149 Run patman testsuite:
150   tags: [ 'all' ]
151   stage: testsuites
152   script:
153     - git config --global user.name "GitLab CI Runner"
154     - git config --global user.email trini@konsulko.com
155     - export USER=gitlab
156     - ./tools/patman/patman --test
157
158 Run buildman testsuite:
159   tags: [ 'all' ]
160   stage: testsuites
161   script:
162     - export USER=gitlab
163     - ./tools/buildman/buildman -t
164
165 Run binman and dtoc testsuite:
166   tags: [ 'all' ]
167   stage: testsuites
168   script:
169     - virtualenv /tmp/venv
170     - . /tmp/venv/bin/activate
171     - pip install pyelftools
172     - export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/sandbox_spl;
173       ./tools/buildman/buildman -P sandbox_spl && 
174      export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
175      export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
176      ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test &&
177      ./tools/dtoc/dtoc -t
178
179 # Test sandbox with test.py
180 sandbox test.py:
181   tags: [ 'all' ]
182   variables:
183     TEST_PY_BD: "sandbox"
184     BUILDMAN: "^sandbox$"
185   <<: *buildman_and_testpy_dfn
186
187 sandbox_spl test.py:
188   tags: [ 'all' ]
189   variables:
190     TEST_PY_BD: "sandbox_spl"
191     BUILDMAN: "^sandbox_spl$"
192     TEST_PY_TEST_SPEC: "test_ofplatdata"
193   <<: *buildman_and_testpy_dfn
194
195 evb-ast2500 test.py:
196   tags: [ 'all' ]
197   variables:
198     TEST_PY_BD: "evb-ast2500"
199     TEST_PY_ID: "--id qemu"
200     BUILDMAN: "^evb-ast2500$"
201   <<: *buildman_and_testpy_dfn
202
203 sandbox_flattree test.py:
204   tags: [ 'all' ]
205   variables:
206     TEST_PY_BD: "sandbox_flattree"
207     BUILDMAN: "^sandbox_flattree$"
208   <<: *buildman_and_testpy_dfn
209
210 vexpress_ca15_tc2 test.py:
211   tags: [ 'all' ]
212   variables:
213     TEST_PY_BD: "vexpress_ca15_tc2"
214     TEST_PY_ID: "--id qemu"
215     BUILDMAN: "^vexpress_ca15_tc2$"
216   <<: *buildman_and_testpy_dfn
217
218 vexpress_ca9x4 test.py:
219   tags: [ 'all' ]
220   variables:
221     TEST_PY_BD: "vexpress_ca9x4"
222     TEST_PY_ID: "--id qemu"
223     BUILDMAN: "^vexpress_ca9x4$"
224   <<: *buildman_and_testpy_dfn
225
226 integratorcp_cm926ejs test.py:
227   tags: [ 'all' ]
228   variables:
229     TEST_PY_BD: "integratorcp_cm926ejs"
230     TEST_PY_TEST_SPEC: "not sleep"
231     TEST_PY_ID: "--id qemu"
232     BUILDMAN: "^integratorcp_cm926ejs$"
233   <<: *buildman_and_testpy_dfn
234
235 qemu_arm test.py:
236   tags: [ 'all' ]
237   variables:
238     TEST_PY_BD: "qemu_arm"
239     TEST_PY_TEST_SPEC: "not sleep"
240     BUILDMAN: "^qemu_arm$"
241   <<: *buildman_and_testpy_dfn
242
243 qemu_arm64 test.py:
244   tags: [ 'all' ]
245   variables:
246     TEST_PY_BD: "qemu_arm64"
247     TEST_PY_TEST_SPEC: "not sleep"
248     BUILDMAN: "^qemu_arm64$"
249   <<: *buildman_and_testpy_dfn
250
251 qemu_mips test.py:
252   tags: [ 'all' ]
253   variables:
254     TEST_PY_BD: "qemu_mips"
255     TEST_PY_TEST_SPEC: "not sleep"
256     BUILDMAN: "^qemu_mips$"
257   <<: *buildman_and_testpy_dfn
258
259 qemu_mipsel test.py:
260   tags: [ 'all' ]
261   variables:
262     TEST_PY_BD: "qemu_mipsel"
263     TEST_PY_TEST_SPEC: "not sleep"
264     BUILDMAN: "^qemu_mipsel$"
265   <<: *buildman_and_testpy_dfn
266
267 qemu_mips64 test.py:
268   tags: [ 'all' ]
269   variables:
270     TEST_PY_BD: "qemu_mips64"
271     TEST_PY_TEST_SPEC: "not sleep"
272     BUILDMAN: "^qemu_mips64$"
273   <<: *buildman_and_testpy_dfn
274
275 qemu_mips64el test.py:
276   tags: [ 'all' ]
277   variables:
278     TEST_PY_BD: "qemu_mips64el"
279     TEST_PY_TEST_SPEC: "not sleep"
280     BUILDMAN: "^qemu_mips64el$"
281   <<: *buildman_and_testpy_dfn
282
283 qemu-ppce500 test.py:
284   tags: [ 'all' ]
285   variables:
286     TEST_PY_BD: "qemu-ppce500"
287     TEST_PY_TEST_SPEC: "not sleep"
288     BUILDMAN: "^qemu-ppce500$"
289   <<: *buildman_and_testpy_dfn
290
291 qemu-riscv64 test.py:
292   tags: [ 'all' ]
293   variables:
294     TEST_PY_BD: "qemu-riscv64"
295     TEST_PY_TEST_SPEC: "not sleep"
296     BUILDMAN: "^qemu-riscv64$"
297   <<: *buildman_and_testpy_dfn
298
299 qemu-x86 test.py:
300   tags: [ 'all' ]
301   variables:
302     TEST_PY_BD: "qemu-x86"
303     TEST_PY_TEST_SPEC: "not sleep"
304     BUILDMAN: "^qemu-x86$"
305   <<: *buildman_and_testpy_dfn
306
307 qemu-x86_64 test.py:
308   tags: [ 'all' ]
309   variables:
310     TEST_PY_BD: "qemu-x86_64"
311     TEST_PY_TEST_SPEC: "not sleep"
312     BUILDMAN: "^qemu-x86_64$"
313   <<: *buildman_and_testpy_dfn
314
315 zynq_zc702 test.py:
316   tags: [ 'all' ]
317   variables:
318     TEST_PY_BD: "zynq_zc702"
319     TEST_PY_TEST_SPEC: "not sleep"
320     TEST_PY_ID: "--id qemu"
321     BUILDMAN: "^zynq_zc702$"
322   <<: *buildman_and_testpy_dfn
323
324 xilinx_versal_virt test.py:
325   tags: [ 'all' ]
326   variables:
327     TEST_PY_BD: "xilinx_versal_virt"
328     TEST_PY_TEST_SPEC: "not sleep"
329     TEST_PY_ID: "--id qemu"
330     BUILDMAN: "^xilinx_versal_virt$"
331   <<: *buildman_and_testpy_dfn
332
333 xtfpga test.py:
334   tags: [ 'all' ]
335   variables:
336     TEST_PY_BD: "xtfpga"
337     TEST_PY_TEST_SPEC: "not sleep"
338     TEST_PY_ID: "--id qemu"
339     BUILDMAN: "^xtfpga$"
340   <<: *buildman_and_testpy_dfn