.gitlab-ci.yml 9.4 KB

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