.azure-pipelines.yml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. variables:
  2. windows_vm: vs2017-win2016
  3. ubuntu_vm: ubuntu-18.04
  4. macos_vm: macOS-10.15
  5. ci_runner_image: trini/u-boot-gitlab-ci-runner:bionic-20200526-18Jun2020
  6. # Add '-u 0' options for Azure pipelines, otherwise we get "permission
  7. # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
  8. # since our $(ci_runner_image) user is not root.
  9. container_option: -u 0
  10. work_dir: /u
  11. jobs:
  12. - job: tools_only_windows
  13. displayName: 'Ensure host tools build for Windows'
  14. pool:
  15. vmImage: $(windows_vm)
  16. strategy:
  17. matrix:
  18. i686:
  19. MSYS_DIR: msys32
  20. BASE_REPO: msys2-ci-base-i686
  21. x86_64:
  22. MSYS_DIR: msys64
  23. BASE_REPO: msys2-ci-base
  24. steps:
  25. - script: |
  26. git clone https://github.com/msys2/$(BASE_REPO).git %CD:~0,2%\$(MSYS_DIR)
  27. displayName: 'Install MSYS2'
  28. - script: |
  29. set PATH=%CD:~0,2%\$(MSYS_DIR)\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
  30. %CD:~0,2%\$(MSYS_DIR)\usr\bin\pacman --noconfirm -Syyuu
  31. displayName: 'Update MSYS2'
  32. - script: |
  33. set PATH=%CD:~0,2%\$(MSYS_DIR)\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
  34. %CD:~0,2%\$(MSYS_DIR)\usr\bin\pacman --noconfirm --needed -S make gcc bison diffutils openssl-devel
  35. displayName: 'Install Toolchain'
  36. - script: |
  37. set PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
  38. echo make tools-only_defconfig tools-only NO_SDL=1 > build-tools.sh
  39. %CD:~0,2%\$(MSYS_DIR)\usr\bin\bash -lc "bash build-tools.sh"
  40. displayName: 'Build Host Tools'
  41. env:
  42. # Tell MSYS2 we need a POSIX emulation layer
  43. MSYSTEM: MSYS
  44. # Tell MSYS2 not to ‘cd’ our startup directory to HOME
  45. CHERE_INVOKING: yes
  46. - job: tools_only_macOS
  47. displayName: 'Ensure host tools build for macOS X'
  48. pool:
  49. vmImage: $(macos_vm)
  50. steps:
  51. - script: brew install make
  52. displayName: Brew install dependencies
  53. - script: |
  54. gmake tools-only_config tools-only NO_SDL=1 \
  55. HOSTCFLAGS="-I/usr/local/opt/openssl@1.1/include" \
  56. HOSTLDFLAGS="-L/usr/local/opt/openssl@1.1/lib" \
  57. -j$(sysctl -n hw.logicalcpu)
  58. displayName: 'Perform tools-only build'
  59. - job: cppcheck
  60. displayName: 'Static code analysis with cppcheck'
  61. pool:
  62. vmImage: $(ubuntu_vm)
  63. container:
  64. image: $(ci_runner_image)
  65. options: $(container_option)
  66. steps:
  67. - script: cppcheck -j$(nproc) --force --quiet --inline-suppr .
  68. - job: htmldocs
  69. displayName: 'Build HTML documentation'
  70. pool:
  71. vmImage: $(ubuntu_vm)
  72. container:
  73. image: $(ci_runner_image)
  74. options: $(container_option)
  75. steps:
  76. - script: make htmldocs
  77. - job: todo
  78. displayName: 'Search for TODO within source tree'
  79. pool:
  80. vmImage: $(ubuntu_vm)
  81. container:
  82. image: $(ci_runner_image)
  83. options: $(container_option)
  84. steps:
  85. - script: grep -r TODO .
  86. - script: grep -r FIXME .
  87. - script: grep -r HACK . | grep -v HACKKIT
  88. - job: sloccount
  89. displayName: 'Some statistics about the code base'
  90. pool:
  91. vmImage: $(ubuntu_vm)
  92. container:
  93. image: $(ci_runner_image)
  94. options: $(container_option)
  95. steps:
  96. - script: sloccount .
  97. - job: maintainers
  98. displayName: 'Ensure all configs have MAINTAINERS entries'
  99. pool:
  100. vmImage: $(ubuntu_vm)
  101. container:
  102. image: $(ci_runner_image)
  103. options: $(container_option)
  104. steps:
  105. - script: |
  106. if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
  107. - job: tools_only
  108. displayName: 'Ensure host tools build'
  109. pool:
  110. vmImage: $(ubuntu_vm)
  111. container:
  112. image: $(ci_runner_image)
  113. options: $(container_option)
  114. steps:
  115. - script: |
  116. make tools-only_config tools-only -j$(nproc)
  117. - job: envtools
  118. displayName: 'Ensure env tools build'
  119. pool:
  120. vmImage: $(ubuntu_vm)
  121. container:
  122. image: $(ci_runner_image)
  123. options: $(container_option)
  124. steps:
  125. - script: |
  126. make tools-only_config envtools -j$(nproc)
  127. - job: utils
  128. displayName: 'Run binman, buildman, dtoc, Kconfig and patman testsuites'
  129. pool:
  130. vmImage: $(ubuntu_vm)
  131. steps:
  132. - script: |
  133. cat << EOF > build.sh
  134. set -ex
  135. cd ${WORK_DIR}
  136. EOF
  137. cat << "EOF" >> build.sh
  138. git config --global user.name "Azure Pipelines"
  139. git config --global user.email bmeng.cn@gmail.com
  140. export USER=azure
  141. virtualenv -p /usr/bin/python3 /tmp/venv
  142. . /tmp/venv/bin/activate
  143. pip install pyelftools pytest
  144. export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
  145. export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
  146. export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
  147. ./tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w sandbox_spl
  148. ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test
  149. ./tools/buildman/buildman -t
  150. ./tools/dtoc/dtoc -t
  151. ./tools/patman/patman --test
  152. make O=${UBOOT_TRAVIS_BUILD_DIR} testconfig
  153. EOF
  154. cat build.sh
  155. # We cannot use "container" like other jobs above, as buildman
  156. # seems to hang forever with pre-configured "container" environment
  157. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh
  158. - job: nokia_rx51_test
  159. displayName: 'Run tests for Nokia RX-51 (aka N900)'
  160. pool:
  161. vmImage: $(ubuntu_vm)
  162. container:
  163. image: $(ci_runner_image)
  164. options: $(container_option)
  165. steps:
  166. - script: |
  167. ./tools/buildman/buildman --fetch-arch arm
  168. export PATH=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/:$PATH
  169. test/nokia_rx51_test.sh
  170. - job: test_py
  171. displayName: 'test.py'
  172. pool:
  173. vmImage: $(ubuntu_vm)
  174. strategy:
  175. matrix:
  176. sandbox:
  177. TEST_PY_BD: "sandbox"
  178. sandbox_clang:
  179. TEST_PY_BD: "sandbox"
  180. OVERRIDE: "-O clang-10"
  181. sandbox_spl:
  182. TEST_PY_BD: "sandbox_spl"
  183. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff"
  184. sandbox_flattree:
  185. TEST_PY_BD: "sandbox_flattree"
  186. evb_ast2500:
  187. TEST_PY_BD: "evb-ast2500"
  188. TEST_PY_ID: "--id qemu"
  189. vexpress_ca15_tc2:
  190. TEST_PY_BD: "vexpress_ca15_tc2"
  191. TEST_PY_ID: "--id qemu"
  192. vexpress_ca9x4:
  193. TEST_PY_BD: "vexpress_ca9x4"
  194. TEST_PY_ID: "--id qemu"
  195. integratorcp_cm926ejs:
  196. TEST_PY_BD: "integratorcp_cm926ejs"
  197. TEST_PY_ID: "--id qemu"
  198. TEST_PY_TEST_SPEC: "not sleep"
  199. qemu_arm:
  200. TEST_PY_BD: "qemu_arm"
  201. TEST_PY_TEST_SPEC: "not sleep"
  202. qemu_arm64:
  203. TEST_PY_BD: "qemu_arm64"
  204. TEST_PY_TEST_SPEC: "not sleep"
  205. qemu_mips:
  206. TEST_PY_BD: "qemu_mips"
  207. TEST_PY_TEST_SPEC: "not sleep"
  208. qemu_mipsel:
  209. TEST_PY_BD: "qemu_mipsel"
  210. TEST_PY_TEST_SPEC: "not sleep"
  211. qemu_mips64:
  212. TEST_PY_BD: "qemu_mips64"
  213. TEST_PY_TEST_SPEC: "not sleep"
  214. qemu_mips64el:
  215. TEST_PY_BD: "qemu_mips64el"
  216. TEST_PY_TEST_SPEC: "not sleep"
  217. qemu_malta:
  218. TEST_PY_BD: "malta"
  219. TEST_PY_ID: "--id qemu"
  220. TEST_PY_TEST_SPEC: "not sleep and not efi"
  221. qemu_maltael:
  222. TEST_PY_BD: "maltael"
  223. TEST_PY_ID: "--id qemu"
  224. TEST_PY_TEST_SPEC: "not sleep and not efi"
  225. qemu_malta64:
  226. TEST_PY_BD: "malta64"
  227. TEST_PY_ID: "--id qemu"
  228. TEST_PY_TEST_SPEC: "not sleep and not efi"
  229. qemu_malta64el:
  230. TEST_PY_BD: "malta64el"
  231. TEST_PY_ID: "--id qemu"
  232. TEST_PY_TEST_SPEC: "not sleep and not efi"
  233. qemu_ppce500:
  234. TEST_PY_BD: "qemu-ppce500"
  235. TEST_PY_TEST_SPEC: "not sleep"
  236. qemu_riscv32:
  237. TEST_PY_BD: "qemu-riscv32"
  238. TEST_PY_TEST_SPEC: "not sleep"
  239. qemu_riscv64:
  240. TEST_PY_BD: "qemu-riscv64"
  241. TEST_PY_TEST_SPEC: "not sleep"
  242. qemu_riscv32_spl:
  243. TEST_PY_BD: "qemu-riscv32_spl"
  244. TEST_PY_TEST_SPEC: "not sleep"
  245. qemu_riscv64_spl:
  246. TEST_PY_BD: "qemu-riscv64_spl"
  247. TEST_PY_TEST_SPEC: "not sleep"
  248. qemu_x86:
  249. TEST_PY_BD: "qemu-x86"
  250. TEST_PY_TEST_SPEC: "not sleep"
  251. qemu_x86_64:
  252. TEST_PY_BD: "qemu-x86_64"
  253. TEST_PY_TEST_SPEC: "not sleep"
  254. xilinx_zynq_virt:
  255. TEST_PY_BD: "xilinx_zynq_virt"
  256. TEST_PY_ID: "--id qemu"
  257. TEST_PY_TEST_SPEC: "not sleep"
  258. xilinx_versal_virt:
  259. TEST_PY_BD: "xilinx_versal_virt"
  260. TEST_PY_ID: "--id qemu"
  261. TEST_PY_TEST_SPEC: "not sleep"
  262. xtfpga:
  263. TEST_PY_BD: "xtfpga"
  264. TEST_PY_ID: "--id qemu"
  265. TEST_PY_TEST_SPEC: "not sleep"
  266. steps:
  267. - script: |
  268. cat << EOF > test.sh
  269. set -ex
  270. # make environment variables available as tests are running inside a container
  271. export WORK_DIR="${WORK_DIR}"
  272. export TEST_PY_BD="${TEST_PY_BD}"
  273. export TEST_PY_ID="${TEST_PY_ID}"
  274. export TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}"
  275. export OVERRIDE="${OVERRIDE}"
  276. EOF
  277. cat << "EOF" >> test.sh
  278. # the below corresponds to .gitlab-ci.yml "before_script"
  279. cd ${WORK_DIR}
  280. git clone --depth=1 git://github.com/swarren/uboot-test-hooks.git /tmp/uboot-test-hooks
  281. ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
  282. ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
  283. grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  284. grub-mkimage --prefix=\"\" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  285. cp /opt/grub/grubriscv64.efi ~/grub_riscv64.efi
  286. cp /opt/grub/grubriscv32.efi ~/grub_riscv32.efi
  287. cp /opt/grub/grubaa64.efi ~/grub_arm64.efi
  288. cp /opt/grub/grubarm.efi ~/grub_arm.efi
  289. if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
  290. wget -O - https://github.com/riscv/opensbi/releases/download/v0.6/opensbi-0.6-rv32-bin.tar.xz | tar -C /tmp -xJ;
  291. export OPENSBI=/tmp/opensbi-0.6-rv32-bin/platform/qemu/virt/firmware/fw_dynamic.bin;
  292. fi
  293. if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]]; then
  294. wget -O - https://github.com/riscv/opensbi/releases/download/v0.6/opensbi-0.6-rv64-bin.tar.xz | tar -C /tmp -xJ;
  295. export OPENSBI=/tmp/opensbi-0.6-rv64-bin/platform/qemu/virt/firmware/fw_dynamic.bin;
  296. fi
  297. # the below corresponds to .gitlab-ci.yml "script"
  298. cd ${WORK_DIR}
  299. export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD};
  300. tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board ${TEST_PY_BD} ${OVERRIDE}
  301. virtualenv -p /usr/bin/python3 /tmp/venv
  302. . /tmp/venv/bin/activate
  303. pip install -r test/py/requirements.txt
  304. export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
  305. export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
  306. # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
  307. ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID} ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
  308. # the below corresponds to .gitlab-ci.yml "after_script"
  309. rm -rf /tmp/uboot-test-hooks /tmp/venv
  310. EOF
  311. cat test.sh
  312. # make current directory writeable to uboot user inside the container
  313. # as sandbox testing need create files like spi flash images, etc.
  314. # (TODO: clean up this in the future)
  315. chmod 777 .
  316. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/test.sh
  317. - job: build_the_world
  318. displayName: 'Build the World'
  319. pool:
  320. vmImage: $(ubuntu_vm)
  321. strategy:
  322. # Use almost the same target division in .travis.yml, only merged
  323. # 4 small build jobs (arc/microblaze/nds32/xtensa) into one.
  324. matrix:
  325. arc_microblaze_nds32_xtensa:
  326. BUILDMAN: "arc microblaze nds32 xtensa"
  327. arm11_arm7_arm920t_arm946es:
  328. BUILDMAN: "arm11 arm7 arm920t arm946es"
  329. arm926ejs:
  330. BUILDMAN: "arm926ejs -x freescale,siemens,at91,kirkwood,spear,omap"
  331. at91_non_armv7:
  332. BUILDMAN: "at91 -x armv7"
  333. at91_non_arm926ejs:
  334. BUILDMAN: "at91 -x arm926ejs"
  335. boundary_engicam_toradex:
  336. BUILDMAN: "boundary engicam toradex"
  337. arm_bcm:
  338. BUILDMAN: "bcm -x mips"
  339. nxp_arm32:
  340. BUILDMAN: "freescale -x powerpc,m68k,aarch64,ls101,ls102,ls104,ls108,ls20,lx216"
  341. nxp_ls101x:
  342. BUILDMAN: "freescale&ls101"
  343. nxp_ls102x:
  344. BUILDMAN: "freescale&ls102"
  345. nxp_ls104x:
  346. BUILDMAN: "freescale&ls104"
  347. nxp_ls108x:
  348. BUILDMAN: "freescale&ls108"
  349. nxp_ls20xx:
  350. BUILDMAN: "freescale&ls20"
  351. nxp_lx216x:
  352. BUILDMAN: "freescale&lx216"
  353. imx6:
  354. BUILDMAN: "mx6 -x boundary,engicam,freescale,technexion,toradex"
  355. imx:
  356. BUILDMAN: "mx -x mx6,freescale,technexion,toradex"
  357. keystone2_keystone3:
  358. BUILDMAN: "k2 k3"
  359. samsung_socfpga:
  360. BUILDMAN: "samsung socfpga"
  361. spear:
  362. BUILDMAN: "spear"
  363. sun4i:
  364. BUILDMAN: "sun4i"
  365. sun5i:
  366. BUILDMAN: "sun5i"
  367. sun6i:
  368. BUILDMAN: "sun6i"
  369. sun7i:
  370. BUILDMAN: "sun7i"
  371. sun8i_32bit:
  372. BUILDMAN: "sun8i&armv7"
  373. sun8i_64bit:
  374. BUILDMAN: "sun8i&aarch64"
  375. sun9i:
  376. BUILDMAN: "sun9i"
  377. sun50i:
  378. BUILDMAN: "sun50i"
  379. arm_catch_all:
  380. BUILDMAN: "arm -x arm11,arm7,arm9,aarch64,at91,bcm,freescale,kirkwood,mvebu,siemens,tegra,uniphier,mx,samsung,sunxi,am33xx,omap,rk,toradex,socfpga,k2,k3,zynq"
  381. sandbox_x86:
  382. BUILDMAN: "sandbox x86"
  383. technexion:
  384. BUILDMAN: "technexion"
  385. kirkwood:
  386. BUILDMAN: "kirkwood"
  387. mvebu:
  388. BUILDMAN: "mvebu"
  389. m68k:
  390. BUILDMAN: "m68k"
  391. mips:
  392. BUILDMAN: "mips"
  393. non_fsl_ppc:
  394. BUILDMAN: "powerpc -x freescale"
  395. mpc85xx_freescale:
  396. BUILDMAN: "mpc85xx&freescale -x t208xrdb -x t4qds -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x b4860qds -x bsc91*"
  397. t208xrdb_corenet_ds:
  398. BUILDMAN: "t208xrdb corenet_ds"
  399. fsl_ppc:
  400. BUILDMAN: "t4qds b4860qds mpc83xx&freescale mpc86xx&freescale"
  401. t102x:
  402. BUILDMAN: "t102*"
  403. p1_p2_rdb_pc:
  404. BUILDMAN: "p1_p2_rdb_pc"
  405. p1010rdb_bsc91:
  406. BUILDMAN: "p1010rdb bsc91"
  407. siemens:
  408. BUILDMAN: "siemens"
  409. tegra:
  410. BUILDMAN: "tegra -x toradex"
  411. am33xx_no_siemens:
  412. BUILDMAN: "am33xx -x siemens"
  413. omap:
  414. BUILDMAN: "omap"
  415. uniphier:
  416. BUILDMAN: "uniphier"
  417. aarch64_catch_all:
  418. BUILDMAN: "aarch64 -x bcm,k3,tegra,ls1,ls2,lx216,mvebu,uniphier,sunxi,samsung,socfpga,rk,versal,zynq"
  419. rockchip:
  420. BUILDMAN: "rk"
  421. sh:
  422. BUILDMAN: "sh -x arm"
  423. zynq:
  424. BUILDMAN: "zynq&armv7"
  425. zynqmp_versal:
  426. BUILDMAN: "versal|zynqmp&aarch64"
  427. riscv:
  428. BUILDMAN: "riscv"
  429. steps:
  430. - script: |
  431. cat << EOF > build.sh
  432. set -ex
  433. cd ${WORK_DIR}
  434. # make environment variables available as tests are running inside a container
  435. export BUILDMAN="${BUILDMAN}"
  436. EOF
  437. cat << "EOF" >> build.sh
  438. if [[ "${BUILDMAN}" != "" ]]; then
  439. ret=0;
  440. tools/buildman/buildman -o /tmp -P -W ${BUILDMAN} ${OVERRIDE} || ret=$?;
  441. if [[ $ret -ne 0 ]]; then
  442. tools/buildman/buildman -o /tmp -seP ${BUILDMAN};
  443. exit $ret;
  444. fi;
  445. fi
  446. EOF
  447. cat build.sh
  448. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh