.azure-pipelines.yml 15 KB

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