.azure-pipelines.yml 15 KB

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