.gitlab-ci.yml 11 KB

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