.gitlab-ci.yml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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/grubriscv32.efi ~/grub_riscv32.efi
  22. - cp /opt/grub/grubaa64.efi ~/grub_arm64.efi
  23. - cp /opt/grub/grubarm.efi ~/grub_arm.efi
  24. - if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
  25. wget -O - https://github.com/riscv/opensbi/releases/download/v0.6/opensbi-0.6-rv32-bin.tar.xz | tar -C /tmp -xJ;
  26. export OPENSBI=/tmp/opensbi-0.6-rv32-bin/platform/qemu/virt/firmware/fw_dynamic.bin;
  27. fi
  28. - if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]]; then
  29. wget -O - https://github.com/riscv/opensbi/releases/download/v0.6/opensbi-0.6-rv64-bin.tar.xz | tar -C /tmp -xJ;
  30. export OPENSBI=/tmp/opensbi-0.6-rv64-bin/platform/qemu/virt/firmware/fw_dynamic.bin;
  31. fi
  32. after_script:
  33. - rm -rf /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 -o /tmp -P -E ${BUILDMAN} ${OVERRIDE}|| ret=$?;
  40. if [[ $ret -ne 0 && $ret -ne 129 ]]; then
  41. tools/buildman/buildman -o /tmp -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. - virtualenv -p /usr/bin/python3 /tmp/venv
  50. - . /tmp/venv/bin/activate
  51. - pip install -r test/py/requirements.txt
  52. - export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/${TEST_PY_BD};
  53. export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
  54. export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
  55. if [[ "${TEST_PY_BD}" != "" ]]; then
  56. ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
  57. -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
  58. --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
  59. ret=$?;
  60. if [[ $ret -ne 0 ]]; then
  61. exit $ret;
  62. fi;
  63. fi;
  64. build all 32bit ARM platforms:
  65. tags: [ 'all' ]
  66. stage: world build
  67. script:
  68. - ret=0;
  69. ./tools/buildman/buildman -o /tmp -P -E arm -x aarch64 || ret=$?;
  70. if [[ $ret -ne 0 && $ret -ne 129 ]]; then
  71. ./tools/buildman/buildman -o /tmp -sdeP;
  72. exit $ret;
  73. fi;
  74. build all 64bit ARM platforms:
  75. tags: [ 'all' ]
  76. stage: world build
  77. script:
  78. - virtualenv -p /usr/bin/python3 /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. build all PowerPC platforms:
  88. tags: [ 'all' ]
  89. stage: world build
  90. script:
  91. - ret=0;
  92. ./tools/buildman/buildman -o /tmp -P -E powerpc || ret=$?;
  93. if [[ $ret -ne 0 && $ret -ne 129 ]]; then
  94. ./tools/buildman/buildman -o /tmp -sdeP;
  95. exit $ret;
  96. fi;
  97. build all other platforms:
  98. tags: [ 'all' ]
  99. stage: world build
  100. script:
  101. - ret=0;
  102. ./tools/buildman/buildman -o /tmp -P -E -x arm,powerpc || ret=$?;
  103. if [[ $ret -ne 0 && $ret -ne 129 ]]; then
  104. ./tools/buildman/buildman -o /tmp -sdeP;
  105. exit $ret;
  106. fi;
  107. # QA jobs for code analytics
  108. # static code analysis with cppcheck (we can add --enable=all later)
  109. cppcheck:
  110. tags: [ 'all' ]
  111. stage: testsuites
  112. script:
  113. - cppcheck --force --quiet --inline-suppr .
  114. # search for TODO within source tree
  115. grep TODO/FIXME/HACK:
  116. tags: [ 'all' ]
  117. stage: testsuites
  118. script:
  119. - grep -r TODO .
  120. - grep -r FIXME .
  121. # search for HACK within source tree and ignore HACKKIT board
  122. - grep -r HACK . | grep -v HACKKIT
  123. # build HTML documentation
  124. htmldocs:
  125. tags: [ 'all' ]
  126. stage: testsuites
  127. script:
  128. - make htmldocs
  129. # some statistics about the code base
  130. sloccount:
  131. tags: [ 'all' ]
  132. stage: testsuites
  133. script:
  134. - sloccount .
  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. # 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. # Ensure env tools build
  148. Build envtools:
  149. tags: [ 'all' ]
  150. stage: testsuites
  151. script:
  152. - make tools-only_config envtools -j$(nproc)
  153. Run binman, buildman, dtoc, Kconfig and patman testsuites:
  154. tags: [ 'all' ]
  155. stage: testsuites
  156. script:
  157. - git config --global user.name "GitLab CI Runner";
  158. git config --global user.email trini@konsulko.com;
  159. export USER=gitlab;
  160. virtualenv -p /usr/bin/python3 /tmp/venv;
  161. . /tmp/venv/bin/activate;
  162. pip install pyelftools pytest;
  163. export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/sandbox_spl;
  164. export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
  165. export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
  166. ./tools/buildman/buildman -o /tmp -P sandbox_spl;
  167. ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
  168. ./tools/buildman/buildman -t;
  169. ./tools/dtoc/dtoc -t;
  170. ./tools/patman/patman --test;
  171. make testconfig
  172. # Test sandbox with test.py
  173. sandbox test.py:
  174. tags: [ 'all' ]
  175. variables:
  176. TEST_PY_BD: "sandbox"
  177. BUILDMAN: "^sandbox$"
  178. <<: *buildman_and_testpy_dfn
  179. sandbox with clang test.py:
  180. tags: [ 'all' ]
  181. variables:
  182. TEST_PY_BD: "sandbox"
  183. BUILDMAN: "^sandbox$"
  184. OVERRIDE: "-O clang-7"
  185. <<: *buildman_and_testpy_dfn
  186. sandbox_spl test.py:
  187. tags: [ 'all' ]
  188. variables:
  189. TEST_PY_BD: "sandbox_spl"
  190. BUILDMAN: "^sandbox_spl$"
  191. TEST_PY_TEST_SPEC: "test_ofplatdata"
  192. <<: *buildman_and_testpy_dfn
  193. evb-ast2500 test.py:
  194. tags: [ 'all' ]
  195. variables:
  196. TEST_PY_BD: "evb-ast2500"
  197. TEST_PY_ID: "--id qemu"
  198. BUILDMAN: "^evb-ast2500$"
  199. <<: *buildman_and_testpy_dfn
  200. sandbox_flattree test.py:
  201. tags: [ 'all' ]
  202. variables:
  203. TEST_PY_BD: "sandbox_flattree"
  204. BUILDMAN: "^sandbox_flattree$"
  205. <<: *buildman_and_testpy_dfn
  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. vexpress_ca9x4 test.py:
  214. tags: [ 'all' ]
  215. variables:
  216. TEST_PY_BD: "vexpress_ca9x4"
  217. TEST_PY_ID: "--id qemu"
  218. BUILDMAN: "^vexpress_ca9x4$"
  219. <<: *buildman_and_testpy_dfn
  220. integratorcp_cm926ejs test.py:
  221. tags: [ 'all' ]
  222. variables:
  223. TEST_PY_BD: "integratorcp_cm926ejs"
  224. TEST_PY_TEST_SPEC: "not sleep"
  225. TEST_PY_ID: "--id qemu"
  226. BUILDMAN: "^integratorcp_cm926ejs$"
  227. <<: *buildman_and_testpy_dfn
  228. qemu_arm test.py:
  229. tags: [ 'all' ]
  230. variables:
  231. TEST_PY_BD: "qemu_arm"
  232. TEST_PY_TEST_SPEC: "not sleep"
  233. BUILDMAN: "^qemu_arm$"
  234. <<: *buildman_and_testpy_dfn
  235. qemu_arm64 test.py:
  236. tags: [ 'all' ]
  237. variables:
  238. TEST_PY_BD: "qemu_arm64"
  239. TEST_PY_TEST_SPEC: "not sleep"
  240. BUILDMAN: "^qemu_arm64$"
  241. <<: *buildman_and_testpy_dfn
  242. qemu_mips test.py:
  243. tags: [ 'all' ]
  244. variables:
  245. TEST_PY_BD: "qemu_mips"
  246. TEST_PY_TEST_SPEC: "not sleep"
  247. BUILDMAN: "^qemu_mips$"
  248. <<: *buildman_and_testpy_dfn
  249. qemu_mipsel test.py:
  250. tags: [ 'all' ]
  251. variables:
  252. TEST_PY_BD: "qemu_mipsel"
  253. TEST_PY_TEST_SPEC: "not sleep"
  254. BUILDMAN: "^qemu_mipsel$"
  255. <<: *buildman_and_testpy_dfn
  256. qemu_mips64 test.py:
  257. tags: [ 'all' ]
  258. variables:
  259. TEST_PY_BD: "qemu_mips64"
  260. TEST_PY_TEST_SPEC: "not sleep"
  261. BUILDMAN: "^qemu_mips64$"
  262. <<: *buildman_and_testpy_dfn
  263. qemu_mips64el test.py:
  264. tags: [ 'all' ]
  265. variables:
  266. TEST_PY_BD: "qemu_mips64el"
  267. TEST_PY_TEST_SPEC: "not sleep"
  268. BUILDMAN: "^qemu_mips64el$"
  269. <<: *buildman_and_testpy_dfn
  270. qemu-ppce500 test.py:
  271. tags: [ 'all' ]
  272. variables:
  273. TEST_PY_BD: "qemu-ppce500"
  274. TEST_PY_TEST_SPEC: "not sleep"
  275. BUILDMAN: "^qemu-ppce500$"
  276. <<: *buildman_and_testpy_dfn
  277. qemu-riscv32 test.py:
  278. tags: [ 'all' ]
  279. variables:
  280. TEST_PY_BD: "qemu-riscv32"
  281. TEST_PY_TEST_SPEC: "not sleep"
  282. BUILDMAN: "^qemu-riscv32$"
  283. <<: *buildman_and_testpy_dfn
  284. qemu-riscv64 test.py:
  285. tags: [ 'all' ]
  286. variables:
  287. TEST_PY_BD: "qemu-riscv64"
  288. TEST_PY_TEST_SPEC: "not sleep"
  289. BUILDMAN: "^qemu-riscv64$"
  290. <<: *buildman_and_testpy_dfn
  291. qemu-riscv32_spl test.py:
  292. tags: [ 'all' ]
  293. variables:
  294. TEST_PY_BD: "qemu-riscv32_spl"
  295. TEST_PY_TEST_SPEC: "not sleep"
  296. BUILDMAN: "^qemu-riscv32_spl$"
  297. <<: *buildman_and_testpy_dfn
  298. qemu-riscv64_spl test.py:
  299. tags: [ 'all' ]
  300. variables:
  301. TEST_PY_BD: "qemu-riscv64_spl"
  302. TEST_PY_TEST_SPEC: "not sleep"
  303. BUILDMAN: "^qemu-riscv64_spl$"
  304. <<: *buildman_and_testpy_dfn
  305. qemu-x86 test.py:
  306. tags: [ 'all' ]
  307. variables:
  308. TEST_PY_BD: "qemu-x86"
  309. TEST_PY_TEST_SPEC: "not sleep"
  310. BUILDMAN: "^qemu-x86$"
  311. <<: *buildman_and_testpy_dfn
  312. qemu-x86_64 test.py:
  313. tags: [ 'all' ]
  314. variables:
  315. TEST_PY_BD: "qemu-x86_64"
  316. TEST_PY_TEST_SPEC: "not sleep"
  317. BUILDMAN: "^qemu-x86_64$"
  318. <<: *buildman_and_testpy_dfn
  319. xilinx_zynq_virt test.py:
  320. tags: [ 'all' ]
  321. variables:
  322. TEST_PY_BD: "xilinx_zynq_virt"
  323. TEST_PY_TEST_SPEC: "not sleep"
  324. TEST_PY_ID: "--id qemu"
  325. BUILDMAN: "^xilinx_zynq_virt$"
  326. <<: *buildman_and_testpy_dfn
  327. xilinx_versal_virt test.py:
  328. tags: [ 'all' ]
  329. variables:
  330. TEST_PY_BD: "xilinx_versal_virt"
  331. TEST_PY_TEST_SPEC: "not sleep"
  332. TEST_PY_ID: "--id qemu"
  333. BUILDMAN: "^xilinx_versal_virt$"
  334. <<: *buildman_and_testpy_dfn
  335. xtfpga test.py:
  336. tags: [ 'all' ]
  337. variables:
  338. TEST_PY_BD: "xtfpga"
  339. TEST_PY_TEST_SPEC: "not sleep"
  340. TEST_PY_ID: "--id qemu"
  341. BUILDMAN: "^xtfpga$"
  342. <<: *buildman_and_testpy_dfn