.gitlab-ci.yml 9.3 KB

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