.gitlab-ci.yml 9.8 KB

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