.gitlab-ci.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. # SPDX-License-Identifier: GPL-2.0+
  2. # Grab our configured image. The source for this is found at:
  3. # https://source.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 https://source.denx.de/u-boot/u-boot-test-hooks /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. - virtualenv -p /usr/bin/python3 /tmp/venvhtml
  115. - . /tmp/venvhtml/bin/activate
  116. - pip install -r doc/sphinx/requirements.txt
  117. - make htmldocs
  118. # some statistics about the code base
  119. sloccount:
  120. tags: [ 'all' ]
  121. stage: testsuites
  122. script:
  123. - sloccount .
  124. # ensure all configs have MAINTAINERS entries
  125. Check for configs without MAINTAINERS entry:
  126. tags: [ 'all' ]
  127. stage: testsuites
  128. script:
  129. - if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
  130. # Ensure host tools build
  131. Build tools-only:
  132. tags: [ 'all' ]
  133. stage: testsuites
  134. script:
  135. - make tools-only_config tools-only -j$(nproc)
  136. # Ensure env tools build
  137. Build envtools:
  138. tags: [ 'all' ]
  139. stage: testsuites
  140. script:
  141. - make tools-only_config envtools -j$(nproc)
  142. Run binman, buildman, dtoc, Kconfig and patman testsuites:
  143. tags: [ 'all' ]
  144. stage: testsuites
  145. script:
  146. - git config --global user.name "GitLab CI Runner";
  147. git config --global user.email trini@konsulko.com;
  148. export USER=gitlab;
  149. virtualenv -p /usr/bin/python3 /tmp/venv;
  150. . /tmp/venv/bin/activate;
  151. pip install pyelftools pytest pygit2;
  152. export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl;
  153. export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
  154. export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
  155. ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w
  156. --board 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. Run tests for Nokia RX-51 (aka N900):
  163. tags: [ 'all' ]
  164. stage: testsuites
  165. script:
  166. - ./tools/buildman/buildman --fetch-arch arm;
  167. export PATH=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/:$PATH;
  168. test/nokia_rx51_test.sh
  169. # Test sandbox with test.py
  170. sandbox test.py:
  171. tags: [ 'all' ]
  172. variables:
  173. TEST_PY_BD: "sandbox"
  174. <<: *buildman_and_testpy_dfn
  175. sandbox with clang test.py:
  176. tags: [ 'all' ]
  177. variables:
  178. TEST_PY_BD: "sandbox"
  179. OVERRIDE: "-O clang-10"
  180. <<: *buildman_and_testpy_dfn
  181. sandbox_spl test.py:
  182. tags: [ 'all' ]
  183. variables:
  184. TEST_PY_BD: "sandbox_spl"
  185. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
  186. <<: *buildman_and_testpy_dfn
  187. sandbox_noinst_test.py:
  188. tags: [ 'all' ]
  189. variables:
  190. TEST_PY_BD: "sandbox_noinst"
  191. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
  192. <<: *buildman_and_testpy_dfn
  193. evb-ast2500 test.py:
  194. tags: [ 'all' ]
  195. variables:
  196. TEST_PY_BD: "evb-ast2500"
  197. TEST_PY_ID: "--id qemu"
  198. <<: *buildman_and_testpy_dfn
  199. sandbox_flattree test.py:
  200. tags: [ 'all' ]
  201. variables:
  202. TEST_PY_BD: "sandbox_flattree"
  203. <<: *buildman_and_testpy_dfn
  204. vexpress_ca15_tc2 test.py:
  205. tags: [ 'all' ]
  206. variables:
  207. TEST_PY_BD: "vexpress_ca15_tc2"
  208. TEST_PY_ID: "--id qemu"
  209. <<: *buildman_and_testpy_dfn
  210. vexpress_ca9x4 test.py:
  211. tags: [ 'all' ]
  212. variables:
  213. TEST_PY_BD: "vexpress_ca9x4"
  214. TEST_PY_ID: "--id qemu"
  215. <<: *buildman_and_testpy_dfn
  216. integratorcp_cm926ejs test.py:
  217. tags: [ 'all' ]
  218. variables:
  219. TEST_PY_BD: "integratorcp_cm926ejs"
  220. TEST_PY_TEST_SPEC: "not sleep"
  221. TEST_PY_ID: "--id qemu"
  222. <<: *buildman_and_testpy_dfn
  223. qemu_arm test.py:
  224. tags: [ 'all' ]
  225. variables:
  226. TEST_PY_BD: "qemu_arm"
  227. TEST_PY_TEST_SPEC: "not sleep"
  228. <<: *buildman_and_testpy_dfn
  229. qemu_arm64 test.py:
  230. tags: [ 'all' ]
  231. variables:
  232. TEST_PY_BD: "qemu_arm64"
  233. TEST_PY_TEST_SPEC: "not sleep"
  234. <<: *buildman_and_testpy_dfn
  235. qemu_mips test.py:
  236. tags: [ 'all' ]
  237. variables:
  238. TEST_PY_BD: "qemu_mips"
  239. TEST_PY_TEST_SPEC: "not sleep"
  240. <<: *buildman_and_testpy_dfn
  241. qemu_mipsel test.py:
  242. tags: [ 'all' ]
  243. variables:
  244. TEST_PY_BD: "qemu_mipsel"
  245. TEST_PY_TEST_SPEC: "not sleep"
  246. <<: *buildman_and_testpy_dfn
  247. qemu_mips64 test.py:
  248. tags: [ 'all' ]
  249. variables:
  250. TEST_PY_BD: "qemu_mips64"
  251. TEST_PY_TEST_SPEC: "not sleep"
  252. <<: *buildman_and_testpy_dfn
  253. qemu_mips64el test.py:
  254. tags: [ 'all' ]
  255. variables:
  256. TEST_PY_BD: "qemu_mips64el"
  257. TEST_PY_TEST_SPEC: "not sleep"
  258. <<: *buildman_and_testpy_dfn
  259. qemu_malta test.py:
  260. tags: [ 'all' ]
  261. variables:
  262. TEST_PY_BD: "malta"
  263. TEST_PY_TEST_SPEC: "not sleep and not efi"
  264. TEST_PY_ID: "--id qemu"
  265. <<: *buildman_and_testpy_dfn
  266. qemu_maltael test.py:
  267. tags: [ 'all' ]
  268. variables:
  269. TEST_PY_BD: "maltael"
  270. TEST_PY_TEST_SPEC: "not sleep and not efi"
  271. TEST_PY_ID: "--id qemu"
  272. <<: *buildman_and_testpy_dfn
  273. qemu_malta64 test.py:
  274. tags: [ 'all' ]
  275. variables:
  276. TEST_PY_BD: "malta64"
  277. TEST_PY_TEST_SPEC: "not sleep and not efi"
  278. TEST_PY_ID: "--id qemu"
  279. <<: *buildman_and_testpy_dfn
  280. qemu_malta64el test.py:
  281. tags: [ 'all' ]
  282. variables:
  283. TEST_PY_BD: "malta64el"
  284. TEST_PY_TEST_SPEC: "not sleep and not efi"
  285. TEST_PY_ID: "--id qemu"
  286. <<: *buildman_and_testpy_dfn
  287. qemu-ppce500 test.py:
  288. tags: [ 'all' ]
  289. variables:
  290. TEST_PY_BD: "qemu-ppce500"
  291. TEST_PY_TEST_SPEC: "not sleep"
  292. <<: *buildman_and_testpy_dfn
  293. qemu-riscv32 test.py:
  294. tags: [ 'all' ]
  295. variables:
  296. TEST_PY_BD: "qemu-riscv32"
  297. TEST_PY_TEST_SPEC: "not sleep"
  298. <<: *buildman_and_testpy_dfn
  299. qemu-riscv64 test.py:
  300. tags: [ 'all' ]
  301. variables:
  302. TEST_PY_BD: "qemu-riscv64"
  303. TEST_PY_TEST_SPEC: "not sleep"
  304. <<: *buildman_and_testpy_dfn
  305. qemu-riscv32_spl test.py:
  306. tags: [ 'all' ]
  307. variables:
  308. TEST_PY_BD: "qemu-riscv32_spl"
  309. TEST_PY_TEST_SPEC: "not sleep"
  310. <<: *buildman_and_testpy_dfn
  311. qemu-riscv64_spl test.py:
  312. tags: [ 'all' ]
  313. variables:
  314. TEST_PY_BD: "qemu-riscv64_spl"
  315. TEST_PY_TEST_SPEC: "not sleep"
  316. <<: *buildman_and_testpy_dfn
  317. qemu-x86 test.py:
  318. tags: [ 'all' ]
  319. variables:
  320. TEST_PY_BD: "qemu-x86"
  321. TEST_PY_TEST_SPEC: "not sleep"
  322. <<: *buildman_and_testpy_dfn
  323. qemu-x86_64 test.py:
  324. tags: [ 'all' ]
  325. variables:
  326. TEST_PY_BD: "qemu-x86_64"
  327. TEST_PY_TEST_SPEC: "not sleep"
  328. <<: *buildman_and_testpy_dfn
  329. r2dplus_i82557c test.py:
  330. tags: [ 'all' ]
  331. variables:
  332. TEST_PY_BD: "r2dplus"
  333. TEST_PY_ID: "--id i82557c_qemu"
  334. <<: *buildman_and_testpy_dfn
  335. r2dplus_pcnet test.py:
  336. tags: [ 'all' ]
  337. variables:
  338. TEST_PY_BD: "r2dplus"
  339. TEST_PY_ID: "--id pcnet_qemu"
  340. <<: *buildman_and_testpy_dfn
  341. r2dplus_rtl8139 test.py:
  342. tags: [ 'all' ]
  343. variables:
  344. TEST_PY_BD: "r2dplus"
  345. TEST_PY_ID: "--id rtl8139_qemu"
  346. <<: *buildman_and_testpy_dfn
  347. r2dplus_tulip test.py:
  348. tags: [ 'all' ]
  349. variables:
  350. TEST_PY_BD: "r2dplus"
  351. TEST_PY_ID: "--id tulip_qemu"
  352. <<: *buildman_and_testpy_dfn
  353. xilinx_zynq_virt test.py:
  354. tags: [ 'all' ]
  355. variables:
  356. TEST_PY_BD: "xilinx_zynq_virt"
  357. TEST_PY_TEST_SPEC: "not sleep"
  358. TEST_PY_ID: "--id qemu"
  359. <<: *buildman_and_testpy_dfn
  360. xilinx_versal_virt test.py:
  361. tags: [ 'all' ]
  362. variables:
  363. TEST_PY_BD: "xilinx_versal_virt"
  364. TEST_PY_TEST_SPEC: "not sleep"
  365. TEST_PY_ID: "--id qemu"
  366. <<: *buildman_and_testpy_dfn
  367. xtfpga test.py:
  368. tags: [ 'all' ]
  369. variables:
  370. TEST_PY_BD: "xtfpga"
  371. TEST_PY_TEST_SPEC: "not sleep"
  372. TEST_PY_ID: "--id qemu"
  373. <<: *buildman_and_testpy_dfn