.gitlab-ci.yml 9.1 KB

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