.gitlab-ci.yml 10 KB

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