.azure-pipelines.yml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. variables:
  2. windows_vm: vs2017-win2016
  3. ubuntu_vm: ubuntu-18.04
  4. macos_vm: macOS-10.15
  5. ci_runner_image: trini/u-boot-gitlab-ci-runner:bionic-20200713-05Aug2020
  6. # Add '-u 0' options for Azure pipelines, otherwise we get "permission
  7. # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
  8. # since our $(ci_runner_image) user is not root.
  9. container_option: -u 0
  10. work_dir: /u
  11. jobs:
  12. - job: tools_only_windows
  13. displayName: 'Ensure host tools build for Windows'
  14. pool:
  15. vmImage: $(windows_vm)
  16. steps:
  17. - powershell: |
  18. (New-Object Net.WebClient).DownloadFile("https://github.com/msys2/msys2-installer/releases/download/2020-07-20/msys2-base-x86_64-20200720.sfx.exe", "sfx.exe")
  19. displayName: 'Install MSYS2'
  20. - script: |
  21. sfx.exe -y -o%CD:~0,2%\
  22. %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm -Syyuu"
  23. displayName: 'Update MSYS2'
  24. - script: |
  25. %CD:~0,2%\msys64\usr\bin\bash -lc "pacman --noconfirm --needed -S make gcc bison flex diffutils openssl-devel"
  26. displayName: 'Install Toolchain'
  27. - script: |
  28. echo make tools-only_defconfig tools-only NO_SDL=1 > build-tools.sh
  29. %CD:~0,2%\msys64\usr\bin\bash -lc "bash build-tools.sh"
  30. displayName: 'Build Host Tools'
  31. env:
  32. # Tell MSYS2 we need a POSIX emulation layer
  33. MSYSTEM: MSYS
  34. # Tell MSYS2 not to ‘cd’ our startup directory to HOME
  35. CHERE_INVOKING: yes
  36. - job: tools_only_macOS
  37. displayName: 'Ensure host tools build for macOS X'
  38. pool:
  39. vmImage: $(macos_vm)
  40. steps:
  41. - script: brew install make
  42. displayName: Brew install dependencies
  43. - script: |
  44. gmake tools-only_config tools-only NO_SDL=1 \
  45. HOSTCFLAGS="-I/usr/local/opt/openssl@1.1/include" \
  46. HOSTLDFLAGS="-L/usr/local/opt/openssl@1.1/lib" \
  47. -j$(sysctl -n hw.logicalcpu)
  48. displayName: 'Perform tools-only build'
  49. - job: cppcheck
  50. displayName: 'Static code analysis with cppcheck'
  51. pool:
  52. vmImage: $(ubuntu_vm)
  53. container:
  54. image: $(ci_runner_image)
  55. options: $(container_option)
  56. steps:
  57. - script: cppcheck -j$(nproc) --force --quiet --inline-suppr .
  58. - job: htmldocs
  59. displayName: 'Build HTML documentation'
  60. pool:
  61. vmImage: $(ubuntu_vm)
  62. container:
  63. image: $(ci_runner_image)
  64. options: $(container_option)
  65. steps:
  66. - script: make htmldocs
  67. - job: todo
  68. displayName: 'Search for TODO within source tree'
  69. pool:
  70. vmImage: $(ubuntu_vm)
  71. container:
  72. image: $(ci_runner_image)
  73. options: $(container_option)
  74. steps:
  75. - script: grep -r TODO .
  76. - script: grep -r FIXME .
  77. - script: grep -r HACK . | grep -v HACKKIT
  78. - job: sloccount
  79. displayName: 'Some statistics about the code base'
  80. pool:
  81. vmImage: $(ubuntu_vm)
  82. container:
  83. image: $(ci_runner_image)
  84. options: $(container_option)
  85. steps:
  86. - script: sloccount .
  87. - job: maintainers
  88. displayName: 'Ensure all configs have MAINTAINERS entries'
  89. pool:
  90. vmImage: $(ubuntu_vm)
  91. container:
  92. image: $(ci_runner_image)
  93. options: $(container_option)
  94. steps:
  95. - script: |
  96. if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
  97. - job: tools_only
  98. displayName: 'Ensure host tools build'
  99. pool:
  100. vmImage: $(ubuntu_vm)
  101. container:
  102. image: $(ci_runner_image)
  103. options: $(container_option)
  104. steps:
  105. - script: |
  106. make tools-only_config tools-only -j$(nproc)
  107. - job: envtools
  108. displayName: 'Ensure env tools build'
  109. pool:
  110. vmImage: $(ubuntu_vm)
  111. container:
  112. image: $(ci_runner_image)
  113. options: $(container_option)
  114. steps:
  115. - script: |
  116. make tools-only_config envtools -j$(nproc)
  117. - job: utils
  118. displayName: 'Run binman, buildman, dtoc, Kconfig and patman testsuites'
  119. pool:
  120. vmImage: $(ubuntu_vm)
  121. steps:
  122. - script: |
  123. cat << EOF > build.sh
  124. set -ex
  125. cd ${WORK_DIR}
  126. EOF
  127. cat << "EOF" >> build.sh
  128. git config --global user.name "Azure Pipelines"
  129. git config --global user.email bmeng.cn@gmail.com
  130. export USER=azure
  131. virtualenv -p /usr/bin/python3 /tmp/venv
  132. . /tmp/venv/bin/activate
  133. pip install pyelftools pytest
  134. export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
  135. export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
  136. export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
  137. ./tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w sandbox_spl
  138. ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test
  139. ./tools/buildman/buildman -t
  140. ./tools/dtoc/dtoc -t
  141. ./tools/patman/patman test
  142. make O=${UBOOT_TRAVIS_BUILD_DIR} testconfig
  143. EOF
  144. cat build.sh
  145. # We cannot use "container" like other jobs above, as buildman
  146. # seems to hang forever with pre-configured "container" environment
  147. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh
  148. - job: nokia_rx51_test
  149. displayName: 'Run tests for Nokia RX-51 (aka N900)'
  150. pool:
  151. vmImage: $(ubuntu_vm)
  152. container:
  153. image: $(ci_runner_image)
  154. options: $(container_option)
  155. steps:
  156. - script: |
  157. ./tools/buildman/buildman --fetch-arch arm
  158. export PATH=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/:$PATH
  159. test/nokia_rx51_test.sh
  160. - job: test_py
  161. displayName: 'test.py'
  162. pool:
  163. vmImage: $(ubuntu_vm)
  164. strategy:
  165. matrix:
  166. sandbox:
  167. TEST_PY_BD: "sandbox"
  168. sandbox_clang:
  169. TEST_PY_BD: "sandbox"
  170. OVERRIDE: "-O clang-10"
  171. sandbox_spl:
  172. TEST_PY_BD: "sandbox_spl"
  173. TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff"
  174. sandbox_flattree:
  175. TEST_PY_BD: "sandbox_flattree"
  176. evb_ast2500:
  177. TEST_PY_BD: "evb-ast2500"
  178. TEST_PY_ID: "--id qemu"
  179. vexpress_ca15_tc2:
  180. TEST_PY_BD: "vexpress_ca15_tc2"
  181. TEST_PY_ID: "--id qemu"
  182. vexpress_ca9x4:
  183. TEST_PY_BD: "vexpress_ca9x4"
  184. TEST_PY_ID: "--id qemu"
  185. integratorcp_cm926ejs:
  186. TEST_PY_BD: "integratorcp_cm926ejs"
  187. TEST_PY_ID: "--id qemu"
  188. TEST_PY_TEST_SPEC: "not sleep"
  189. qemu_arm:
  190. TEST_PY_BD: "qemu_arm"
  191. TEST_PY_TEST_SPEC: "not sleep"
  192. qemu_arm64:
  193. TEST_PY_BD: "qemu_arm64"
  194. TEST_PY_TEST_SPEC: "not sleep"
  195. qemu_mips:
  196. TEST_PY_BD: "qemu_mips"
  197. TEST_PY_TEST_SPEC: "not sleep"
  198. qemu_mipsel:
  199. TEST_PY_BD: "qemu_mipsel"
  200. TEST_PY_TEST_SPEC: "not sleep"
  201. qemu_mips64:
  202. TEST_PY_BD: "qemu_mips64"
  203. TEST_PY_TEST_SPEC: "not sleep"
  204. qemu_mips64el:
  205. TEST_PY_BD: "qemu_mips64el"
  206. TEST_PY_TEST_SPEC: "not sleep"
  207. qemu_malta:
  208. TEST_PY_BD: "malta"
  209. TEST_PY_ID: "--id qemu"
  210. TEST_PY_TEST_SPEC: "not sleep and not efi"
  211. qemu_maltael:
  212. TEST_PY_BD: "maltael"
  213. TEST_PY_ID: "--id qemu"
  214. TEST_PY_TEST_SPEC: "not sleep and not efi"
  215. qemu_malta64:
  216. TEST_PY_BD: "malta64"
  217. TEST_PY_ID: "--id qemu"
  218. TEST_PY_TEST_SPEC: "not sleep and not efi"
  219. qemu_malta64el:
  220. TEST_PY_BD: "malta64el"
  221. TEST_PY_ID: "--id qemu"
  222. TEST_PY_TEST_SPEC: "not sleep and not efi"
  223. qemu_ppce500:
  224. TEST_PY_BD: "qemu-ppce500"
  225. TEST_PY_TEST_SPEC: "not sleep"
  226. qemu_riscv32:
  227. TEST_PY_BD: "qemu-riscv32"
  228. TEST_PY_TEST_SPEC: "not sleep"
  229. qemu_riscv64:
  230. TEST_PY_BD: "qemu-riscv64"
  231. TEST_PY_TEST_SPEC: "not sleep"
  232. qemu_riscv32_spl:
  233. TEST_PY_BD: "qemu-riscv32_spl"
  234. TEST_PY_TEST_SPEC: "not sleep"
  235. qemu_riscv64_spl:
  236. TEST_PY_BD: "qemu-riscv64_spl"
  237. TEST_PY_TEST_SPEC: "not sleep"
  238. qemu_x86:
  239. TEST_PY_BD: "qemu-x86"
  240. TEST_PY_TEST_SPEC: "not sleep"
  241. qemu_x86_64:
  242. TEST_PY_BD: "qemu-x86_64"
  243. TEST_PY_TEST_SPEC: "not sleep"
  244. xilinx_zynq_virt:
  245. TEST_PY_BD: "xilinx_zynq_virt"
  246. TEST_PY_ID: "--id qemu"
  247. TEST_PY_TEST_SPEC: "not sleep"
  248. xilinx_versal_virt:
  249. TEST_PY_BD: "xilinx_versal_virt"
  250. TEST_PY_ID: "--id qemu"
  251. TEST_PY_TEST_SPEC: "not sleep"
  252. xtfpga:
  253. TEST_PY_BD: "xtfpga"
  254. TEST_PY_ID: "--id qemu"
  255. TEST_PY_TEST_SPEC: "not sleep"
  256. steps:
  257. - script: |
  258. cat << EOF > test.sh
  259. set -ex
  260. # make environment variables available as tests are running inside a container
  261. export WORK_DIR="${WORK_DIR}"
  262. export TEST_PY_BD="${TEST_PY_BD}"
  263. export TEST_PY_ID="${TEST_PY_ID}"
  264. export TEST_PY_TEST_SPEC="${TEST_PY_TEST_SPEC}"
  265. export OVERRIDE="${OVERRIDE}"
  266. EOF
  267. cat << "EOF" >> test.sh
  268. # the below corresponds to .gitlab-ci.yml "before_script"
  269. cd ${WORK_DIR}
  270. git clone --depth=1 git://github.com/swarren/uboot-test-hooks.git /tmp/uboot-test-hooks
  271. ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
  272. ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
  273. grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  274. grub-mkimage --prefix=\"\" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  275. if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
  276. wget -O - https://github.com/riscv/opensbi/releases/download/v0.8/opensbi-0.8-rv-bin.tar.xz | tar -C /tmp -xJ;
  277. export OPENSBI=/tmp/opensbi-0.8-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin;
  278. fi
  279. if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]]; then
  280. wget -O - https://github.com/riscv/opensbi/releases/download/v0.8/opensbi-0.8-rv-bin.tar.xz | tar -C /tmp -xJ;
  281. export OPENSBI=/tmp/opensbi-0.8-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin;
  282. fi
  283. # the below corresponds to .gitlab-ci.yml "script"
  284. cd ${WORK_DIR}
  285. export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD};
  286. tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board ${TEST_PY_BD} ${OVERRIDE}
  287. cp ~/grub_x86.efi ${UBOOT_TRAVIS_BUILD_DIR}/
  288. cp ~/grub_x64.efi ${UBOOT_TRAVIS_BUILD_DIR}/
  289. cp /opt/grub/grubriscv64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_riscv64.efi
  290. cp /opt/grub/grubriscv32.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_riscv32.efi
  291. cp /opt/grub/grubaa64.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm64.efi
  292. cp /opt/grub/grubarm.efi ${UBOOT_TRAVIS_BUILD_DIR}/grub_arm.efi
  293. virtualenv -p /usr/bin/python3 /tmp/venv
  294. . /tmp/venv/bin/activate
  295. pip install -r test/py/requirements.txt
  296. export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
  297. export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
  298. # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
  299. ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID} ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
  300. # the below corresponds to .gitlab-ci.yml "after_script"
  301. rm -rf /tmp/uboot-test-hooks /tmp/venv
  302. EOF
  303. cat test.sh
  304. # make current directory writeable to uboot user inside the container
  305. # as sandbox testing need create files like spi flash images, etc.
  306. # (TODO: clean up this in the future)
  307. chmod 777 .
  308. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/test.sh
  309. - job: build_the_world
  310. displayName: 'Build the World'
  311. pool:
  312. vmImage: $(ubuntu_vm)
  313. strategy:
  314. # Use almost the same target division in .travis.yml, only merged
  315. # 4 small build jobs (arc/microblaze/nds32/xtensa) into one.
  316. matrix:
  317. arc_microblaze_nds32_xtensa:
  318. BUILDMAN: "arc microblaze nds32 xtensa"
  319. arm11_arm7_arm920t_arm946es:
  320. BUILDMAN: "arm11 arm7 arm920t arm946es"
  321. arm926ejs:
  322. BUILDMAN: "arm926ejs -x freescale,siemens,at91,kirkwood,spear,omap"
  323. at91_non_armv7:
  324. BUILDMAN: "at91 -x armv7"
  325. at91_non_arm926ejs:
  326. BUILDMAN: "at91 -x arm926ejs"
  327. boundary_engicam_toradex:
  328. BUILDMAN: "boundary engicam toradex"
  329. arm_bcm:
  330. BUILDMAN: "bcm -x mips"
  331. nxp_arm32:
  332. BUILDMAN: "freescale -x powerpc,m68k,aarch64,ls101,ls102,ls104,ls108,ls20,lx216"
  333. nxp_ls101x:
  334. BUILDMAN: "freescale&ls101"
  335. nxp_ls102x:
  336. BUILDMAN: "freescale&ls102"
  337. nxp_ls104x:
  338. BUILDMAN: "freescale&ls104"
  339. nxp_ls108x:
  340. BUILDMAN: "freescale&ls108"
  341. nxp_ls20xx:
  342. BUILDMAN: "freescale&ls20"
  343. nxp_lx216x:
  344. BUILDMAN: "freescale&lx216"
  345. imx6:
  346. BUILDMAN: "mx6 -x boundary,engicam,freescale,technexion,toradex"
  347. imx:
  348. BUILDMAN: "mx -x mx6,freescale,technexion,toradex"
  349. keystone2_keystone3:
  350. BUILDMAN: "k2 k3"
  351. samsung_socfpga:
  352. BUILDMAN: "samsung socfpga"
  353. spear:
  354. BUILDMAN: "spear"
  355. sun4i:
  356. BUILDMAN: "sun4i"
  357. sun5i:
  358. BUILDMAN: "sun5i"
  359. sun6i:
  360. BUILDMAN: "sun6i"
  361. sun7i:
  362. BUILDMAN: "sun7i"
  363. sun8i_32bit:
  364. BUILDMAN: "sun8i&armv7"
  365. sun8i_64bit:
  366. BUILDMAN: "sun8i&aarch64"
  367. sun9i:
  368. BUILDMAN: "sun9i"
  369. sun50i:
  370. BUILDMAN: "sun50i"
  371. arm_catch_all:
  372. 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"
  373. sandbox_x86:
  374. BUILDMAN: "sandbox x86"
  375. technexion:
  376. BUILDMAN: "technexion"
  377. kirkwood:
  378. BUILDMAN: "kirkwood"
  379. mvebu:
  380. BUILDMAN: "mvebu"
  381. m68k:
  382. BUILDMAN: "m68k"
  383. mips:
  384. BUILDMAN: "mips"
  385. non_fsl_ppc:
  386. BUILDMAN: "powerpc -x freescale"
  387. mpc85xx_freescale:
  388. BUILDMAN: "mpc85xx&freescale -x t208xrdb -x t4qds -x t102* -x p1_p2_rdb_pc -x p1010rdb -x corenet_ds -x b4860qds -x bsc91*"
  389. t208xrdb_corenet_ds:
  390. BUILDMAN: "t208xrdb corenet_ds"
  391. fsl_ppc:
  392. BUILDMAN: "t4qds b4860qds mpc83xx&freescale mpc86xx&freescale"
  393. t102x:
  394. BUILDMAN: "t102*"
  395. p1_p2_rdb_pc:
  396. BUILDMAN: "p1_p2_rdb_pc"
  397. p1010rdb_bsc91:
  398. BUILDMAN: "p1010rdb bsc91"
  399. siemens:
  400. BUILDMAN: "siemens"
  401. tegra:
  402. BUILDMAN: "tegra -x toradex"
  403. am33xx_no_siemens:
  404. BUILDMAN: "am33xx -x siemens"
  405. omap:
  406. BUILDMAN: "omap"
  407. uniphier:
  408. BUILDMAN: "uniphier"
  409. aarch64_catch_all:
  410. BUILDMAN: "aarch64 -x bcm,k3,tegra,ls1,ls2,lx216,mvebu,uniphier,sunxi,samsung,socfpga,rk,versal,zynq"
  411. rockchip:
  412. BUILDMAN: "rk"
  413. sh:
  414. BUILDMAN: "sh -x arm"
  415. zynq:
  416. BUILDMAN: "zynq&armv7"
  417. zynqmp_versal:
  418. BUILDMAN: "versal|zynqmp&aarch64"
  419. riscv:
  420. BUILDMAN: "riscv"
  421. steps:
  422. - script: |
  423. cat << EOF > build.sh
  424. set -ex
  425. cd ${WORK_DIR}
  426. # make environment variables available as tests are running inside a container
  427. export BUILDMAN="${BUILDMAN}"
  428. EOF
  429. cat << "EOF" >> build.sh
  430. if [[ "${BUILDMAN}" != "" ]]; then
  431. ret=0;
  432. tools/buildman/buildman -o /tmp -P -W ${BUILDMAN} ${OVERRIDE} || ret=$?;
  433. if [[ $ret -ne 0 ]]; then
  434. tools/buildman/buildman -o /tmp -seP ${BUILDMAN};
  435. exit $ret;
  436. fi;
  437. fi
  438. EOF
  439. cat build.sh
  440. docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash $(work_dir)/build.sh