.gitlab-ci.yml 9.5 KB

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