.gitlab-ci.yml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. # SPDX-License-Identifier: GPL-2.0+
  2. variables:
  3. DEFAULT_TAG: ""
  4. MIRROR_DOCKER: docker.io
  5. default:
  6. tags:
  7. - ${DEFAULT_TAG}
  8. # Grab our configured image. The source for this is found
  9. # in the u-boot tree at tools/docker/Dockerfile
  10. image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20230624-20Jul2023
  11. # We run some tests in different order, to catch some failures quicker.
  12. stages:
  13. - testsuites
  14. - test.py
  15. - world build
  16. .buildman_and_testpy_template: &buildman_and_testpy_dfn
  17. stage: test.py
  18. retry: 2 # QEMU may be too slow, etc.
  19. before_script:
  20. # Clone uboot-test-hooks
  21. - git config --global --add safe.directory "${CI_PROJECT_DIR}"
  22. - git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks
  23. - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
  24. - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
  25. - grub-mkimage --prefix="" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  26. - grub-mkimage --prefix="" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  27. - if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
  28. wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.2/opensbi-1.2-rv-bin.tar.xz | tar -C /tmp -xJ;
  29. export OPENSBI=/tmp/opensbi-1.2-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin;
  30. fi
  31. - if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]] || [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
  32. wget -O - https://github.com/riscv-software-src/opensbi/releases/download/v1.2/opensbi-1.2-rv-bin.tar.xz | tar -C /tmp -xJ;
  33. export OPENSBI=/tmp/opensbi-1.2-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin;
  34. fi
  35. after_script:
  36. - cp -v /tmp/${TEST_PY_BD}/*.{html,css} .
  37. - rm -rf /tmp/uboot-test-hooks /tmp/venv
  38. script:
  39. # If we've been asked to use clang only do one configuration.
  40. - export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD}
  41. - echo BUILD_ENV ${BUILD_ENV}
  42. - if [ -n "${BUILD_ENV}" ]; then
  43. export ${BUILD_ENV};
  44. fi
  45. - tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e
  46. --board ${TEST_PY_BD} ${OVERRIDE}
  47. - cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/
  48. - cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/
  49. - cp /opt/grub/grubriscv64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_riscv64.efi
  50. - cp /opt/grub/grubaa64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi
  51. - cp /opt/grub/grubarm.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi
  52. # create sdcard / spi-nor images for sifive unleashed using genimage
  53. - if [[ "${TEST_PY_BD}" == "sifive_unleashed" ]]; then
  54. mkdir -p root;
  55. cp ${UBOOT_TRAVIS_BUILD_DIR}/spl/u-boot-spl.bin .;
  56. cp ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.itb .;
  57. rm -rf tmp;
  58. genimage --inputpath . --config board/sifive/unleashed/genimage_sdcard.cfg;
  59. cp images/sdcard.img ${UBOOT_TRAVIS_BUILD_DIR}/;
  60. rm -rf tmp;
  61. genimage --inputpath . --config board/sifive/unleashed/genimage_spi-nor.cfg;
  62. cp images/spi-nor.img ${UBOOT_TRAVIS_BUILD_DIR}/;
  63. fi
  64. - if [[ "${TEST_PY_BD}" == "coreboot" ]]; then
  65. wget -O -
  66. "https://drive.google.com/uc?id=1uJ2VkUQ8czWFZmhJQ90Tp8V_zrJ6BrBH&export=download" |
  67. xz -dc >${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom;
  68. wget -O -
  69. "https://drive.google.com/uc?id=149Cz-5SZXHNKpi9xg6R_5XITWohu348y&export=download" >
  70. cbfstool;
  71. chmod a+x cbfstool;
  72. ./cbfstool ${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000;
  73. fi
  74. - virtualenv -p /usr/bin/python3 /tmp/venv
  75. - . /tmp/venv/bin/activate
  76. - pip install -r test/py/requirements.txt
  77. # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
  78. - export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
  79. export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
  80. ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID}
  81. ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"}
  82. --build-dir "$UBOOT_TRAVIS_BUILD_DIR"
  83. artifacts:
  84. when: always
  85. paths:
  86. - "*.html"
  87. - "*.css"
  88. expire_in: 1 week
  89. build all 32bit ARM platforms:
  90. stage: world build
  91. script:
  92. - ret=0;
  93. git config --global --add safe.directory "${CI_PROJECT_DIR}";
  94. pip install -r tools/buildman/requirements.txt;
  95. ./tools/buildman/buildman -o /tmp -PEWM arm -x aarch64 || ret=$?;
  96. if [[ $ret -ne 0 ]]; then
  97. ./tools/buildman/buildman -o /tmp -seP;
  98. exit $ret;
  99. fi;
  100. build all 64bit ARM platforms:
  101. stage: world build
  102. script:
  103. - virtualenv -p /usr/bin/python3 /tmp/venv
  104. - . /tmp/venv/bin/activate
  105. - ret=0;
  106. git config --global --add safe.directory "${CI_PROJECT_DIR}";
  107. pip install -r tools/buildman/requirements.txt;
  108. ./tools/buildman/buildman -o /tmp -PEWM aarch64 || ret=$?;
  109. if [[ $ret -ne 0 ]]; then
  110. ./tools/buildman/buildman -o /tmp -seP;
  111. exit $ret;
  112. fi;
  113. build all PowerPC platforms:
  114. stage: world build
  115. script:
  116. - ret=0;
  117. git config --global --add safe.directory "${CI_PROJECT_DIR}";
  118. ./tools/buildman/buildman -o /tmp -P -E -W powerpc || ret=$?;
  119. if [[ $ret -ne 0 ]]; then
  120. ./tools/buildman/buildman -o /tmp -seP;
  121. exit $ret;
  122. fi;
  123. build all other platforms:
  124. stage: world build
  125. script:
  126. - ret=0;
  127. git config --global --add safe.directory "${CI_PROJECT_DIR}";
  128. ./tools/buildman/buildman -o /tmp -PEWM -x arm,powerpc || ret=$?;
  129. if [[ $ret -ne 0 ]]; then
  130. ./tools/buildman/buildman -o /tmp -seP;
  131. exit $ret;
  132. fi;
  133. check for new CONFIG symbols outside Kconfig:
  134. stage: testsuites
  135. script:
  136. - git config --global --add safe.directory "${CI_PROJECT_DIR}"
  137. # If grep succeeds and finds a match the test fails as we should
  138. # have no matches.
  139. - git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
  140. :^doc/ :^arch/arm/dts/ :^scripts/kconfig/lkc.h
  141. :^include/linux/kconfig.h :^tools/ && exit 1 || exit 0
  142. # QA jobs for code analytics
  143. # static code analysis with cppcheck (we can add --enable=all later)
  144. cppcheck:
  145. stage: testsuites
  146. script:
  147. - cppcheck -j$(nproc) --force --quiet --inline-suppr .
  148. # search for TODO within source tree
  149. grep TODO/FIXME/HACK:
  150. stage: testsuites
  151. script:
  152. - grep -r TODO .
  153. - grep -r FIXME .
  154. # search for HACK within source tree and ignore HACKKIT board
  155. - grep -r HACK . | grep -v HACKKIT
  156. # build documentation
  157. docs:
  158. stage: testsuites
  159. script:
  160. - virtualenv -p /usr/bin/python3 /tmp/venvhtml
  161. - . /tmp/venvhtml/bin/activate
  162. - pip install -r doc/sphinx/requirements.txt
  163. - make htmldocs KDOC_WERROR=1
  164. - make infodocs
  165. # some statistics about the code base
  166. sloccount:
  167. stage: testsuites
  168. script:
  169. - sloccount .
  170. # ensure all configs have MAINTAINERS entries
  171. Check for configs without MAINTAINERS entry:
  172. stage: testsuites
  173. script:
  174. - ./tools/buildman/buildman --maintainer-check || exit 0
  175. # Ensure host tools build
  176. Build tools-only:
  177. stage: testsuites
  178. script:
  179. - make tools-only_config tools-only -j$(nproc)
  180. # Ensure env tools build
  181. Build envtools:
  182. stage: testsuites
  183. script:
  184. - make tools-only_config envtools -j$(nproc)
  185. Run binman, buildman, dtoc, Kconfig and patman testsuites:
  186. stage: testsuites
  187. script:
  188. - git config --global user.name "GitLab CI Runner";
  189. git config --global user.email trini@konsulko.com;
  190. git config --global --add safe.directory "${CI_PROJECT_DIR}";
  191. export USER=gitlab;
  192. virtualenv -p /usr/bin/python3 /tmp/venv;
  193. . /tmp/venv/bin/activate;
  194. pip install -r test/py/requirements.txt;
  195. pip install -r tools/buildman/requirements.txt;
  196. export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl;
  197. export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
  198. export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
  199. set +e;
  200. ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w
  201. --board sandbox_spl;
  202. set -e;
  203. ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
  204. ./tools/buildman/buildman -t;
  205. ./tools/dtoc/dtoc -t;
  206. ./tools/patman/patman test;
  207. make testconfig
  208. # Check for any pylint regressions
  209. Run pylint:
  210. stage: testsuites
  211. script:
  212. - git config --global --add safe.directory "${CI_PROJECT_DIR}"
  213. - pip install -r test/py/requirements.txt
  214. - pip install -r tools/buildman/requirements.txt
  215. - pip install asteval pylint==2.12.2 pyopenssl
  216. - export PATH=${PATH}:~/.local/bin
  217. - echo "[MASTER]" >> .pylintrc
  218. - echo "load-plugins=pylint.extensions.docparams" >> .pylintrc
  219. - export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
  220. - set +e
  221. - ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w
  222. --board sandbox_spl
  223. - set -e
  224. - pylint --version
  225. - export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"
  226. - make pylint_err
  227. # Check for pre-schema driver model tags
  228. Check for pre-schema tags:
  229. stage: testsuites
  230. script:
  231. - git config --global --add safe.directory "${CI_PROJECT_DIR}";
  232. # If grep succeeds and finds a match the test fails as we should
  233. # have no matches.
  234. - git grep u-boot,dm- -- '*.dts*' && exit 1 || exit 0
  235. # Check we can package the Python tools
  236. Check packing of Python tools:
  237. stage: testsuites
  238. script:
  239. - make pip
  240. # Test sandbox with test.py
  241. sandbox test.py:
  242. variables:
  243. TEST_PY_BD: "sandbox"
  244. <<: *buildman_and_testpy_dfn
  245. sandbox with clang test.py:
  246. variables:
  247. TEST_PY_BD: "sandbox"
  248. OVERRIDE: "-O clang-16"
  249. <<: *buildman_and_testpy_dfn
  250. sandbox without LTO test.py:
  251. variables:
  252. TEST_PY_BD: "sandbox"
  253. BUILD_ENV: "NO_LTO=1"
  254. <<: *buildman_and_testpy_dfn
  255. sandbox_spl test.py:
  256. variables:
  257. TEST_PY_BD: "sandbox_spl"
  258. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
  259. <<: *buildman_and_testpy_dfn
  260. sandbox_noinst_test.py:
  261. variables:
  262. TEST_PY_BD: "sandbox_noinst"
  263. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
  264. <<: *buildman_and_testpy_dfn
  265. sandbox_vpl test.py:
  266. variables:
  267. TEST_PY_BD: "sandbox_vpl"
  268. TEST_PY_TEST_SPEC: "vpl or test_spl"
  269. <<: *buildman_and_testpy_dfn
  270. # Enable tracing and disable LTO, to ensure functions are not elided
  271. sandbox trace_test.py:
  272. variables:
  273. TEST_PY_BD: "sandbox"
  274. BUILD_ENV: "FTRACE=1 NO_LTO=1"
  275. TEST_PY_TEST_SPEC: "trace"
  276. OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000"
  277. <<: *buildman_and_testpy_dfn
  278. evb-ast2500 test.py:
  279. variables:
  280. TEST_PY_BD: "evb-ast2500"
  281. TEST_PY_ID: "--id qemu"
  282. <<: *buildman_and_testpy_dfn
  283. evb-ast2600 test.py:
  284. variables:
  285. TEST_PY_BD: "evb-ast2600"
  286. TEST_PY_ID: "--id qemu"
  287. <<: *buildman_and_testpy_dfn
  288. sandbox_flattree test.py:
  289. variables:
  290. TEST_PY_BD: "sandbox_flattree"
  291. <<: *buildman_and_testpy_dfn
  292. vexpress_ca9x4 test.py:
  293. variables:
  294. TEST_PY_BD: "vexpress_ca9x4"
  295. TEST_PY_ID: "--id qemu"
  296. <<: *buildman_and_testpy_dfn
  297. integratorcp_cm926ejs test.py:
  298. variables:
  299. TEST_PY_BD: "integratorcp_cm926ejs"
  300. TEST_PY_TEST_SPEC: "not sleep"
  301. TEST_PY_ID: "--id qemu"
  302. <<: *buildman_and_testpy_dfn
  303. qemu_arm test.py:
  304. variables:
  305. TEST_PY_BD: "qemu_arm"
  306. TEST_PY_TEST_SPEC: "not sleep"
  307. <<: *buildman_and_testpy_dfn
  308. qemu_arm64 test.py:
  309. variables:
  310. TEST_PY_BD: "qemu_arm64"
  311. TEST_PY_TEST_SPEC: "not sleep"
  312. <<: *buildman_and_testpy_dfn
  313. qemu_m68k test.py:
  314. variables:
  315. TEST_PY_BD: "M5208EVBE"
  316. TEST_PY_ID: "--id qemu"
  317. TEST_PY_TEST_SPEC: "not sleep and not efi"
  318. OVERRIDE: "-a CONFIG_M68K_QEMU=y -a ~CONFIG_MCFTMR"
  319. <<: *buildman_and_testpy_dfn
  320. qemu_malta test.py:
  321. variables:
  322. TEST_PY_BD: "malta"
  323. TEST_PY_TEST_SPEC: "not sleep and not efi"
  324. TEST_PY_ID: "--id qemu"
  325. <<: *buildman_and_testpy_dfn
  326. qemu_maltael test.py:
  327. variables:
  328. TEST_PY_BD: "maltael"
  329. TEST_PY_TEST_SPEC: "not sleep and not efi"
  330. TEST_PY_ID: "--id qemu"
  331. <<: *buildman_and_testpy_dfn
  332. qemu_malta64 test.py:
  333. variables:
  334. TEST_PY_BD: "malta64"
  335. TEST_PY_TEST_SPEC: "not sleep and not efi"
  336. TEST_PY_ID: "--id qemu"
  337. <<: *buildman_and_testpy_dfn
  338. qemu_malta64el test.py:
  339. variables:
  340. TEST_PY_BD: "malta64el"
  341. TEST_PY_TEST_SPEC: "not sleep and not efi"
  342. TEST_PY_ID: "--id qemu"
  343. <<: *buildman_and_testpy_dfn
  344. qemu-ppce500 test.py:
  345. variables:
  346. TEST_PY_BD: "qemu-ppce500"
  347. TEST_PY_TEST_SPEC: "not sleep"
  348. <<: *buildman_and_testpy_dfn
  349. qemu-riscv32 test.py:
  350. variables:
  351. TEST_PY_BD: "qemu-riscv32"
  352. TEST_PY_TEST_SPEC: "not sleep"
  353. <<: *buildman_and_testpy_dfn
  354. qemu-riscv64 test.py:
  355. variables:
  356. TEST_PY_BD: "qemu-riscv64"
  357. TEST_PY_TEST_SPEC: "not sleep"
  358. <<: *buildman_and_testpy_dfn
  359. qemu-riscv32_spl test.py:
  360. variables:
  361. TEST_PY_BD: "qemu-riscv32_spl"
  362. TEST_PY_TEST_SPEC: "not sleep"
  363. <<: *buildman_and_testpy_dfn
  364. qemu-riscv64_spl test.py:
  365. variables:
  366. TEST_PY_BD: "qemu-riscv64_spl"
  367. TEST_PY_TEST_SPEC: "not sleep"
  368. <<: *buildman_and_testpy_dfn
  369. qemu-x86 test.py:
  370. variables:
  371. TEST_PY_BD: "qemu-x86"
  372. TEST_PY_TEST_SPEC: "not sleep"
  373. <<: *buildman_and_testpy_dfn
  374. qemu-x86_64 test.py:
  375. variables:
  376. TEST_PY_BD: "qemu-x86_64"
  377. TEST_PY_TEST_SPEC: "not sleep"
  378. <<: *buildman_and_testpy_dfn
  379. r2dplus_i82557c test.py:
  380. variables:
  381. TEST_PY_BD: "r2dplus"
  382. TEST_PY_ID: "--id i82557c_qemu"
  383. <<: *buildman_and_testpy_dfn
  384. r2dplus_pcnet test.py:
  385. variables:
  386. TEST_PY_BD: "r2dplus"
  387. TEST_PY_ID: "--id pcnet_qemu"
  388. <<: *buildman_and_testpy_dfn
  389. r2dplus_rtl8139 test.py:
  390. variables:
  391. TEST_PY_BD: "r2dplus"
  392. TEST_PY_ID: "--id rtl8139_qemu"
  393. <<: *buildman_and_testpy_dfn
  394. r2dplus_tulip test.py:
  395. variables:
  396. TEST_PY_BD: "r2dplus"
  397. TEST_PY_ID: "--id tulip_qemu"
  398. <<: *buildman_and_testpy_dfn
  399. sifive_unleashed_sdcard test.py:
  400. variables:
  401. TEST_PY_BD: "sifive_unleashed"
  402. TEST_PY_ID: "--id sdcard_qemu"
  403. <<: *buildman_and_testpy_dfn
  404. sifive_unleashed_spi-nor test.py:
  405. variables:
  406. TEST_PY_BD: "sifive_unleashed"
  407. TEST_PY_ID: "--id spi-nor_qemu"
  408. <<: *buildman_and_testpy_dfn
  409. xilinx_zynq_virt test.py:
  410. variables:
  411. TEST_PY_BD: "xilinx_zynq_virt"
  412. TEST_PY_TEST_SPEC: "not sleep"
  413. TEST_PY_ID: "--id qemu"
  414. <<: *buildman_and_testpy_dfn
  415. xilinx_versal_virt test.py:
  416. variables:
  417. TEST_PY_BD: "xilinx_versal_virt"
  418. TEST_PY_TEST_SPEC: "not sleep"
  419. TEST_PY_ID: "--id qemu"
  420. <<: *buildman_and_testpy_dfn
  421. xtfpga test.py:
  422. variables:
  423. TEST_PY_BD: "xtfpga"
  424. TEST_PY_TEST_SPEC: "not sleep"
  425. TEST_PY_ID: "--id qemu"
  426. <<: *buildman_and_testpy_dfn
  427. coreboot test.py:
  428. variables:
  429. TEST_PY_BD: "coreboot"
  430. TEST_PY_TEST_SPEC: "not sleep"
  431. TEST_PY_ID: "--id qemu"
  432. <<: *buildman_and_testpy_dfn