<commit_before>on:
  push:
  pull_request:

env:
  MAKEOPTS: "-j4"
  XTENSA_CROSS_ROOT: "~/persist/toolchain-xtensa"
  XTENSA_CROSS_BINDIR: "~/persist/toolchain-xtensa/bin"

jobs:

  code-formatting:
    runs-on: ubuntu-18.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # before_install
    - run: |
        sudo apt-add-repository --yes --update ppa:pybricks/ppa
    # install
    - run: |
        sudo apt-get install uncrustify python3-pip
        uncrustify --version
        pip3 install --user setuptools
        pip3 install --user black
        black --version
    # script
    - run: |
        tools/codeformat.py
        git diff --exit-code

  esp8266-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # before_install
    - run: |
        sudo apt-get install bison flex gperf help2man libexpat-dev libtool libtool-bin python-serial texinfo
        echo "HAS_XTENSA="test -d ${XTENSA_CROSS_BINDIR}"" >> $GITHUB_ENV
    # install
    - run: |
        set -x
        XTENSA_CROSS_ROOT=$(eval echo ${XTENSA_CROSS_ROOT})
        echo ${XTENSA_CROSS_ROOT}
        unset CC
        ${HAS_XTENSA} || git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
        ${HAS_XTENSA} || echo "CT_LOG_PROGRESS_BAR=n" >> esp-open-sdk/crosstool-config-overrides
        ${HAS_XTENSA} || make -C esp-open-sdk TOOLCHAIN=${XTENSA_CROSS_ROOT}
    # script
    - run: |
        XTENSA_CROSS_BINDIR=$(eval echo ${XTENSA_CROSS_BINDIR})
        make ${MAKEOPTS} -C mpy-cross
        make -C ports/esp8266 submodules
        PATH=${XTENSA_CROSS_BINDIR}:${PATH} make -C ports/esp8266

  zephyr-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # before_install
    - run: |
        docker pull zephyrprojectrtos/ci:v0.11.8
        docker run --name zephyr-ci -d -it -v "$(pwd)":/micropython -e ZEPHYR_SDK_INSTALL_DIR=/opt/sdk/zephyr-sdk-0.11.3 -e ZEPHYR_TOOLCHAIN_VARIANT=zephyr -w /micropython/ports/zephyr zephyrprojectrtos/ci:v0.11.8

        docker ps -a
    # install
    - run: |
        docker exec zephyr-ci west init --mr v2.4.0 /zephyrproject
        docker exec -w /zephyrproject zephyr-ci west update
        docker exec -w /zephyrproject zephyr-ci west zephyr-export
    # script
    - run: |
        docker exec zephyr-ci bash -c "make clean; ./make-minimal ${MAKEOPTS}"
        docker exec zephyr-ci bash -c "make clean; ./make-minimal ${MAKEOPTS} BOARD=frdm_k64f"
        docker exec zephyr-ci bash -c "make clean; make ${MAKEOPTS}"
        docker exec zephyr-ci bash -c "make clean; make ${MAKEOPTS} BOARD=frdm_k64f"
        docker exec zephyr-ci bash -c "make clean; make ${MAKEOPTS} BOARD=mimxrt1050_evk"
        docker exec zephyr-ci bash -c "make clean; make ${MAKEOPTS} BOARD=reel_board"

  unix-port-build-with-clang-on-OSX:
    runs-on: macos-10.15
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        brew install pkgconfig || true
        brew install autoconf automake libtool
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix deplibs
        make ${MAKEOPTS} -C ports/unix
        (cd tests && ./run-tests --exclude 'uasyncio_(basic|heaplock|lock|wait_task)')
        make ${MAKEOPTS} -C ports/unix VARIANT=coverage
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  stm32-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
        sudo apt-get update -qq || true
        sudo apt-get install gcc-arm-embedded
        arm-none-eabi-gcc --version
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/stm32 submodules
        git submodule update --init lib/btstack
        make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_F091RC
        make ${MAKEOPTS} -C ports/stm32 BOARD=PYBV11 MICROPY_PY_WIZNET5K=5200 MICROPY_PY_CC3K=1
        make ${MAKEOPTS} -C ports/stm32 BOARD=PYBD_SF2
        make ${MAKEOPTS} -C ports/stm32 BOARD=PYBD_SF6 NANBOX=1 MICROPY_BLUETOOTH_NIMBLE=0 MICROPY_BLUETOOTH_BTSTACK=1
        make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_H743ZI CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1'
        make ${MAKEOPTS} -C ports/stm32 BOARD=STM32L476DISC
        make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_WB55
        make ${MAKEOPTS} -C ports/stm32/mboot BOARD=PYBV10 CFLAGS_EXTRA='-DMBOOT_FSLOAD=1 -DMBOOT_VFS_LFS2=1'
        make ${MAKEOPTS} -C ports/stm32/mboot BOARD=PYBD_SF6
        make ${MAKEOPTS} -C ports/stm32/mboot BOARD=NUCLEO_WB55

  qemu-arm-port-build-and-tests:
    runs-on: ubuntu-18.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install gcc-arm-none-eabi libnewlib-arm-none-eabi qemu-system
        arm-none-eabi-gcc --version
        qemu-system-arm --version
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/qemu-arm CFLAGS_EXTRA=-DMP_ENDIANNESS_BIG=1
        make ${MAKEOPTS} -C ports/qemu-arm clean
        make ${MAKEOPTS} -C ports/qemu-arm -f Makefile.test test
    - if: ${{ failure() }}
      run: |
        grep --text "FAIL" ports/qemu-arm/build/console.out

  unix-coverage-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
        sudo apt-get update -qq || true
        sudo apt-get install -y gcc-7
        sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 80
        sudo update-alternatives --config gcc
        sudo apt-get install python3-pip
        sudo pip install cpp-coveralls
        sudo pip3 install setuptools
        sudo pip3 install pyelftools
        gcc --version
        python3 --version
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix deplibs
        make ${MAKEOPTS} -C ports/unix coverage
        (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/pycopy-coverage ./run-multitests.py multi_net/*.py) || travis_terminate 1
        make -C ports/unix VARIANT=coverage test_full
        make -C examples/natmod/features1 ARCH=x64
        make -C examples/natmod/features2 ARCH=x64
        make -C examples/natmod/btree ARCH=x64
        make -C examples/natmod/framebuf ARCH=x64
        make -C examples/natmod/uheapq ARCH=x64
        make -C examples/natmod/ure ARCH=x64
        make -C examples/natmod/uzlib ARCH=x64
        PYCOPYPATH=examples/natmod/features2 ./ports/unix/pycopy-coverage -m features2
        (cd tests && ./run-natmodtests.py extmod/{btree*,framebuf*,uheapq*,ure*,uzlib*}.py)
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  unix-coverage-32-bit-build-and-tests:
    runs-on: ubuntu-18.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    - run: |
        sudo dpkg --add-architecture i386
        sudo apt-get update -y -qq
    # install
    - run: |
        sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
        sudo apt-get update -qq || true
        sudo apt-get install -y gcc-7
        sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 80
        sudo update-alternatives --config gcc
        sudo apt-get install gcc-multilib gcc-7-multilib libffi-dev:i386
        sudo apt-get install python3-pip
        sudo pip3 install setuptools
        sudo pip3 install pyelftools
        gcc --version
        python3 --version
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix MICROPY_FORCE_32BIT=1 submodules
        make ${MAKEOPTS} -C ports/unix MICROPY_FORCE_32BIT=1 deplibs
        make ${MAKEOPTS} -C ports/unix MICROPY_FORCE_32BIT=1 coverage
        make -C ports/unix MICROPY_FORCE_32BIT=1 VARIANT=coverage test_full || travis_terminate 1
        make -C examples/natmod/features1 ARCH=x86
        make -C examples/natmod/features2 ARCH=x86
        make -C examples/natmod/btree ARCH=x86
        make -C examples/natmod/framebuf ARCH=x86
        make -C examples/natmod/uheapq ARCH=x86
        make -C examples/natmod/urandom ARCH=x86
        make -C examples/natmod/ure ARCH=x86
        make -C examples/natmod/uzlib ARCH=x86
        PYCOPYPATH=examples/natmod/features2 ./ports/unix/pycopy-coverage  -m features2
        (cd tests && ./run-natmodtests.py --arch x86 extmod/{btree*,framebuf*,uheapq*,ure*,uzlib*}.py)
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  unix-port-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix deplibs
        make ${MAKEOPTS} -C ports/unix
        make ${MAKEOPTS} -C ports/unix test
        (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/pycopy ./run-perfbench.py 1000 1000)
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  unix-port-with-mbedTLS-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix MICROPY_SSL_MBEDTLS=1 MICROPY_SSL_AXTLS=0
        make ${MAKEOPTS} -C ports/unix MICROPY_SSL_MBEDTLS=1 MICROPY_SSL_AXTLS=0 test RUN_TESTS_EXTRA="-e ussl_basic"

  unix-port-micropython-dev:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix dev
        make ${MAKEOPTS} -C ports/unix dev_test

  unix-nanbox-float-port-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    - run: |
        sudo dpkg --add-architecture i386
        sudo apt-get update -y -qq
    # install
    - run: |
        sudo apt-get install gcc-multilib libffi-dev:i386
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix deplibs
        make ${MAKEOPTS} -C ports/unix nanbox
        make ${MAKEOPTS} -C ports/unix VARIANT=nanbox test_full || travis_terminate 1
        make ${MAKEOPTS} -C ports/unix clean
        make ${MAKEOPTS} -C ports/unix CFLAGS_EXTRA="-DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT"
        make ${MAKEOPTS} -C ports/unix test
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  unix-stackless-port-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix deplibs
        make ${MAKEOPTS} -C ports/unix CFLAGS_EXTRA="-DMICROPY_STACKLESS=1 -DMICROPY_STACKLESS_STRICT=1"
        make ${MAKEOPTS} -C ports/unix test

  unix-port-with-clang:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} CC=clang -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} CC=clang -C ports/unix
        make ${MAKEOPTS} CC=clang -C ports/unix test || travis_terminate 1
        make ${MAKEOPTS} -C ports/unix clean
        make ${MAKEOPTS} -C ports/unix CC=clang CFLAGS_EXTRA="-DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT"
        make ${MAKEOPTS} -C ports/unix CC=clang test
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  unix-port-with-sys-settrace-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix MICROPY_PY_BTREE=0 MICROPY_PY_FFI=0 MICROPY_PY_USSL=0 CFLAGS_EXTRA="-DMICROPY_PY_SYS_SETTRACE=1" test || travis_terminate 1
        make ${MAKEOPTS} -C ports/unix clean
        make ${MAKEOPTS} -C ports/unix MICROPY_PY_BTREE=0 MICROPY_PY_FFI=0 MICROPY_PY_USSL=0 CFLAGS_EXTRA="-DMICROPY_STACKLESS=1 -DMICROPY_STACKLESS_STRICT=1 -DMICROPY_PY_SYS_SETTRACE=1" test
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  minimal-unix-port-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} -C ports/unix minimal
        (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/pycopy-minimal ./run-tests -e exception_chain -e self_type_check -e subclass_native_init -e class_slots_ -d basics)
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  windows-port-build-via-mingw:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install gcc-mingw-w64
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/windows CROSS_COMPILE=i686-w64-mingw32-

  esp32-ESP-IDFv3-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install python3-pip python-serial
        sudo pip3 install 'pyparsing<2.4'
        curl -L https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz | tar zxf -
        echo "PATH=$(pwd)/xtensa-esp32-elf/bin:$PATH" >> $GITHUB_ENV
        git clone https://github.com/espressif/esp-idf.git
        echo "IDF_PATH=$(pwd)/esp-idf" >> $GITHUB_ENV
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        git -C esp-idf checkout $(grep "ESPIDF_SUPHASH_V3 :=" ports/esp32/Makefile | cut -d " " -f 3)
        git -C esp-idf submodule update --init components/json/cJSON components/esp32/lib components/esptool_py/esptool components/expat/expat components/lwip/lwip components/micro-ecc/micro-ecc components/nghttp/nghttp2 components/nimble components/bt
        (cd esp-idf/components/mbedtls/; rm -rf mbedtls; git clone -b mbedtls-2.16.5-idf-pycopy https://github.com/pfalcon/mbedtls/)
        (cd esp-idf/components/mbedtls/mbedtls; git log -n1)
        make ${MAKEOPTS} -C ports/esp32 submodules
        make ${MAKEOPTS} -C ports/esp32

  esp32-ESP-IDFv4-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install python3-pip python-serial
        sudo pip3 install 'pyparsing<2.4'
        curl -L https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp-2019r2-linux-amd64.tar.gz | tar zxf -
        echo "PATH=$(pwd)/xtensa-esp32-elf/bin:$PATH" >> $GITHUB_ENV
        git clone https://github.com/espressif/esp-idf.git
        echo "IDF_PATH=$(pwd)/esp-idf" >> $GITHUB_ENV
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        git -C esp-idf checkout $(grep "ESPIDF_SUPHASH_V4 :=" ports/esp32/Makefile | cut -d " " -f 3)
        git -C esp-idf submodule update --init components/bt/controller/lib components/bt/host/nimble/nimble components/esp_wifi/lib_esp32 components/esptool_py/esptool components/lwip/lwip
        (cd esp-idf/components/mbedtls/; rm -rf mbedtls; git clone -b mbedtls-2.16.5-idf-pycopy https://github.com/pfalcon/mbedtls/)
        (cd esp-idf/components/mbedtls/mbedtls; git log -n1)
        make ${MAKEOPTS} -C ports/esp32 submodules
        make ${MAKEOPTS} -C ports/esp32

  nrf-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
        sudo apt-get update -qq || true
        sudo apt-get install gcc-arm-embedded
        arm-none-eabi-gcc --version
    # script
    - run: |
        ports/nrf/drivers/bluetooth/download_ble_stack.sh s140_nrf52_6_1_1
        make ${MAKEOPTS} -C ports/nrf submodules
        make ${MAKEOPTS} -C ports/nrf BOARD=pca10040
        make ${MAKEOPTS} -C ports/nrf BOARD=microbit
        make ${MAKEOPTS} -C ports/nrf BOARD=pca10056 SD=s140
        make ${MAKEOPTS} -C ports/nrf BOARD=pca10090

  bare-arm-and-minimal-ports-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    - run: |
        sudo dpkg --add-architecture i386
        sudo apt-get update -y -qq
    # install
    - run: |
        sudo apt-get install gcc-multilib libffi-dev:i386 gcc-arm-none-eabi libnewlib-arm-none-eabi
        gcc --version
        arm-none-eabi-gcc --version
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/bare-arm
        make ${MAKEOPTS} -C ports/minimal CROSS=1 build/firmware.bin
        ls -l ports/minimal/build/firmware.bin
        tools/check_code_size.sh
        mkdir -p ${HOME}/persist
        if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp ports/minimal/build/firmware.bin ${HOME}/persist/; fi

  cc3200-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install gcc-arm-none-eabi libnewlib-arm-none-eabi
    # script
    - run: |
        make ${MAKEOPTS} -C ports/cc3200 BTARGET=application BTYPE=release
        make ${MAKEOPTS} -C ports/cc3200 BTARGET=bootloader  BTYPE=release

  samd-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install gcc-arm-none-eabi libnewlib-arm-none-eabi
    # script
    - run: |
        make ${MAKEOPTS} -C ports/samd submodules
        make ${MAKEOPTS} -C ports/samd

  teensy-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install gcc-arm-none-eabi libnewlib-arm-none-eabi
    # script
    - run: |
        make ${MAKEOPTS} -C ports/teensy

  powerpc-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/powerpc UART=potato
        make ${MAKEOPTS} -C ports/powerpc UART=lpc_serial
<commit_msg>.github/workflows/travis-ci.yml: macosx: Use CPython3.8.<commit_after>on:
  push:
  pull_request:

env:
  MAKEOPTS: "-j4"
  XTENSA_CROSS_ROOT: "~/persist/toolchain-xtensa"
  XTENSA_CROSS_BINDIR: "~/persist/toolchain-xtensa/bin"

jobs:

  code-formatting:
    runs-on: ubuntu-18.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # before_install
    - run: |
        sudo apt-add-repository --yes --update ppa:pybricks/ppa
    # install
    - run: |
        sudo apt-get install uncrustify python3-pip
        uncrustify --version
        pip3 install --user setuptools
        pip3 install --user black
        black --version
    # script
    - run: |
        tools/codeformat.py
        git diff --exit-code

  esp8266-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # before_install
    - run: |
        sudo apt-get install bison flex gperf help2man libexpat-dev libtool libtool-bin python-serial texinfo
        echo "HAS_XTENSA="test -d ${XTENSA_CROSS_BINDIR}"" >> $GITHUB_ENV
    # install
    - run: |
        set -x
        XTENSA_CROSS_ROOT=$(eval echo ${XTENSA_CROSS_ROOT})
        echo ${XTENSA_CROSS_ROOT}
        unset CC
        ${HAS_XTENSA} || git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
        ${HAS_XTENSA} || echo "CT_LOG_PROGRESS_BAR=n" >> esp-open-sdk/crosstool-config-overrides
        ${HAS_XTENSA} || make -C esp-open-sdk TOOLCHAIN=${XTENSA_CROSS_ROOT}
    # script
    - run: |
        XTENSA_CROSS_BINDIR=$(eval echo ${XTENSA_CROSS_BINDIR})
        make ${MAKEOPTS} -C mpy-cross
        make -C ports/esp8266 submodules
        PATH=${XTENSA_CROSS_BINDIR}:${PATH} make -C ports/esp8266

  zephyr-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # before_install
    - run: |
        docker pull zephyrprojectrtos/ci:v0.11.8
        docker run --name zephyr-ci -d -it -v "$(pwd)":/micropython -e ZEPHYR_SDK_INSTALL_DIR=/opt/sdk/zephyr-sdk-0.11.3 -e ZEPHYR_TOOLCHAIN_VARIANT=zephyr -w /micropython/ports/zephyr zephyrprojectrtos/ci:v0.11.8

        docker ps -a
    # install
    - run: |
        docker exec zephyr-ci west init --mr v2.4.0 /zephyrproject
        docker exec -w /zephyrproject zephyr-ci west update
        docker exec -w /zephyrproject zephyr-ci west zephyr-export
    # script
    - run: |
        docker exec zephyr-ci bash -c "make clean; ./make-minimal ${MAKEOPTS}"
        docker exec zephyr-ci bash -c "make clean; ./make-minimal ${MAKEOPTS} BOARD=frdm_k64f"
        docker exec zephyr-ci bash -c "make clean; make ${MAKEOPTS}"
        docker exec zephyr-ci bash -c "make clean; make ${MAKEOPTS} BOARD=frdm_k64f"
        docker exec zephyr-ci bash -c "make clean; make ${MAKEOPTS} BOARD=mimxrt1050_evk"
        docker exec zephyr-ci bash -c "make clean; make ${MAKEOPTS} BOARD=reel_board"

  unix-port-build-with-clang-on-OSX:
    runs-on: macos-10.15
    steps:
    - name: Use CPython3.8
      uses: actions/setup-python@v2
      with:
        python-version: "3.8"
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        brew install pkgconfig || true
        brew install autoconf automake libtool
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix deplibs
        make ${MAKEOPTS} -C ports/unix
        (cd tests && ./run-tests --exclude 'uasyncio_(basic|heaplock|lock|wait_task)')
        make ${MAKEOPTS} -C ports/unix VARIANT=coverage
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  stm32-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
        sudo apt-get update -qq || true
        sudo apt-get install gcc-arm-embedded
        arm-none-eabi-gcc --version
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/stm32 submodules
        git submodule update --init lib/btstack
        make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_F091RC
        make ${MAKEOPTS} -C ports/stm32 BOARD=PYBV11 MICROPY_PY_WIZNET5K=5200 MICROPY_PY_CC3K=1
        make ${MAKEOPTS} -C ports/stm32 BOARD=PYBD_SF2
        make ${MAKEOPTS} -C ports/stm32 BOARD=PYBD_SF6 NANBOX=1 MICROPY_BLUETOOTH_NIMBLE=0 MICROPY_BLUETOOTH_BTSTACK=1
        make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_H743ZI CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1'
        make ${MAKEOPTS} -C ports/stm32 BOARD=STM32L476DISC
        make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_WB55
        make ${MAKEOPTS} -C ports/stm32/mboot BOARD=PYBV10 CFLAGS_EXTRA='-DMBOOT_FSLOAD=1 -DMBOOT_VFS_LFS2=1'
        make ${MAKEOPTS} -C ports/stm32/mboot BOARD=PYBD_SF6
        make ${MAKEOPTS} -C ports/stm32/mboot BOARD=NUCLEO_WB55

  qemu-arm-port-build-and-tests:
    runs-on: ubuntu-18.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install gcc-arm-none-eabi libnewlib-arm-none-eabi qemu-system
        arm-none-eabi-gcc --version
        qemu-system-arm --version
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/qemu-arm CFLAGS_EXTRA=-DMP_ENDIANNESS_BIG=1
        make ${MAKEOPTS} -C ports/qemu-arm clean
        make ${MAKEOPTS} -C ports/qemu-arm -f Makefile.test test
    - if: ${{ failure() }}
      run: |
        grep --text "FAIL" ports/qemu-arm/build/console.out

  unix-coverage-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
        sudo apt-get update -qq || true
        sudo apt-get install -y gcc-7
        sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 80
        sudo update-alternatives --config gcc
        sudo apt-get install python3-pip
        sudo pip install cpp-coveralls
        sudo pip3 install setuptools
        sudo pip3 install pyelftools
        gcc --version
        python3 --version
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix deplibs
        make ${MAKEOPTS} -C ports/unix coverage
        (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/pycopy-coverage ./run-multitests.py multi_net/*.py) || travis_terminate 1
        make -C ports/unix VARIANT=coverage test_full
        make -C examples/natmod/features1 ARCH=x64
        make -C examples/natmod/features2 ARCH=x64
        make -C examples/natmod/btree ARCH=x64
        make -C examples/natmod/framebuf ARCH=x64
        make -C examples/natmod/uheapq ARCH=x64
        make -C examples/natmod/ure ARCH=x64
        make -C examples/natmod/uzlib ARCH=x64
        PYCOPYPATH=examples/natmod/features2 ./ports/unix/pycopy-coverage -m features2
        (cd tests && ./run-natmodtests.py extmod/{btree*,framebuf*,uheapq*,ure*,uzlib*}.py)
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  unix-coverage-32-bit-build-and-tests:
    runs-on: ubuntu-18.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    - run: |
        sudo dpkg --add-architecture i386
        sudo apt-get update -y -qq
    # install
    - run: |
        sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
        sudo apt-get update -qq || true
        sudo apt-get install -y gcc-7
        sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 80
        sudo update-alternatives --config gcc
        sudo apt-get install gcc-multilib gcc-7-multilib libffi-dev:i386
        sudo apt-get install python3-pip
        sudo pip3 install setuptools
        sudo pip3 install pyelftools
        gcc --version
        python3 --version
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix MICROPY_FORCE_32BIT=1 submodules
        make ${MAKEOPTS} -C ports/unix MICROPY_FORCE_32BIT=1 deplibs
        make ${MAKEOPTS} -C ports/unix MICROPY_FORCE_32BIT=1 coverage
        make -C ports/unix MICROPY_FORCE_32BIT=1 VARIANT=coverage test_full || travis_terminate 1
        make -C examples/natmod/features1 ARCH=x86
        make -C examples/natmod/features2 ARCH=x86
        make -C examples/natmod/btree ARCH=x86
        make -C examples/natmod/framebuf ARCH=x86
        make -C examples/natmod/uheapq ARCH=x86
        make -C examples/natmod/urandom ARCH=x86
        make -C examples/natmod/ure ARCH=x86
        make -C examples/natmod/uzlib ARCH=x86
        PYCOPYPATH=examples/natmod/features2 ./ports/unix/pycopy-coverage  -m features2
        (cd tests && ./run-natmodtests.py --arch x86 extmod/{btree*,framebuf*,uheapq*,ure*,uzlib*}.py)
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  unix-port-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix deplibs
        make ${MAKEOPTS} -C ports/unix
        make ${MAKEOPTS} -C ports/unix test
        (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/pycopy ./run-perfbench.py 1000 1000)
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  unix-port-with-mbedTLS-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix MICROPY_SSL_MBEDTLS=1 MICROPY_SSL_AXTLS=0
        make ${MAKEOPTS} -C ports/unix MICROPY_SSL_MBEDTLS=1 MICROPY_SSL_AXTLS=0 test RUN_TESTS_EXTRA="-e ussl_basic"

  unix-port-micropython-dev:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix dev
        make ${MAKEOPTS} -C ports/unix dev_test

  unix-nanbox-float-port-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    - run: |
        sudo dpkg --add-architecture i386
        sudo apt-get update -y -qq
    # install
    - run: |
        sudo apt-get install gcc-multilib libffi-dev:i386
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix deplibs
        make ${MAKEOPTS} -C ports/unix nanbox
        make ${MAKEOPTS} -C ports/unix VARIANT=nanbox test_full || travis_terminate 1
        make ${MAKEOPTS} -C ports/unix clean
        make ${MAKEOPTS} -C ports/unix CFLAGS_EXTRA="-DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT"
        make ${MAKEOPTS} -C ports/unix test
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  unix-stackless-port-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} -C ports/unix deplibs
        make ${MAKEOPTS} -C ports/unix CFLAGS_EXTRA="-DMICROPY_STACKLESS=1 -DMICROPY_STACKLESS_STRICT=1"
        make ${MAKEOPTS} -C ports/unix test

  unix-port-with-clang:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} CC=clang -C mpy-cross
        make ${MAKEOPTS} -C ports/unix submodules
        make ${MAKEOPTS} CC=clang -C ports/unix
        make ${MAKEOPTS} CC=clang -C ports/unix test || travis_terminate 1
        make ${MAKEOPTS} -C ports/unix clean
        make ${MAKEOPTS} -C ports/unix CC=clang CFLAGS_EXTRA="-DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT"
        make ${MAKEOPTS} -C ports/unix CC=clang test
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  unix-port-with-sys-settrace-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/unix MICROPY_PY_BTREE=0 MICROPY_PY_FFI=0 MICROPY_PY_USSL=0 CFLAGS_EXTRA="-DMICROPY_PY_SYS_SETTRACE=1" test || travis_terminate 1
        make ${MAKEOPTS} -C ports/unix clean
        make ${MAKEOPTS} -C ports/unix MICROPY_PY_BTREE=0 MICROPY_PY_FFI=0 MICROPY_PY_USSL=0 CFLAGS_EXTRA="-DMICROPY_STACKLESS=1 -DMICROPY_STACKLESS_STRICT=1 -DMICROPY_PY_SYS_SETTRACE=1" test
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  minimal-unix-port-build-and-tests:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # script
    - run: |
        make ${MAKEOPTS} -C ports/unix minimal
        (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/pycopy-minimal ./run-tests -e exception_chain -e self_type_check -e subclass_native_init -e class_slots_ -d basics)
    - if: ${{ failure() }}
      run: |
        tests/run-tests --print-failures

  windows-port-build-via-mingw:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install gcc-mingw-w64
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/windows CROSS_COMPILE=i686-w64-mingw32-

  esp32-ESP-IDFv3-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install python3-pip python-serial
        sudo pip3 install 'pyparsing<2.4'
        curl -L https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz | tar zxf -
        echo "PATH=$(pwd)/xtensa-esp32-elf/bin:$PATH" >> $GITHUB_ENV
        git clone https://github.com/espressif/esp-idf.git
        echo "IDF_PATH=$(pwd)/esp-idf" >> $GITHUB_ENV
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        git -C esp-idf checkout $(grep "ESPIDF_SUPHASH_V3 :=" ports/esp32/Makefile | cut -d " " -f 3)
        git -C esp-idf submodule update --init components/json/cJSON components/esp32/lib components/esptool_py/esptool components/expat/expat components/lwip/lwip components/micro-ecc/micro-ecc components/nghttp/nghttp2 components/nimble components/bt
        (cd esp-idf/components/mbedtls/; rm -rf mbedtls; git clone -b mbedtls-2.16.5-idf-pycopy https://github.com/pfalcon/mbedtls/)
        (cd esp-idf/components/mbedtls/mbedtls; git log -n1)
        make ${MAKEOPTS} -C ports/esp32 submodules
        make ${MAKEOPTS} -C ports/esp32

  esp32-ESP-IDFv4-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install python3-pip python-serial
        sudo pip3 install 'pyparsing<2.4'
        curl -L https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp-2019r2-linux-amd64.tar.gz | tar zxf -
        echo "PATH=$(pwd)/xtensa-esp32-elf/bin:$PATH" >> $GITHUB_ENV
        git clone https://github.com/espressif/esp-idf.git
        echo "IDF_PATH=$(pwd)/esp-idf" >> $GITHUB_ENV
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        git -C esp-idf checkout $(grep "ESPIDF_SUPHASH_V4 :=" ports/esp32/Makefile | cut -d " " -f 3)
        git -C esp-idf submodule update --init components/bt/controller/lib components/bt/host/nimble/nimble components/esp_wifi/lib_esp32 components/esptool_py/esptool components/lwip/lwip
        (cd esp-idf/components/mbedtls/; rm -rf mbedtls; git clone -b mbedtls-2.16.5-idf-pycopy https://github.com/pfalcon/mbedtls/)
        (cd esp-idf/components/mbedtls/mbedtls; git log -n1)
        make ${MAKEOPTS} -C ports/esp32 submodules
        make ${MAKEOPTS} -C ports/esp32

  nrf-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
        sudo apt-get update -qq || true
        sudo apt-get install gcc-arm-embedded
        arm-none-eabi-gcc --version
    # script
    - run: |
        ports/nrf/drivers/bluetooth/download_ble_stack.sh s140_nrf52_6_1_1
        make ${MAKEOPTS} -C ports/nrf submodules
        make ${MAKEOPTS} -C ports/nrf BOARD=pca10040
        make ${MAKEOPTS} -C ports/nrf BOARD=microbit
        make ${MAKEOPTS} -C ports/nrf BOARD=pca10056 SD=s140
        make ${MAKEOPTS} -C ports/nrf BOARD=pca10090

  bare-arm-and-minimal-ports-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    - run: |
        sudo dpkg --add-architecture i386
        sudo apt-get update -y -qq
    # install
    - run: |
        sudo apt-get install gcc-multilib libffi-dev:i386 gcc-arm-none-eabi libnewlib-arm-none-eabi
        gcc --version
        arm-none-eabi-gcc --version
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/bare-arm
        make ${MAKEOPTS} -C ports/minimal CROSS=1 build/firmware.bin
        ls -l ports/minimal/build/firmware.bin
        tools/check_code_size.sh
        mkdir -p ${HOME}/persist
        if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp ports/minimal/build/firmware.bin ${HOME}/persist/; fi

  cc3200-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install gcc-arm-none-eabi libnewlib-arm-none-eabi
    # script
    - run: |
        make ${MAKEOPTS} -C ports/cc3200 BTARGET=application BTYPE=release
        make ${MAKEOPTS} -C ports/cc3200 BTARGET=bootloader  BTYPE=release

  samd-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install gcc-arm-none-eabi libnewlib-arm-none-eabi
    # script
    - run: |
        make ${MAKEOPTS} -C ports/samd submodules
        make ${MAKEOPTS} -C ports/samd

  teensy-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install gcc-arm-none-eabi libnewlib-arm-none-eabi
    # script
    - run: |
        make ${MAKEOPTS} -C ports/teensy

  powerpc-port-build:
    runs-on: ubuntu-16.04
    steps:
    - name: Clone
      uses: actions/checkout@v2
    - name: Add ~/bin:~/.local/bin to PATH
      run: |
        echo ~/bin >> $GITHUB_PATH
        echo ~/.local/bin >> $GITHUB_PATH

    # install
    - run: |
        sudo apt-get install gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross
    # script
    - run: |
        make ${MAKEOPTS} -C mpy-cross
        make ${MAKEOPTS} -C ports/powerpc UART=potato
        make ${MAKEOPTS} -C ports/powerpc UART=lpc_serial

{'fraction_non_alphanumeric': 0.1264800861141012, 'fraction_numerical': 0.021775206315034087, 'mean_word_length': 2.1461126005361932, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 227, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6062547', 'n_tokens_mistral': 17716, 'n_tokens_neox': 16575, 'n_words': 3591}