.azure-pipelines.yml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. variables:
  2. windows_vm: vs2017-win2016
  3. ubuntu_vm: ubuntu-18.04
  4. ci_runner_image: trini/u-boot-gitlab-ci-runner:bionic-20200311-10Apr2020
  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 --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/.bm-work/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 /tmp -P 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. BUILDMAN: "^sandbox$"
  153. sandbox_clang:
  154. TEST_PY_BD: "sandbox"
  155. BUILDMAN: "^sandbox$"
  156. OVERRIDE: "-O clang-7"
  157. sandbox_spl:
  158. TEST_PY_BD: "sandbox_spl"
  159. TEST_PY_TEST_SPEC: "test_ofplatdata"
  160. BUILDMAN: "^sandbox_spl$"
  161. sandbox_flattree:
  162. TEST_PY_BD: "sandbox_flattree"
  163. BUILDMAN: "^sandbox_flattree$"
  164. evb_ast2500:
  165. TEST_PY_BD: "evb-ast2500"
  166. TEST_PY_ID: "--id qemu"
  167. BUILDMAN: "^evb-ast2500$"
  168. vexpress_ca15_tc2:
  169. TEST_PY_BD: "vexpress_ca15_tc2"
  170. TEST_PY_ID: "--id qemu"
  171. BUILDMAN: "^vexpress_ca15_tc2$"
  172. vexpress_ca9x4:
  173. TEST_PY_BD: "vexpress_ca9x4"
  174. TEST_PY_ID: "--id qemu"
  175. BUILDMAN: "^vexpress_ca9x4$"
  176. integratorcp_cm926ejs:
  177. TEST_PY_BD: "integratorcp_cm926ejs"
  178. TEST_PY_ID: "--id qemu"
  179. TEST_PY_TEST_SPEC: "not sleep"
  180. BUILDMAN: "^integratorcp_cm926ejs$"
  181. qemu_arm:
  182. TEST_PY_BD: "qemu_arm"
  183. TEST_PY_TEST_SPEC: "not sleep"
  184. BUILDMAN: "^qemu_arm$"
  185. qemu_arm64:
  186. TEST_PY_BD: "qemu_arm64"
  187. TEST_PY_TEST_SPEC: "not sleep"
  188. BUILDMAN: "^qemu_arm64$"
  189. qemu_mips:
  190. TEST_PY_BD: "qemu_mips"
  191. TEST_PY_TEST_SPEC: "not sleep"
  192. BUILDMAN: "^qemu_mips$"
  193. qemu_mipsel:
  194. TEST_PY_BD: "qemu_mipsel"
  195. TEST_PY_TEST_SPEC: "not sleep"
  196. BUILDMAN: "^qemu_mipsel$"
  197. qemu_mips64:
  198. TEST_PY_BD: "qemu_mips64"
  199. TEST_PY_TEST_SPEC: "not sleep"
  200. BUILDMAN: "^qemu_mips64$"
  201. qemu_mips64el:
  202. TEST_PY_BD: "qemu_mips64el"
  203. TEST_PY_TEST_SPEC: "not sleep"
  204. BUILDMAN: "^qemu_mips64el$"
  205. qemu_ppce500:
  206. TEST_PY_BD: "qemu-ppce500"
  207. TEST_PY_TEST_SPEC: "not sleep"
  208. BUILDMAN: "^qemu-ppce500$"
  209. qemu_riscv32:
  210. TEST_PY_BD: "qemu-riscv32"
  211. TEST_PY_TEST_SPEC: "not sleep"
  212. BUILDMAN: "^qemu-riscv32$"
  213. qemu_riscv64:
  214. TEST_PY_BD: "qemu-riscv64"
  215. TEST_PY_TEST_SPEC: "not sleep"
  216. BUILDMAN: "^qemu-riscv64$"
  217. qemu_x86:
  218. TEST_PY_BD: "qemu-x86"
  219. TEST_PY_TEST_SPEC: "not sleep"
  220. BUILDMAN: "^qemu-x86$"
  221. qemu_x86_64:
  222. TEST_PY_BD: "qemu-x86_64"
  223. TEST_PY_TEST_SPEC: "not sleep"
  224. BUILDMAN: "^qemu-x86_64$"
  225. xilinx_zynq_virt:
  226. TEST_PY_BD: "xilinx_zynq_virt"
  227. TEST_PY_ID: "--id qemu"
  228. TEST_PY_TEST_SPEC: "not sleep"
  229. BUILDMAN: "^xilinx_zynq_virt$"
  230. xilinx_versal_virt:
  231. TEST_PY_BD: "xilinx_versal_virt"
  232. TEST_PY_ID: "--id qemu"
  233. TEST_PY_TEST_SPEC: "not sleep"
  234. BUILDMAN: "^xilinx_versal_virt$"
  235. xtfpga:
  236. TEST_PY_BD: "xtfpga"
  237. TEST_PY_ID: "--id qemu"
  238. TEST_PY_TEST_SPEC: "not sleep"
  239. BUILDMAN: "^xtfpga$"
  240. steps:
  241. - script: |
  242. cat << EOF > test.sh
  243. set -ex
  244. # make environment variables available as tests are running inside a container
  245. export WORK_DIR="${WORK_DIR}"
  246. export TEST_PY_BD="${TEST_PY_BD}"
  247. export TEST_PY_ID="${TEST_PY_ID}"
  248. export TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}"
  249. export BUILDMAN="${BUILDMAN}"
  250. export OVERRIDE="${OVERRIDE}"
  251. EOF
  252. cat << "EOF" >> test.sh
  253. # the below corresponds to .gitlab-ci.yml "before_script"
  254. cd ${WORK_DIR}
  255. git clone --depth=1 git://github.com/swarren/uboot-test-hooks.git /tmp/uboot-test-hooks
  256. ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
  257. ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
  258. grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  259. grub-mkimage --prefix=\"\" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  260. cp /opt/grub/grubriscv64.efi ~/grub_riscv64.efi
  261. cp /opt/grub/grubriscv32.efi ~/grub_riscv32.efi
  262. cp /opt/grub/grubaa64.efi ~/grub_arm64.efi
  263. cp /opt/grub/grubarm.efi ~/grub_arm.efi
  264. # the below corresponds to .gitlab-ci.yml "script"
  265. cd ${WORK_DIR}
  266. if [[ "${BUILDMAN}" != "" ]]; then
  267. ret=0;
  268. tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} ${OVERRIDE} || ret=$?;
  269. if [[ $ret -ne 0 && $ret -ne 129 ]]; then
  270. tools/buildman/buildman -o /tmp -sdeP ${BUILDMAN};
  271. exit $ret;
  272. fi;
  273. fi
  274. virtualenv -p /usr/bin/python3 /tmp/venv
  275. . /tmp/venv/bin/activate
  276. pip install -r test/py/requirements.txt
  277. export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/${TEST_PY_BD};
  278. export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
  279. export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
  280. if [[ "${TEST_PY_BD}" != "" ]]; then
  281. ./test/py/test.py --bd ${TEST_PY_BD} ${TEST_PY_ID} -k "${TEST_PY_TEST_SPEC:-not a_test_which_does_not_exist}" --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
  282. ret=$?;
  283. if [[ $ret -ne 0 ]]; then
  284. exit $ret;
  285. fi;
  286. fi
  287. # the below corresponds to .gitlab-ci.yml "after_script"
  288. rm -rf /tmp/uboot-test-hooks /tmp/venv
  289. EOF
  290. cat test.sh
  291. # make current directory writeable to uboot user inside the container
  292. # as sandbox testing need create files like spi flash images, etc.
  293. # (TODO: clean up this in the future)
  294. chmod 777 .
  295. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/test.sh
  296. - job: build_the_world
  297. displayName: 'Build the World'
  298. pool:
  299. vmImage: $(ubuntu_vm)
  300. strategy:
  301. # Use almost the same target division in .travis.yml, only merged
  302. # 4 small build jobs (arc/microblaze/nds32/xtensa) into one.
  303. matrix:
  304. arc_microblaze_nds32_xtensa:
  305. BUILDMAN: "arc microblaze nds32 xtensa"
  306. arm11_arm7_arm920t_arm946es:
  307. BUILDMAN: "arm11 arm7 arm920t arm946es"
  308. arm926ejs:
  309. BUILDMAN: "arm926ejs -x freescale,siemens,at91,kirkwood,spear,omap"
  310. at91_non_armv7:
  311. BUILDMAN: "at91 -x armv7"
  312. at91_non_arm926ejs:
  313. BUILDMAN: "at91 -x arm926ejs"
  314. boundary_engicam_toradex:
  315. BUILDMAN: "boundary engicam toradex"
  316. arm_bcm:
  317. BUILDMAN: "bcm -x mips"
  318. nxp_arm32:
  319. BUILDMAN: "freescale -x powerpc,m68k,aarch64,ls101,ls102,ls104,ls108,ls20,lx216"
  320. nxp_ls101x:
  321. BUILDMAN: "freescale&ls101"
  322. nxp_ls102x:
  323. BUILDMAN: "freescale&ls102"
  324. nxp_ls104x:
  325. BUILDMAN: "freescale&ls104"
  326. nxp_ls108x:
  327. BUILDMAN: "freescale&ls108"
  328. nxp_ls20xx:
  329. BUILDMAN: "freescale&ls20"
  330. nxp_lx216x:
  331. BUILDMAN: "freescale&lx216"
  332. imx6:
  333. BUILDMAN: "mx6 -x boundary,engicam,freescale,technexion,toradex"
  334. imx:
  335. BUILDMAN: "mx -x mx6,freescale,technexion,toradex"
  336. keystone2_keystone3:
  337. BUILDMAN: "k2 k3"
  338. samsung_socfpga:
  339. BUILDMAN: "samsung socfpga"
  340. spear:
  341. BUILDMAN: "spear"
  342. sun4i:
  343. BUILDMAN: "sun4i"
  344. sun5i:
  345. BUILDMAN: "sun5i"
  346. sun6i:
  347. BUILDMAN: "sun6i"
  348. sun7i:
  349. BUILDMAN: "sun7i"
  350. sun8i_32bit:
  351. BUILDMAN: "sun8i&armv7"
  352. sun8i_64bit:
  353. BUILDMAN: "sun8i&aarch64"
  354. sun9i:
  355. BUILDMAN: "sun9i"
  356. sun50i:
  357. BUILDMAN: "sun50i"
  358. arm_catch_all:
  359. 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"
  360. sandbox_x86:
  361. BUILDMAN: "sandbox x86"
  362. technexion:
  363. BUILDMAN: "technexion"
  364. kirkwood:
  365. BUILDMAN: "kirkwood"
  366. mvebu:
  367. BUILDMAN: "mvebu"
  368. m68k:
  369. BUILDMAN: "m68k"
  370. mips:
  371. BUILDMAN: "mips"
  372. non_fsl_ppc:
  373. BUILDMAN: "powerpc -x freescale"
  374. mpc85xx_freescale:
  375. BUILDMAN: "mpc85xx&freescale -x t208xrdb -x t4qds -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x b4860qds -x bsc91*"
  376. t208xrdb_corenet_ds:
  377. BUILDMAN: "t208xrdb corenet_ds"
  378. fsl_ppc:
  379. BUILDMAN: "t4qds b4860qds mpc83xx&freescale mpc86xx&freescale"
  380. t102x:
  381. BUILDMAN: "t102*"
  382. p1_p2_rdb_pc:
  383. BUILDMAN: "p1_p2_rdb_pc"
  384. p1010rdb_bsc91:
  385. BUILDMAN: "p1010rdb bsc91"
  386. siemens:
  387. BUILDMAN: "siemens"
  388. tegra:
  389. BUILDMAN: "tegra -x toradex"
  390. am33xx_no_siemens:
  391. BUILDMAN: "am33xx -x siemens"
  392. omap:
  393. BUILDMAN: "omap"
  394. uniphier:
  395. BUILDMAN: "uniphier"
  396. aarch64_catch_all:
  397. BUILDMAN: "aarch64 -x bcm,k3,tegra,ls1,ls2,lx216,mvebu,uniphier,sunxi,samsung,socfpga,rk,versal,zynq"
  398. rockchip:
  399. BUILDMAN: "rk"
  400. sh:
  401. BUILDMAN: "sh -x arm"
  402. zynq:
  403. BUILDMAN: "zynq&armv7"
  404. zynqmp_versal:
  405. BUILDMAN: "versal|zynqmp&aarch64"
  406. riscv:
  407. BUILDMAN: "riscv"
  408. steps:
  409. - script: |
  410. cat << EOF > build.sh
  411. set -ex
  412. cd ${WORK_DIR}
  413. # make environment variables available as tests are running inside a container
  414. export BUILDMAN="${BUILDMAN}"
  415. EOF
  416. cat << "EOF" >> build.sh
  417. if [[ "${BUILDMAN}" != "" ]]; then
  418. ret=0;
  419. tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} ${OVERRIDE} || ret=$?;
  420. if [[ $ret -ne 0 && $ret -ne 129 ]]; then
  421. tools/buildman/buildman -o /tmp -sdeP ${BUILDMAN};
  422. exit $ret;
  423. fi;
  424. fi
  425. EOF
  426. cat build.sh
  427. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh