.azure-pipelines.yml 15 KB

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