.gitlab-ci.yml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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-20190912.1-03Oct2019
  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. - virtualenv /tmp/venv
  19. - . /tmp/venv/bin/activate
  20. - pip install pytest==2.8.7
  21. - pip install python-subunit
  22. - pip install coverage
  23. - grub-mkimage --prefix="" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  24. - grub-mkimage --prefix="" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  25. - mkdir ~/grub2-arm
  26. - ( cd ~/grub2-arm; wget -O - http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm | rpm2cpio | cpio -di )
  27. - mkdir ~/grub2-arm64
  28. - ( cd ~/grub2-arm64; wget -O - http://download.opensuse.org/ports/aarch64/distribution/leap/42.2/repo/oss/suse/aarch64/grub2-arm64-efi-2.02~beta2-87.1.aarch64.rpm | rpm2cpio | cpio -di )
  29. after_script:
  30. - rm -rf ~/grub2* /tmp/uboot-test-hooks /tmp/venv
  31. script:
  32. # From buildman, exit code 129 means warnings only. If we've been asked to
  33. # use clang only do one configuration.
  34. - if [[ "${BUILDMAN}" != "" ]]; then
  35. ret=0;
  36. tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} ${OVERRIDE}|| ret=$?;
  37. if [[ $ret -ne 0 && $ret -ne 129 ]]; then
  38. tools/buildman/buildman -o /tmp -sdeP ${BUILDMAN};
  39. exit $ret;
  40. fi;
  41. fi
  42. # "not a_test_which_does_not_exist" is a dummy -k parameter which will
  43. # never prevent any test from running. That way, we can always pass
  44. # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom
  45. # value.
  46. - export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/${TEST_PY_BD};
  47. export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:/usr/bin:/bin;
  48. export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
  49. if [[ "${TEST_PY_BD}" != "" ]]; then
  50. ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID}
  51. -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}"
  52. --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
  53. ret=$?;
  54. if [[ $ret -ne 0 ]]; then
  55. exit $ret;
  56. fi;
  57. fi;
  58. build all 32bit ARM platforms:
  59. tags: [ 'all' ]
  60. stage: world build
  61. script:
  62. - ret=0;
  63. ./tools/buildman/buildman -o /tmp -P -E arm -x aarch64 || ret=$?;
  64. if [[ $ret -ne 0 && $ret -ne 129 ]]; then
  65. ./tools/buildman/buildman -o /tmp -sdeP;
  66. exit $ret;
  67. fi;
  68. build all 64bit ARM platforms:
  69. tags: [ 'all' ]
  70. stage: world build
  71. script:
  72. - virtualenv /tmp/venv
  73. - . /tmp/venv/bin/activate
  74. - pip install pyelftools
  75. - ret=0;
  76. ./tools/buildman/buildman -o /tmp -P -E aarch64 || ret=$?;
  77. if [[ $ret -ne 0 && $ret -ne 129 ]]; then
  78. ./tools/buildman/buildman -o /tmp -sdeP;
  79. exit $ret;
  80. fi;
  81. build all PowerPC platforms:
  82. tags: [ 'all' ]
  83. stage: world build
  84. script:
  85. - ret=0;
  86. ./tools/buildman/buildman -o /tmp -P -E powerpc || ret=$?;
  87. if [[ $ret -ne 0 && $ret -ne 129 ]]; then
  88. ./tools/buildman/buildman -o /tmp -sdeP;
  89. exit $ret;
  90. fi;
  91. build all other platforms:
  92. tags: [ 'all' ]
  93. stage: world build
  94. script:
  95. - ret=0;
  96. ./tools/buildman/buildman -o /tmp -P -E -x arm,powerpc || ret=$?;
  97. if [[ $ret -ne 0 && $ret -ne 129 ]]; then
  98. ./tools/buildman/buildman -o /tmp -sdeP;
  99. exit $ret;
  100. fi;
  101. # QA jobs for code analytics
  102. # static code analysis with cppcheck (we can add --enable=all later)
  103. cppcheck:
  104. tags: [ 'all' ]
  105. stage: testsuites
  106. script:
  107. - cppcheck --force --quiet --inline-suppr .
  108. # search for TODO within source tree
  109. grep TODO/FIXME/HACK:
  110. tags: [ 'all' ]
  111. stage: testsuites
  112. script:
  113. - grep -r TODO .
  114. - grep -r FIXME .
  115. # search for HACK within source tree and ignore HACKKIT board
  116. - grep -r HACK . | grep -v HACKKIT
  117. # some statistics about the code base
  118. sloccount:
  119. tags: [ 'all' ]
  120. stage: testsuites
  121. script:
  122. - sloccount .
  123. # ensure all configs have MAINTAINERS entries
  124. Check for configs without MAINTAINERS entry:
  125. tags: [ 'all' ]
  126. stage: testsuites
  127. script:
  128. - if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
  129. # Ensure host tools build
  130. Build tools-only:
  131. tags: [ 'all' ]
  132. stage: testsuites
  133. script:
  134. - make tools-only_config tools-only -j$(nproc)
  135. # Ensure env tools build
  136. Build envtools:
  137. tags: [ 'all' ]
  138. stage: testsuites
  139. script:
  140. - make tools-only_config envtools -j$(nproc)
  141. Run binman, buildman, dtoc and patman testsuites:
  142. tags: [ 'all' ]
  143. stage: testsuites
  144. script:
  145. - git config --global user.name "GitLab CI Runner";
  146. git config --global user.email trini@konsulko.com;
  147. export USER=gitlab;
  148. virtualenv /tmp/venv;
  149. . /tmp/venv/bin/activate;
  150. pip install pyelftools;
  151. export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/sandbox_spl;
  152. export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
  153. export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
  154. ./tools/buildman/buildman -o /tmp -P sandbox_spl;
  155. ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
  156. ./tools/buildman/buildman -t;
  157. ./tools/dtoc/dtoc -t;
  158. ./tools/patman/patman --test
  159. # Test sandbox with test.py
  160. sandbox test.py:
  161. tags: [ 'all' ]
  162. variables:
  163. TEST_PY_BD: "sandbox"
  164. BUILDMAN: "^sandbox$"
  165. <<: *buildman_and_testpy_dfn
  166. sandbox_spl test.py:
  167. tags: [ 'all' ]
  168. variables:
  169. TEST_PY_BD: "sandbox_spl"
  170. BUILDMAN: "^sandbox_spl$"
  171. TEST_PY_TEST_SPEC: "test_ofplatdata"
  172. <<: *buildman_and_testpy_dfn
  173. evb-ast2500 test.py:
  174. tags: [ 'all' ]
  175. variables:
  176. TEST_PY_BD: "evb-ast2500"
  177. TEST_PY_ID: "--id qemu"
  178. BUILDMAN: "^evb-ast2500$"
  179. <<: *buildman_and_testpy_dfn
  180. sandbox_flattree test.py:
  181. tags: [ 'all' ]
  182. variables:
  183. TEST_PY_BD: "sandbox_flattree"
  184. BUILDMAN: "^sandbox_flattree$"
  185. <<: *buildman_and_testpy_dfn
  186. vexpress_ca15_tc2 test.py:
  187. tags: [ 'all' ]
  188. variables:
  189. TEST_PY_BD: "vexpress_ca15_tc2"
  190. TEST_PY_ID: "--id qemu"
  191. BUILDMAN: "^vexpress_ca15_tc2$"
  192. <<: *buildman_and_testpy_dfn
  193. vexpress_ca9x4 test.py:
  194. tags: [ 'all' ]
  195. variables:
  196. TEST_PY_BD: "vexpress_ca9x4"
  197. TEST_PY_ID: "--id qemu"
  198. BUILDMAN: "^vexpress_ca9x4$"
  199. <<: *buildman_and_testpy_dfn
  200. integratorcp_cm926ejs test.py:
  201. tags: [ 'all' ]
  202. variables:
  203. TEST_PY_BD: "integratorcp_cm926ejs"
  204. TEST_PY_TEST_SPEC: "not sleep"
  205. TEST_PY_ID: "--id qemu"
  206. BUILDMAN: "^integratorcp_cm926ejs$"
  207. <<: *buildman_and_testpy_dfn
  208. qemu_arm test.py:
  209. tags: [ 'all' ]
  210. variables:
  211. TEST_PY_BD: "qemu_arm"
  212. TEST_PY_TEST_SPEC: "not sleep"
  213. BUILDMAN: "^qemu_arm$"
  214. <<: *buildman_and_testpy_dfn
  215. qemu_arm64 test.py:
  216. tags: [ 'all' ]
  217. variables:
  218. TEST_PY_BD: "qemu_arm64"
  219. TEST_PY_TEST_SPEC: "not sleep"
  220. BUILDMAN: "^qemu_arm64$"
  221. <<: *buildman_and_testpy_dfn
  222. qemu_mips test.py:
  223. tags: [ 'all' ]
  224. variables:
  225. TEST_PY_BD: "qemu_mips"
  226. TEST_PY_TEST_SPEC: "not sleep"
  227. BUILDMAN: "^qemu_mips$"
  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: "^qemu_mipsel$"
  235. <<: *buildman_and_testpy_dfn
  236. qemu_mips64 test.py:
  237. tags: [ 'all' ]
  238. variables:
  239. TEST_PY_BD: "qemu_mips64"
  240. TEST_PY_TEST_SPEC: "not sleep"
  241. BUILDMAN: "^qemu_mips64$"
  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: "^qemu_mips64el$"
  249. <<: *buildman_and_testpy_dfn
  250. qemu-ppce500 test.py:
  251. tags: [ 'all' ]
  252. variables:
  253. TEST_PY_BD: "qemu-ppce500"
  254. TEST_PY_TEST_SPEC: "not sleep"
  255. BUILDMAN: "^qemu-ppce500$"
  256. <<: *buildman_and_testpy_dfn
  257. qemu-riscv64 test.py:
  258. tags: [ 'all' ]
  259. variables:
  260. TEST_PY_BD: "qemu-riscv64"
  261. TEST_PY_TEST_SPEC: "not sleep"
  262. BUILDMAN: "^qemu-riscv64$"
  263. <<: *buildman_and_testpy_dfn
  264. qemu-x86 test.py:
  265. tags: [ 'all' ]
  266. variables:
  267. TEST_PY_BD: "qemu-x86"
  268. TEST_PY_TEST_SPEC: "not sleep"
  269. BUILDMAN: "^qemu-x86$"
  270. <<: *buildman_and_testpy_dfn
  271. qemu-x86_64 test.py:
  272. tags: [ 'all' ]
  273. variables:
  274. TEST_PY_BD: "qemu-x86_64"
  275. TEST_PY_TEST_SPEC: "not sleep"
  276. BUILDMAN: "^qemu-x86_64$"
  277. <<: *buildman_and_testpy_dfn
  278. zynq_zc702 test.py:
  279. tags: [ 'all' ]
  280. variables:
  281. TEST_PY_BD: "zynq_zc702"
  282. TEST_PY_TEST_SPEC: "not sleep"
  283. TEST_PY_ID: "--id qemu"
  284. BUILDMAN: "^zynq_zc702$"
  285. <<: *buildman_and_testpy_dfn
  286. xilinx_versal_virt test.py:
  287. tags: [ 'all' ]
  288. variables:
  289. TEST_PY_BD: "xilinx_versal_virt"
  290. TEST_PY_TEST_SPEC: "not sleep"
  291. TEST_PY_ID: "--id qemu"
  292. BUILDMAN: "^xilinx_versal_virt$"
  293. <<: *buildman_and_testpy_dfn
  294. xtfpga test.py:
  295. tags: [ 'all' ]
  296. variables:
  297. TEST_PY_BD: "xtfpga"
  298. TEST_PY_TEST_SPEC: "not sleep"
  299. TEST_PY_ID: "--id qemu"
  300. BUILDMAN: "^xtfpga$"
  301. <<: *buildman_and_testpy_dfn