.azure-pipelines.yml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. variables:
  2. windows_vm: vs2015-win2012r2
  3. ubuntu_vm: ubuntu-18.04
  4. ci_runner_image: trini/u-boot-gitlab-ci-runner:bionic-20191010-20Oct2019
  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: todo
  55. displayName: 'Search for TODO within source tree'
  56. pool:
  57. vmImage: $(ubuntu_vm)
  58. container:
  59. image: $(ci_runner_image)
  60. options: $(container_option)
  61. steps:
  62. - script: grep -r TODO .
  63. - script: grep -r FIXME .
  64. - script: grep -r HACK . | grep -v HACKKIT
  65. - job: sloccount
  66. displayName: 'Some statistics about the code base'
  67. pool:
  68. vmImage: $(ubuntu_vm)
  69. container:
  70. image: $(ci_runner_image)
  71. options: $(container_option)
  72. steps:
  73. - script: sloccount .
  74. - job: maintainers
  75. displayName: 'Ensure all configs have MAINTAINERS entries'
  76. pool:
  77. vmImage: $(ubuntu_vm)
  78. container:
  79. image: $(ci_runner_image)
  80. options: $(container_option)
  81. steps:
  82. - script: |
  83. if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
  84. - job: tools_only
  85. displayName: 'Ensure host tools build'
  86. pool:
  87. vmImage: $(ubuntu_vm)
  88. container:
  89. image: $(ci_runner_image)
  90. options: $(container_option)
  91. steps:
  92. - script: |
  93. make tools-only_config tools-only -j$(nproc)
  94. - job: envtools
  95. displayName: 'Ensure env tools build'
  96. pool:
  97. vmImage: $(ubuntu_vm)
  98. container:
  99. image: $(ci_runner_image)
  100. options: $(container_option)
  101. steps:
  102. - script: |
  103. make tools-only_config envtools -j$(nproc)
  104. - job: utils
  105. displayName: 'Run binman, buildman, dtoc and patman testsuites'
  106. pool:
  107. vmImage: $(ubuntu_vm)
  108. steps:
  109. - script: |
  110. cat << EOF > build.sh
  111. set -ex
  112. cd ${WORK_DIR}
  113. EOF
  114. cat << "EOF" >> build.sh
  115. git config --global user.name "Azure Pipelines"
  116. git config --global user.email bmeng.cn@gmail.com
  117. export USER=azure
  118. virtualenv /tmp/venv
  119. . /tmp/venv/bin/activate
  120. pip install pyelftools
  121. export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/sandbox_spl
  122. export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
  123. export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
  124. ./tools/buildman/buildman -o /tmp -P sandbox_spl
  125. ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test
  126. ./tools/buildman/buildman -t
  127. ./tools/dtoc/dtoc -t
  128. ./tools/patman/patman --test
  129. EOF
  130. cat build.sh
  131. # We cannot use "container" like other jobs above, as buildman
  132. # seems to hang forever with pre-configured "container" environment
  133. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh
  134. - job: test_py
  135. displayName: 'test.py'
  136. pool:
  137. vmImage: $(ubuntu_vm)
  138. strategy:
  139. matrix:
  140. sandbox:
  141. TEST_PY_BD: "sandbox"
  142. BUILDMAN: "^sandbox$"
  143. sandbox_clang:
  144. TEST_PY_BD: "sandbox"
  145. BUILDMAN: "^sandbox$"
  146. OVERRIDE: "-O clang-7"
  147. sandbox_spl:
  148. TEST_PY_BD: "sandbox_spl"
  149. TEST_PY_TEST_SPEC: "test_ofplatdata"
  150. BUILDMAN: "^sandbox_spl$"
  151. sandbox_flattree:
  152. TEST_PY_BD: "sandbox_flattree"
  153. BUILDMAN: "^sandbox_flattree$"
  154. evb_ast2500:
  155. TEST_PY_BD: "evb-ast2500"
  156. TEST_PY_ID: "--id qemu"
  157. BUILDMAN: "^evb-ast2500$"
  158. vexpress_ca15_tc2:
  159. TEST_PY_BD: "vexpress_ca15_tc2"
  160. TEST_PY_ID: "--id qemu"
  161. BUILDMAN: "^vexpress_ca15_tc2$"
  162. vexpress_ca9x4:
  163. TEST_PY_BD: "vexpress_ca9x4"
  164. TEST_PY_ID: "--id qemu"
  165. BUILDMAN: "^vexpress_ca9x4$"
  166. integratorcp_cm926ejs:
  167. TEST_PY_BD: "integratorcp_cm926ejs"
  168. TEST_PY_ID: "--id qemu"
  169. TEST_PY_TEST_SPEC: "not sleep"
  170. BUILDMAN: "^integratorcp_cm926ejs$"
  171. qemu_arm:
  172. TEST_PY_BD: "qemu_arm"
  173. TEST_PY_TEST_SPEC: "not sleep"
  174. BUILDMAN: "^qemu_arm$"
  175. qemu_arm64:
  176. TEST_PY_BD: "qemu_arm64"
  177. TEST_PY_TEST_SPEC: "not sleep"
  178. BUILDMAN: "^qemu_arm64$"
  179. qemu_mips:
  180. TEST_PY_BD: "qemu_mips"
  181. TEST_PY_TEST_SPEC: "not sleep"
  182. BUILDMAN: "^qemu_mips$"
  183. qemu_mipsel:
  184. TEST_PY_BD: "qemu_mipsel"
  185. TEST_PY_TEST_SPEC: "not sleep"
  186. BUILDMAN: "^qemu_mipsel$"
  187. qemu_mips64:
  188. TEST_PY_BD: "qemu_mips64"
  189. TEST_PY_TEST_SPEC: "not sleep"
  190. BUILDMAN: "^qemu_mips64$"
  191. qemu_mips64el:
  192. TEST_PY_BD: "qemu_mips64el"
  193. TEST_PY_TEST_SPEC: "not sleep"
  194. BUILDMAN: "^qemu_mips64el$"
  195. qemu_ppce500:
  196. TEST_PY_BD: "qemu-ppce500"
  197. TEST_PY_TEST_SPEC: "not sleep"
  198. BUILDMAN: "^qemu-ppce500$"
  199. qemu_riscv64:
  200. TEST_PY_BD: "qemu-riscv64"
  201. TEST_PY_TEST_SPEC: "not sleep"
  202. BUILDMAN: "^qemu-riscv64$"
  203. qemu_x86:
  204. TEST_PY_BD: "qemu-x86"
  205. TEST_PY_TEST_SPEC: "not sleep"
  206. BUILDMAN: "^qemu-x86$"
  207. qemu_x86_64:
  208. TEST_PY_BD: "qemu-x86_64"
  209. TEST_PY_TEST_SPEC: "not sleep"
  210. BUILDMAN: "^qemu-x86_64$"
  211. zynq_zc702:
  212. TEST_PY_BD: "zynq_zc702"
  213. TEST_PY_ID: "--id qemu"
  214. TEST_PY_TEST_SPEC: "not sleep"
  215. BUILDMAN: "^zynq_zc702$"
  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. BUILDMAN: "^xilinx_versal_virt$"
  221. xtfpga:
  222. TEST_PY_BD: "xtfpga"
  223. TEST_PY_ID: "--id qemu"
  224. TEST_PY_TEST_SPEC: "not sleep"
  225. BUILDMAN: "^xtfpga$"
  226. steps:
  227. - script: |
  228. cat << EOF > test.sh
  229. set -ex
  230. # make environment variables available as tests are running inside a container
  231. export WORK_DIR="${WORK_DIR}"
  232. export TEST_PY_BD="${TEST_PY_BD}"
  233. export TEST_PY_ID="${TEST_PY_ID}"
  234. export TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}"
  235. export BUILDMAN="${BUILDMAN}"
  236. export OVERRIDE="${OVERRIDE}"
  237. EOF
  238. cat << "EOF" >> test.sh
  239. # the below corresponds to .gitlab-ci.yml "before_script"
  240. cd ${WORK_DIR}
  241. git clone --depth=1 git://github.com/swarren/uboot-test-hooks.git /tmp/uboot-test-hooks
  242. ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
  243. ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
  244. grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  245. grub-mkimage --prefix=\"\" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  246. mkdir ~/grub2-arm
  247. cd ~/grub2-arm; wget -O - http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm | rpm2cpio | cpio -di
  248. mkdir ~/grub2-arm64
  249. cd ~/grub2-arm64; wget -O - http://download.opensuse.org/ports/aarch64/distribution/leap/42.2/repo/oss/suse/aarch64/grub2-arm64-efi-2.02~beta2-87.1.aarch64.rpm | rpm2cpio | cpio -di
  250. # the below corresponds to .gitlab-ci.yml "script"
  251. cd ${WORK_DIR}
  252. if [[ "${BUILDMAN}" != "" ]]; then
  253. ret=0;
  254. tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} ${OVERRIDE} || ret=$?;
  255. if [[ $ret -ne 0 && $ret -ne 129 ]]; then
  256. tools/buildman/buildman -o /tmp -sdeP ${BUILDMAN};
  257. exit $ret;
  258. fi;
  259. fi
  260. virtualenv -p /usr/bin/python3 /tmp/venv
  261. . /tmp/venv/bin/activate
  262. pip install -r test/py/requirements.txt
  263. export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/${TEST_PY_BD};
  264. export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
  265. export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
  266. if [[ "${TEST_PY_BD}" != "" ]]; then
  267. ./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";
  268. ret=$?;
  269. if [[ $ret -ne 0 ]]; then
  270. exit $ret;
  271. fi;
  272. fi
  273. # the below corresponds to .gitlab-ci.yml "after_script"
  274. rm -rf ~/grub2* /tmp/uboot-test-hooks /tmp/venv
  275. EOF
  276. cat test.sh
  277. # make current directory writeable to uboot user inside the container
  278. # as sandbox testing need create files like spi flash images, etc.
  279. # (TODO: clean up this in the future)
  280. chmod 777 .
  281. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/test.sh
  282. - job: build_the_world
  283. displayName: 'Build the World'
  284. pool:
  285. vmImage: $(ubuntu_vm)
  286. strategy:
  287. # Use almost the same target division in .travis.yml, only merged
  288. # 4 small build jobs (arc/microblaze/nds32/xtensa) into one.
  289. matrix:
  290. arc_microblaze_nds32_xtensa:
  291. BUILDMAN: "arc microblaze nds32 xtensa"
  292. arm11_arm7_arm920t_arm946es:
  293. BUILDMAN: "arm11 arm7 arm920t arm946es"
  294. arm926ejs:
  295. BUILDMAN: "arm926ejs -x freescale,siemens,at91,kirkwood,spear,omap"
  296. at91_non_armv7:
  297. BUILDMAN: "at91 -x armv7"
  298. at91_non_arm926ejs:
  299. BUILDMAN: "at91 -x arm926ejs"
  300. boundary_engicam_toradex:
  301. BUILDMAN: "boundary engicam toradex"
  302. arm_bcm:
  303. BUILDMAN: "bcm -x mips"
  304. nxp_arm32:
  305. BUILDMAN: "freescale -x powerpc,m68k,aarch64"
  306. nxp_aarch64_ls101x:
  307. BUILDMAN: "freescale&aarch64&ls101"
  308. nxp_aarch64_ls102x:
  309. BUILDMAN: "freescale&aarch64&ls102"
  310. nxp_aarch64_ls104x:
  311. BUILDMAN: "freescale&aarch64&ls104"
  312. nxp_aarch64_ls108x:
  313. BUILDMAN: "freescale&aarch64&ls108"
  314. nxp_aarch64_ls20xx:
  315. BUILDMAN: "freescale&aarch64&ls20"
  316. nxp_aarch64_lx216x:
  317. BUILDMAN: "freescale&aarch64&lx216"
  318. imx6:
  319. BUILDMAN: "mx6 -x boundary,engicam,freescale,technexion,toradex"
  320. imx:
  321. BUILDMAN: "mx -x mx6,freescale,technexion,toradex"
  322. keystone2_keystone3:
  323. BUILDMAN: "k2 k3"
  324. samsung_socfpga:
  325. BUILDMAN: "samsung socfpga"
  326. spear:
  327. BUILDMAN: "spear"
  328. sun4i:
  329. BUILDMAN: "sun4i"
  330. sun5i:
  331. BUILDMAN: "sun5i"
  332. sun6i:
  333. BUILDMAN: "sun6i"
  334. sun7i:
  335. BUILDMAN: "sun7i"
  336. sun8i_32bit:
  337. BUILDMAN: "sun8i&armv7"
  338. sun8i_64bit:
  339. BUILDMAN: "sun8i&aarch64"
  340. sun9i:
  341. BUILDMAN: "sun9i"
  342. sun50i:
  343. BUILDMAN: "sun50i"
  344. arm_catch_all:
  345. BUILDMAN: "arm -x arm11,arm7,arm9,aarch64,at91,bcm,freescale,kirkwood,mvebu,siemens,tegra,uniphier,mx,samsung,sunxi,am33xx,omap,rockchip,toradex,socfpga,k2,k3,zynq"
  346. sandbox_x86:
  347. BUILDMAN: "sandbox x86"
  348. technexion:
  349. BUILDMAN: "technexion"
  350. kirkwood:
  351. BUILDMAN: "kirkwood"
  352. mvebu:
  353. BUILDMAN: "mvebu"
  354. m68k:
  355. BUILDMAN: "m68k"
  356. mips:
  357. BUILDMAN: "mips"
  358. non_fsl_ppc:
  359. BUILDMAN: "powerpc -x freescale"
  360. mpc85xx_freescale:
  361. BUILDMAN: "mpc85xx&freescale -x t208xrdb -x t4qds -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x b4860qds -x bsc91*"
  362. t208xrdb_corenet_ds:
  363. BUILDMAN: "t208xrdb corenet_ds"
  364. fsl_ppc:
  365. BUILDMAN: "t4qds b4860qds mpc83xx&freescale mpc86xx&freescale"
  366. t102x:
  367. BUILDMAN: "t102*"
  368. p1_p2_rdb_pc:
  369. BUILDMAN: "p1_p2_rdb_pc"
  370. p1010rdb_bsc91:
  371. BUILDMAN: "p1010rdb bsc91"
  372. siemens:
  373. BUILDMAN: "siemens"
  374. tegra:
  375. BUILDMAN: "tegra -x toradex"
  376. am33xx_no_siemens:
  377. BUILDMAN: "am33xx -x siemens"
  378. omap:
  379. BUILDMAN: "omap"
  380. uniphier:
  381. BUILDMAN: "uniphier"
  382. aarch64_catch_all:
  383. BUILDMAN: "aarch64 -x bcm,k3,tegra,ls1,ls2,mvebu,uniphier,sunxi,samsung,rockchip,versal,zynq"
  384. rockchip:
  385. BUILDMAN: "rockchip"
  386. sh:
  387. BUILDMAN: "sh -x arm"
  388. zynq:
  389. BUILDMAN: "zynq&armv7"
  390. zynqmp_versal:
  391. BUILDMAN: "versal|zynqmp&aarch64"
  392. riscv:
  393. BUILDMAN: "riscv"
  394. steps:
  395. - script: |
  396. cat << EOF > build.sh
  397. set -ex
  398. cd ${WORK_DIR}
  399. # make environment variables available as tests are running inside a container
  400. export BUILDMAN="${BUILDMAN}"
  401. EOF
  402. cat << "EOF" >> build.sh
  403. if [[ "${BUILDMAN}" != "" ]]; then
  404. ret=0;
  405. tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} ${OVERRIDE} || ret=$?;
  406. if [[ $ret -ne 0 && $ret -ne 129 ]]; then
  407. tools/buildman/buildman -o /tmp -sdeP ${BUILDMAN};
  408. exit $ret;
  409. fi;
  410. fi
  411. EOF
  412. cat build.sh
  413. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh