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