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