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