.gitlab-ci.yml 9.7 KB

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