.azure-pipelines.yml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  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: nokia_rx51_test
  145. displayName: 'Run tests for Nokia RX-51 (aka N900)'
  146. pool:
  147. vmImage: $(ubuntu_vm)
  148. container:
  149. image: $(ci_runner_image)
  150. options: $(container_option)
  151. steps:
  152. - script: |
  153. ./tools/buildman/buildman --fetch-arch arm
  154. export PATH=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/:$PATH
  155. test/nokia_rx51_test.sh
  156. - job: test_py
  157. displayName: 'test.py'
  158. pool:
  159. vmImage: $(ubuntu_vm)
  160. strategy:
  161. matrix:
  162. sandbox:
  163. TEST_PY_BD: "sandbox"
  164. sandbox_clang:
  165. TEST_PY_BD: "sandbox"
  166. OVERRIDE: "-O clang-10"
  167. sandbox_spl:
  168. TEST_PY_BD: "sandbox_spl"
  169. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff"
  170. sandbox_flattree:
  171. TEST_PY_BD: "sandbox_flattree"
  172. evb_ast2500:
  173. TEST_PY_BD: "evb-ast2500"
  174. TEST_PY_ID: "--id qemu"
  175. vexpress_ca15_tc2:
  176. TEST_PY_BD: "vexpress_ca15_tc2"
  177. TEST_PY_ID: "--id qemu"
  178. vexpress_ca9x4:
  179. TEST_PY_BD: "vexpress_ca9x4"
  180. TEST_PY_ID: "--id qemu"
  181. integratorcp_cm926ejs:
  182. TEST_PY_BD: "integratorcp_cm926ejs"
  183. TEST_PY_ID: "--id qemu"
  184. TEST_PY_TEST_SPEC: "not sleep"
  185. qemu_arm:
  186. TEST_PY_BD: "qemu_arm"
  187. TEST_PY_TEST_SPEC: "not sleep"
  188. qemu_arm64:
  189. TEST_PY_BD: "qemu_arm64"
  190. TEST_PY_TEST_SPEC: "not sleep"
  191. qemu_mips:
  192. TEST_PY_BD: "qemu_mips"
  193. TEST_PY_TEST_SPEC: "not sleep"
  194. qemu_mipsel:
  195. TEST_PY_BD: "qemu_mipsel"
  196. TEST_PY_TEST_SPEC: "not sleep"
  197. qemu_mips64:
  198. TEST_PY_BD: "qemu_mips64"
  199. TEST_PY_TEST_SPEC: "not sleep"
  200. qemu_mips64el:
  201. TEST_PY_BD: "qemu_mips64el"
  202. TEST_PY_TEST_SPEC: "not sleep"
  203. qemu_ppce500:
  204. TEST_PY_BD: "qemu-ppce500"
  205. TEST_PY_TEST_SPEC: "not sleep"
  206. qemu_riscv32:
  207. TEST_PY_BD: "qemu-riscv32"
  208. TEST_PY_TEST_SPEC: "not sleep"
  209. qemu_riscv64:
  210. TEST_PY_BD: "qemu-riscv64"
  211. TEST_PY_TEST_SPEC: "not sleep"
  212. qemu_riscv32_spl:
  213. TEST_PY_BD: "qemu-riscv32_spl"
  214. TEST_PY_TEST_SPEC: "not sleep"
  215. qemu_riscv64_spl:
  216. TEST_PY_BD: "qemu-riscv64_spl"
  217. TEST_PY_TEST_SPEC: "not sleep"
  218. qemu_x86:
  219. TEST_PY_BD: "qemu-x86"
  220. TEST_PY_TEST_SPEC: "not sleep"
  221. qemu_x86_64:
  222. TEST_PY_BD: "qemu-x86_64"
  223. TEST_PY_TEST_SPEC: "not sleep"
  224. xilinx_zynq_virt:
  225. TEST_PY_BD: "xilinx_zynq_virt"
  226. TEST_PY_ID: "--id qemu"
  227. TEST_PY_TEST_SPEC: "not sleep"
  228. xilinx_versal_virt:
  229. TEST_PY_BD: "xilinx_versal_virt"
  230. TEST_PY_ID: "--id qemu"
  231. TEST_PY_TEST_SPEC: "not sleep"
  232. xtfpga:
  233. TEST_PY_BD: "xtfpga"
  234. TEST_PY_ID: "--id qemu"
  235. TEST_PY_TEST_SPEC: "not sleep"
  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 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/grubriscv32.efi ~/grub_riscv32.efi
  257. cp /opt/grub/grubaa64.efi ~/grub_arm64.efi
  258. cp /opt/grub/grubarm.efi ~/grub_arm.efi
  259. if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
  260. wget -O - https://github.com/riscv/opensbi/releases/download/v0.6/opensbi-0.6-rv32-bin.tar.xz | tar -C /tmp -xJ;
  261. export OPENSBI=/tmp/opensbi-0.6-rv32-bin/platform/qemu/virt/firmware/fw_dynamic.bin;
  262. fi
  263. if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]]; then
  264. wget -O - https://github.com/riscv/opensbi/releases/download/v0.6/opensbi-0.6-rv64-bin.tar.xz | tar -C /tmp -xJ;
  265. export OPENSBI=/tmp/opensbi-0.6-rv64-bin/platform/qemu/virt/firmware/fw_dynamic.bin;
  266. fi
  267. # the below corresponds to .gitlab-ci.yml "script"
  268. cd ${WORK_DIR}
  269. export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD};
  270. tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board ${TEST_PY_BD} ${OVERRIDE}
  271. virtualenv -p /usr/bin/python3 /tmp/venv
  272. . /tmp/venv/bin/activate
  273. pip install -r test/py/requirements.txt
  274. export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
  275. export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
  276. # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
  277. ./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";
  278. # the below corresponds to .gitlab-ci.yml "after_script"
  279. rm -rf /tmp/uboot-test-hooks /tmp/venv
  280. EOF
  281. cat test.sh
  282. # make current directory writeable to uboot user inside the container
  283. # as sandbox testing need create files like spi flash images, etc.
  284. # (TODO: clean up this in the future)
  285. chmod 777 .
  286. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/test.sh
  287. - job: build_the_world
  288. displayName: 'Build the World'
  289. pool:
  290. vmImage: $(ubuntu_vm)
  291. strategy:
  292. # Use almost the same target division in .travis.yml, only merged
  293. # 4 small build jobs (arc/microblaze/nds32/xtensa) into one.
  294. matrix:
  295. arc_microblaze_nds32_xtensa:
  296. BUILDMAN: "arc microblaze nds32 xtensa"
  297. arm11_arm7_arm920t_arm946es:
  298. BUILDMAN: "arm11 arm7 arm920t arm946es"
  299. arm926ejs:
  300. BUILDMAN: "arm926ejs -x freescale,siemens,at91,kirkwood,spear,omap"
  301. at91_non_armv7:
  302. BUILDMAN: "at91 -x armv7"
  303. at91_non_arm926ejs:
  304. BUILDMAN: "at91 -x arm926ejs"
  305. boundary_engicam_toradex:
  306. BUILDMAN: "boundary engicam toradex"
  307. arm_bcm:
  308. BUILDMAN: "bcm -x mips"
  309. nxp_arm32:
  310. BUILDMAN: "freescale -x powerpc,m68k,aarch64,ls101,ls102,ls104,ls108,ls20,lx216"
  311. nxp_ls101x:
  312. BUILDMAN: "freescale&ls101"
  313. nxp_ls102x:
  314. BUILDMAN: "freescale&ls102"
  315. nxp_ls104x:
  316. BUILDMAN: "freescale&ls104"
  317. nxp_ls108x:
  318. BUILDMAN: "freescale&ls108"
  319. nxp_ls20xx:
  320. BUILDMAN: "freescale&ls20"
  321. nxp_lx216x:
  322. BUILDMAN: "freescale&lx216"
  323. imx6:
  324. BUILDMAN: "mx6 -x boundary,engicam,freescale,technexion,toradex"
  325. imx:
  326. BUILDMAN: "mx -x mx6,freescale,technexion,toradex"
  327. keystone2_keystone3:
  328. BUILDMAN: "k2 k3"
  329. samsung_socfpga:
  330. BUILDMAN: "samsung socfpga"
  331. spear:
  332. BUILDMAN: "spear"
  333. sun4i:
  334. BUILDMAN: "sun4i"
  335. sun5i:
  336. BUILDMAN: "sun5i"
  337. sun6i:
  338. BUILDMAN: "sun6i"
  339. sun7i:
  340. BUILDMAN: "sun7i"
  341. sun8i_32bit:
  342. BUILDMAN: "sun8i&armv7"
  343. sun8i_64bit:
  344. BUILDMAN: "sun8i&aarch64"
  345. sun9i:
  346. BUILDMAN: "sun9i"
  347. sun50i:
  348. BUILDMAN: "sun50i"
  349. arm_catch_all:
  350. 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"
  351. sandbox_x86:
  352. BUILDMAN: "sandbox x86"
  353. technexion:
  354. BUILDMAN: "technexion"
  355. kirkwood:
  356. BUILDMAN: "kirkwood"
  357. mvebu:
  358. BUILDMAN: "mvebu"
  359. m68k:
  360. BUILDMAN: "m68k"
  361. mips:
  362. BUILDMAN: "mips"
  363. non_fsl_ppc:
  364. BUILDMAN: "powerpc -x freescale"
  365. mpc85xx_freescale:
  366. BUILDMAN: "mpc85xx&freescale -x t208xrdb -x t4qds -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x b4860qds -x bsc91*"
  367. t208xrdb_corenet_ds:
  368. BUILDMAN: "t208xrdb corenet_ds"
  369. fsl_ppc:
  370. BUILDMAN: "t4qds b4860qds mpc83xx&freescale mpc86xx&freescale"
  371. t102x:
  372. BUILDMAN: "t102*"
  373. p1_p2_rdb_pc:
  374. BUILDMAN: "p1_p2_rdb_pc"
  375. p1010rdb_bsc91:
  376. BUILDMAN: "p1010rdb bsc91"
  377. siemens:
  378. BUILDMAN: "siemens"
  379. tegra:
  380. BUILDMAN: "tegra -x toradex"
  381. am33xx_no_siemens:
  382. BUILDMAN: "am33xx -x siemens"
  383. omap:
  384. BUILDMAN: "omap"
  385. uniphier:
  386. BUILDMAN: "uniphier"
  387. aarch64_catch_all:
  388. BUILDMAN: "aarch64 -x bcm,k3,tegra,ls1,ls2,lx216,mvebu,uniphier,sunxi,samsung,socfpga,rk,versal,zynq"
  389. rockchip:
  390. BUILDMAN: "rk"
  391. sh:
  392. BUILDMAN: "sh -x arm"
  393. zynq:
  394. BUILDMAN: "zynq&armv7"
  395. zynqmp_versal:
  396. BUILDMAN: "versal|zynqmp&aarch64"
  397. riscv:
  398. BUILDMAN: "riscv"
  399. steps:
  400. - script: |
  401. cat << EOF > build.sh
  402. set -ex
  403. cd ${WORK_DIR}
  404. # make environment variables available as tests are running inside a container
  405. export BUILDMAN="${BUILDMAN}"
  406. EOF
  407. cat << "EOF" >> build.sh
  408. if [[ "${BUILDMAN}" != "" ]]; then
  409. ret=0;
  410. tools/buildman/buildman -o /tmp -P -W ${BUILDMAN} ${OVERRIDE} || ret=$?;
  411. if [[ $ret -ne 0 ]]; then
  412. tools/buildman/buildman -o /tmp -seP ${BUILDMAN};
  413. exit $ret;
  414. fi;
  415. fi
  416. EOF
  417. cat build.sh
  418. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh