.gitlab-ci.yml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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-20200112-21Feb2020
  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 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;
  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. # Test sandbox with test.py
  163. sandbox test.py:
  164. tags: [ 'all' ]
  165. variables:
  166. TEST_PY_BD: "sandbox"
  167. BUILDMAN: "^sandbox$"
  168. <<: *buildman_and_testpy_dfn
  169. sandbox with clang test.py:
  170. tags: [ 'all' ]
  171. variables:
  172. TEST_PY_BD: "sandbox"
  173. BUILDMAN: "^sandbox$"
  174. OVERRIDE: "-O clang-7"
  175. <<: *buildman_and_testpy_dfn
  176. sandbox_spl test.py:
  177. tags: [ 'all' ]
  178. variables:
  179. TEST_PY_BD: "sandbox_spl"
  180. BUILDMAN: "^sandbox_spl$"
  181. TEST_PY_TEST_SPEC: "test_ofplatdata"
  182. <<: *buildman_and_testpy_dfn
  183. evb-ast2500 test.py:
  184. tags: [ 'all' ]
  185. variables:
  186. TEST_PY_BD: "evb-ast2500"
  187. TEST_PY_ID: "--id qemu"
  188. BUILDMAN: "^evb-ast2500$"
  189. <<: *buildman_and_testpy_dfn
  190. sandbox_flattree test.py:
  191. tags: [ 'all' ]
  192. variables:
  193. TEST_PY_BD: "sandbox_flattree"
  194. BUILDMAN: "^sandbox_flattree$"
  195. <<: *buildman_and_testpy_dfn
  196. vexpress_ca15_tc2 test.py:
  197. tags: [ 'all' ]
  198. variables:
  199. TEST_PY_BD: "vexpress_ca15_tc2"
  200. TEST_PY_ID: "--id qemu"
  201. BUILDMAN: "^vexpress_ca15_tc2$"
  202. <<: *buildman_and_testpy_dfn
  203. vexpress_ca9x4 test.py:
  204. tags: [ 'all' ]
  205. variables:
  206. TEST_PY_BD: "vexpress_ca9x4"
  207. TEST_PY_ID: "--id qemu"
  208. BUILDMAN: "^vexpress_ca9x4$"
  209. <<: *buildman_and_testpy_dfn
  210. integratorcp_cm926ejs test.py:
  211. tags: [ 'all' ]
  212. variables:
  213. TEST_PY_BD: "integratorcp_cm926ejs"
  214. TEST_PY_TEST_SPEC: "not sleep"
  215. TEST_PY_ID: "--id qemu"
  216. BUILDMAN: "^integratorcp_cm926ejs$"
  217. <<: *buildman_and_testpy_dfn
  218. qemu_arm test.py:
  219. tags: [ 'all' ]
  220. variables:
  221. TEST_PY_BD: "qemu_arm"
  222. TEST_PY_TEST_SPEC: "not sleep"
  223. BUILDMAN: "^qemu_arm$"
  224. <<: *buildman_and_testpy_dfn
  225. qemu_arm64 test.py:
  226. tags: [ 'all' ]
  227. variables:
  228. TEST_PY_BD: "qemu_arm64"
  229. TEST_PY_TEST_SPEC: "not sleep"
  230. BUILDMAN: "^qemu_arm64$"
  231. <<: *buildman_and_testpy_dfn
  232. qemu_mips test.py:
  233. tags: [ 'all' ]
  234. variables:
  235. TEST_PY_BD: "qemu_mips"
  236. TEST_PY_TEST_SPEC: "not sleep"
  237. BUILDMAN: "^qemu_mips$"
  238. <<: *buildman_and_testpy_dfn
  239. qemu_mipsel test.py:
  240. tags: [ 'all' ]
  241. variables:
  242. TEST_PY_BD: "qemu_mipsel"
  243. TEST_PY_TEST_SPEC: "not sleep"
  244. BUILDMAN: "^qemu_mipsel$"
  245. <<: *buildman_and_testpy_dfn
  246. qemu_mips64 test.py:
  247. tags: [ 'all' ]
  248. variables:
  249. TEST_PY_BD: "qemu_mips64"
  250. TEST_PY_TEST_SPEC: "not sleep"
  251. BUILDMAN: "^qemu_mips64$"
  252. <<: *buildman_and_testpy_dfn
  253. qemu_mips64el test.py:
  254. tags: [ 'all' ]
  255. variables:
  256. TEST_PY_BD: "qemu_mips64el"
  257. TEST_PY_TEST_SPEC: "not sleep"
  258. BUILDMAN: "^qemu_mips64el$"
  259. <<: *buildman_and_testpy_dfn
  260. qemu-ppce500 test.py:
  261. tags: [ 'all' ]
  262. variables:
  263. TEST_PY_BD: "qemu-ppce500"
  264. TEST_PY_TEST_SPEC: "not sleep"
  265. BUILDMAN: "^qemu-ppce500$"
  266. <<: *buildman_and_testpy_dfn
  267. qemu-riscv64 test.py:
  268. tags: [ 'all' ]
  269. variables:
  270. TEST_PY_BD: "qemu-riscv64"
  271. TEST_PY_TEST_SPEC: "not sleep"
  272. BUILDMAN: "^qemu-riscv64$"
  273. <<: *buildman_and_testpy_dfn
  274. qemu-x86 test.py:
  275. tags: [ 'all' ]
  276. variables:
  277. TEST_PY_BD: "qemu-x86"
  278. TEST_PY_TEST_SPEC: "not sleep"
  279. BUILDMAN: "^qemu-x86$"
  280. <<: *buildman_and_testpy_dfn
  281. qemu-x86_64 test.py:
  282. tags: [ 'all' ]
  283. variables:
  284. TEST_PY_BD: "qemu-x86_64"
  285. TEST_PY_TEST_SPEC: "not sleep"
  286. BUILDMAN: "^qemu-x86_64$"
  287. <<: *buildman_and_testpy_dfn
  288. zynq_zc702 test.py:
  289. tags: [ 'all' ]
  290. variables:
  291. TEST_PY_BD: "zynq_zc702"
  292. TEST_PY_TEST_SPEC: "not sleep"
  293. TEST_PY_ID: "--id qemu"
  294. BUILDMAN: "^zynq_zc702$"
  295. <<: *buildman_and_testpy_dfn
  296. xilinx_versal_virt test.py:
  297. tags: [ 'all' ]
  298. variables:
  299. TEST_PY_BD: "xilinx_versal_virt"
  300. TEST_PY_TEST_SPEC: "not sleep"
  301. TEST_PY_ID: "--id qemu"
  302. BUILDMAN: "^xilinx_versal_virt$"
  303. <<: *buildman_and_testpy_dfn
  304. xtfpga test.py:
  305. tags: [ 'all' ]
  306. variables:
  307. TEST_PY_BD: "xtfpga"
  308. TEST_PY_TEST_SPEC: "not sleep"
  309. TEST_PY_ID: "--id qemu"
  310. BUILDMAN: "^xtfpga$"
  311. <<: *buildman_and_testpy_dfn