.gitlab-ci.yml 9.6 KB

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