uboot/.gitlab-ci.yml
<<
>>
Prefs
   1# SPDX-License-Identifier: GPL-2.0+
   2
   3# Grab our configured image.  The source for this is found at:
   4# https://source.denx.de/u-boot/gitlab-ci-runner
   5image: trini/u-boot-gitlab-ci-runner:focal-20210723-30Sep2021
   6
   7# We run some tests in different order, to catch some failures quicker.
   8stages:
   9  - testsuites
  10  - test.py
  11  - world build
  12
  13.buildman_and_testpy_template: &buildman_and_testpy_dfn
  14  stage: test.py
  15  before_script:
  16    # Clone uboot-test-hooks
  17    - git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks
  18    - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
  19    - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
  20    - grub-mkimage --prefix="" -o ~/grub_x86.efi -O i386-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  21    - grub-mkimage --prefix="" -o ~/grub_x64.efi -O x86_64-efi normal  echo lsefimmap lsefi lsefisystab efinet tftp minicmd
  22    - if [[ "${TEST_PY_BD}" == "qemu-riscv32_spl" ]]; then
  23        wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
  24        export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin;
  25      fi
  26    - if [[ "${TEST_PY_BD}" == "qemu-riscv64_spl" ]]; then
  27        wget -O - https://github.com/riscv/opensbi/releases/download/v0.9/opensbi-0.9-rv-bin.tar.xz | tar -C /tmp -xJ;
  28        export OPENSBI=/tmp/opensbi-0.9-rv-bin/share/opensbi/lp64/generic/firmware/fw_dynamic.bin;
  29      fi
  30
  31  after_script:
  32    - rm -rf /tmp/uboot-test-hooks /tmp/venv
  33  script:
  34    # If we've been asked to use clang only do one configuration.
  35    - export UBOOT_TRAVIS_BUILD_DIR=/tmp/${TEST_PY_BD}
  36    - tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e
  37        --board ${TEST_PY_BD} ${OVERRIDE}
  38    - cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/
  39    - cp ~/grub_x64.efi $UBOOT_TRAVIS_BUILD_DIR/
  40    - cp /opt/grub/grubriscv64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_riscv64.efi
  41    - cp /opt/grub/grubaa64.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm64.efi
  42    - cp /opt/grub/grubarm.efi $UBOOT_TRAVIS_BUILD_DIR/grub_arm.efi
  43    - virtualenv -p /usr/bin/python3 /tmp/venv
  44    - . /tmp/venv/bin/activate
  45    - pip install -r test/py/requirements.txt
  46    # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
  47    - export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
  48      export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
  49      ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID}
  50        ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"}
  51        --build-dir "$UBOOT_TRAVIS_BUILD_DIR"
  52
  53build all 32bit ARM platforms:
  54  stage: world build
  55  script:
  56    - ret=0;
  57      ./tools/buildman/buildman -o /tmp -P -E -W arm -x aarch64 || ret=$?;
  58      if [[ $ret -ne 0 ]]; then
  59        ./tools/buildman/buildman -o /tmp -seP;
  60        exit $ret;
  61      fi;
  62
  63build all 64bit ARM platforms:
  64  stage: world build
  65  script:
  66    - virtualenv -p /usr/bin/python3 /tmp/venv
  67    - . /tmp/venv/bin/activate
  68    - pip install pyelftools
  69    - ret=0;
  70      ./tools/buildman/buildman -o /tmp -P -E -W aarch64 || ret=$?;
  71      if [[ $ret -ne 0 ]]; then
  72        ./tools/buildman/buildman -o /tmp -seP;
  73        exit $ret;
  74      fi;
  75
  76build all PowerPC platforms:
  77  stage: world build
  78  script:
  79    - ret=0;
  80      ./tools/buildman/buildman -o /tmp -P -E -W powerpc || ret=$?;
  81      if [[ $ret -ne 0 ]]; then
  82        ./tools/buildman/buildman -o /tmp -seP;
  83        exit $ret;
  84      fi;
  85
  86build all other platforms:
  87  stage: world build
  88  script:
  89    - ret=0;
  90      ./tools/buildman/buildman -o /tmp -P -E -W -x arm,powerpc || ret=$?;
  91      if [[ $ret -ne 0 ]]; then
  92        ./tools/buildman/buildman -o /tmp -seP;
  93        exit $ret;
  94      fi;
  95
  96# QA jobs for code analytics
  97# static code analysis with cppcheck (we can add --enable=all later)
  98cppcheck:
  99  stage: testsuites
 100  script:
 101    - cppcheck -j$(nproc) --force --quiet --inline-suppr .
 102
 103# search for TODO within source tree
 104grep TODO/FIXME/HACK:
 105  stage: testsuites
 106  script:
 107    - grep -r TODO .
 108    - grep -r FIXME .
 109    # search for HACK within source tree and ignore HACKKIT board
 110    - grep -r HACK . | grep -v HACKKIT
 111
 112# build HTML documentation
 113htmldocs:
 114  stage: testsuites
 115  script:
 116    - virtualenv -p /usr/bin/python3 /tmp/venvhtml
 117    - . /tmp/venvhtml/bin/activate
 118    - pip install -r doc/sphinx/requirements.txt
 119    - make htmldocs
 120
 121# some statistics about the code base
 122sloccount:
 123  stage: testsuites
 124  script:
 125    - sloccount .
 126
 127# ensure all configs have MAINTAINERS entries
 128Check for configs without MAINTAINERS entry:
 129  stage: testsuites
 130  script:
 131    - if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; fi
 132
 133# Ensure host tools build
 134Build tools-only:
 135  stage: testsuites
 136  script:
 137    - make tools-only_config tools-only -j$(nproc)
 138
 139# Ensure env tools build
 140Build envtools:
 141  stage: testsuites
 142  script:
 143    - make tools-only_config envtools -j$(nproc)
 144
 145Run binman, buildman, dtoc, Kconfig and patman testsuites:
 146  stage: testsuites
 147  script:
 148    - git config --global user.name "GitLab CI Runner";
 149      git config --global user.email trini@konsulko.com;
 150      export USER=gitlab;
 151      virtualenv -p /usr/bin/python3 /tmp/venv;
 152      . /tmp/venv/bin/activate;
 153      pip install -r test/py/requirements.txt;
 154      export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl;
 155      export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
 156      export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
 157      ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w
 158        --board sandbox_spl;
 159      ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
 160      ./tools/buildman/buildman -t;
 161      ./tools/dtoc/dtoc -t;
 162      ./tools/patman/patman test;
 163      make testconfig
 164
 165Run tests for Nokia RX-51 (aka N900):
 166  stage: testsuites
 167  script:
 168    - ./tools/buildman/buildman --fetch-arch arm;
 169      export PATH=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/:$PATH;
 170      test/nokia_rx51_test.sh
 171
 172# Test sandbox with test.py
 173sandbox test.py:
 174  variables:
 175    TEST_PY_BD: "sandbox"
 176  <<: *buildman_and_testpy_dfn
 177
 178sandbox with clang test.py:
 179  variables:
 180    TEST_PY_BD: "sandbox"
 181    OVERRIDE: "-O clang-12"
 182  <<: *buildman_and_testpy_dfn
 183
 184sandbox_spl test.py:
 185  variables:
 186    TEST_PY_BD: "sandbox_spl"
 187    TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
 188  <<: *buildman_and_testpy_dfn
 189
 190sandbox_noinst_test.py:
 191  variables:
 192    TEST_PY_BD: "sandbox_noinst"
 193    TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl"
 194  <<: *buildman_and_testpy_dfn
 195
 196evb-ast2500 test.py:
 197  variables:
 198    TEST_PY_BD: "evb-ast2500"
 199    TEST_PY_ID: "--id qemu"
 200  <<: *buildman_and_testpy_dfn
 201
 202sandbox_flattree test.py:
 203  variables:
 204    TEST_PY_BD: "sandbox_flattree"
 205  <<: *buildman_and_testpy_dfn
 206
 207integratorcp_cm926ejs test.py:
 208  variables:
 209    TEST_PY_BD: "integratorcp_cm926ejs"
 210    TEST_PY_TEST_SPEC: "not sleep"
 211    TEST_PY_ID: "--id qemu"
 212  <<: *buildman_and_testpy_dfn
 213
 214qemu_arm test.py:
 215  variables:
 216    TEST_PY_BD: "qemu_arm"
 217    TEST_PY_TEST_SPEC: "not sleep"
 218  <<: *buildman_and_testpy_dfn
 219
 220qemu_arm64 test.py:
 221  variables:
 222    TEST_PY_BD: "qemu_arm64"
 223    TEST_PY_TEST_SPEC: "not sleep"
 224  <<: *buildman_and_testpy_dfn
 225
 226qemu_malta test.py:
 227  variables:
 228    TEST_PY_BD: "malta"
 229    TEST_PY_TEST_SPEC: "not sleep and not efi"
 230    TEST_PY_ID: "--id qemu"
 231  <<: *buildman_and_testpy_dfn
 232
 233qemu_maltael test.py:
 234  variables:
 235    TEST_PY_BD: "maltael"
 236    TEST_PY_TEST_SPEC: "not sleep and not efi"
 237    TEST_PY_ID: "--id qemu"
 238  <<: *buildman_and_testpy_dfn
 239
 240qemu_malta64 test.py:
 241  variables:
 242    TEST_PY_BD: "malta64"
 243    TEST_PY_TEST_SPEC: "not sleep and not efi"
 244    TEST_PY_ID: "--id qemu"
 245  <<: *buildman_and_testpy_dfn
 246
 247qemu_malta64el test.py:
 248  variables:
 249    TEST_PY_BD: "malta64el"
 250    TEST_PY_TEST_SPEC: "not sleep and not efi"
 251    TEST_PY_ID: "--id qemu"
 252  <<: *buildman_and_testpy_dfn
 253
 254qemu-ppce500 test.py:
 255  variables:
 256    TEST_PY_BD: "qemu-ppce500"
 257    TEST_PY_TEST_SPEC: "not sleep"
 258  <<: *buildman_and_testpy_dfn
 259
 260qemu-riscv32 test.py:
 261  variables:
 262    TEST_PY_BD: "qemu-riscv32"
 263    TEST_PY_TEST_SPEC: "not sleep"
 264  <<: *buildman_and_testpy_dfn
 265
 266qemu-riscv64 test.py:
 267  variables:
 268    TEST_PY_BD: "qemu-riscv64"
 269    TEST_PY_TEST_SPEC: "not sleep"
 270  <<: *buildman_and_testpy_dfn
 271
 272qemu-riscv32_spl test.py:
 273  variables:
 274    TEST_PY_BD: "qemu-riscv32_spl"
 275    TEST_PY_TEST_SPEC: "not sleep"
 276  <<: *buildman_and_testpy_dfn
 277
 278qemu-riscv64_spl test.py:
 279  variables:
 280    TEST_PY_BD: "qemu-riscv64_spl"
 281    TEST_PY_TEST_SPEC: "not sleep"
 282  <<: *buildman_and_testpy_dfn
 283
 284qemu-x86 test.py:
 285  variables:
 286    TEST_PY_BD: "qemu-x86"
 287    TEST_PY_TEST_SPEC: "not sleep"
 288  <<: *buildman_and_testpy_dfn
 289
 290qemu-x86_64 test.py:
 291  variables:
 292    TEST_PY_BD: "qemu-x86_64"
 293    TEST_PY_TEST_SPEC: "not sleep"
 294  <<: *buildman_and_testpy_dfn
 295
 296r2dplus_i82557c test.py:
 297  variables:
 298    TEST_PY_BD: "r2dplus"
 299    TEST_PY_ID: "--id i82557c_qemu"
 300  <<: *buildman_and_testpy_dfn
 301
 302r2dplus_pcnet test.py:
 303  variables:
 304    TEST_PY_BD: "r2dplus"
 305    TEST_PY_ID: "--id pcnet_qemu"
 306  <<: *buildman_and_testpy_dfn
 307
 308r2dplus_rtl8139 test.py:
 309  variables:
 310    TEST_PY_BD: "r2dplus"
 311    TEST_PY_ID: "--id rtl8139_qemu"
 312  <<: *buildman_and_testpy_dfn
 313
 314r2dplus_tulip test.py:
 315  variables:
 316    TEST_PY_BD: "r2dplus"
 317    TEST_PY_ID: "--id tulip_qemu"
 318  <<: *buildman_and_testpy_dfn
 319
 320xilinx_zynq_virt test.py:
 321  variables:
 322    TEST_PY_BD: "xilinx_zynq_virt"
 323    TEST_PY_TEST_SPEC: "not sleep"
 324    TEST_PY_ID: "--id qemu"
 325  <<: *buildman_and_testpy_dfn
 326
 327xilinx_versal_virt test.py:
 328  variables:
 329    TEST_PY_BD: "xilinx_versal_virt"
 330    TEST_PY_TEST_SPEC: "not sleep"
 331    TEST_PY_ID: "--id qemu"
 332  <<: *buildman_and_testpy_dfn
 333
 334xtfpga test.py:
 335  variables:
 336    TEST_PY_BD: "xtfpga"
 337    TEST_PY_TEST_SPEC: "not sleep"
 338    TEST_PY_ID: "--id qemu"
 339  <<: *buildman_and_testpy_dfn
 340