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