From b1998cb0b1ed562922f992295dcc1c121273ef07 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 15 Nov 2017 15:05:34 -0800 Subject: [PATCH] Speed up the Travis build. This does two major things: 1. It stores the arm gcc in the repo. The download from the PPA was taking between 2 and 7 minutes. 2. It splits each board into a separate job so they are built in parallel. --- .gitattributes | 1 + .travis.yml | 57 +++++++++++++++++++++--------------- tools/build_adafruit_bins.sh | 10 +++++-- 3 files changed, 43 insertions(+), 25 deletions(-) diff --git a/.gitattributes b/.gitattributes index 133e2625c1..91863791e0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11,6 +11,7 @@ *.jpg binary *.dxf binary *.mpy binary +*.deb binary # These should also not be modified by git. tests/basics/string_cr_conversion.py -text diff --git a/.travis.yml b/.travis.yml index b137a234b1..330ace5f2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,18 @@ dist: trusty language: c compiler: - gcc -cache: - directories: - - "${HOME}/persist" +env: + - TRAVIS_BOARD=arduino_zero + - TRAVIS_BOARD=circuitplayground_express + - TRAVIS_BOARD=feather_m0_basic + - TRAVIS_BOARD=feather_m0_adalogger + - TRAVIS_BOARD=feather_m0_express + - TRAVIS_BOARD=metro_m0_express + - TRAVIS_BOARD=metro_m4_express + - TRAVIS_BOARD=trinket_m0 + - TRAVIS_BOARD=gemma_m0 + - TRAVIS_TEST=qemu + - TRAVIS_TEST=unix addons: artifacts: @@ -30,17 +39,18 @@ notifications: on_error: always before_script: - - sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa - sudo dpkg --add-architecture i386 - - sudo apt-get update -qq || true - - sudo apt-get install -y python3 gcc-multilib pkg-config libffi-dev libffi-dev:i386 qemu-system gcc-mingw-w64 - - sudo apt-get install -y --force-yes gcc-arm-embedded + - sudo apt-get install -y python3 gcc-multilib pkg-config libffi-dev libffi-dev:i386 qemu-system + - ([[ -z "$TRAVIS_TEST" ]] || sudo apt-get install -y qemu-system) + - ([[ -z "$TRAVIS_BOARD" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_6-2017q2-2~trusty1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb)) + - ([[ $TRAVIS_TEST != "qemu" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_6-2017q2-2~trusty1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb)) + # For teensy build - sudo apt-get install realpath # For coverage testing (upgrade is used to get latest urllib3 version) - sudo pip install --upgrade cpp-coveralls - gcc --version - - arm-none-eabi-gcc --version + - ([[ -z "$TRAVIS_BOARD" ]] || arm-none-eabi-gcc --version) - python3 --version script: @@ -48,21 +58,19 @@ script: - echo 'Building mpy-cross' && echo -en 'travis_fold:start:mpy-cross\\r' - make -C mpy-cross - echo -en 'travis_fold:end:mpy-cross\\r' + - echo 'Building Adafruit binaries' && echo -en 'travis_fold:start:adafruit-bins\\r' - - tools/build_adafruit_bins.sh + - ([[ -z "$TRAVIS_BOARD" ]] || tools/build_adafruit_bins.sh) - echo -en 'travis_fold:end:adafruit-bins\\r' - - make -C ports/minimal CROSS=1 build/firmware.bin - - ls -l ports/minimal/build/firmware.bin - #- mkdir -p ${HOME}/persist - # Save new firmware for reference, but only if building a main branch, not a pull request - #- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp ports/minimal/build/firmware.bin ${HOME}/persist/; fi' + - echo 'Building unix' && echo -en 'travis_fold:start:unix\\r' - - make -C ports/unix deplibs - - make -C ports/unix - - make -C ports/unix coverage + - ([[ $TRAVIS_TEST != "unix" ]] || make -C ports/unix deplibs) + - ([[ $TRAVIS_TEST != "unix" ]] || make -C ports/unix) + - ([[ $TRAVIS_TEST != "unix" ]] || make -C ports/unix coverage) - echo -en 'travis_fold:end:unix\\r' + - echo 'Building qemu' && echo -en 'travis_fold:start:qemu\\r' - - make -C ports/qemu-arm test + - ([[ $TRAVIS_TEST != "qemu" ]] || make -C ports/qemu-arm test) - echo -en 'travis_fold:end:qemu\\r' # run tests without coverage info @@ -71,16 +79,19 @@ script: # run tests with coverage info - echo 'Test all' && echo -en 'travis_fold:start:test_all\\r' - - (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests) + - ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests)) - echo -en 'travis_fold:end:test_all\\r' + - echo 'Test threads' && echo -en 'travis_fold:start:test_threads\\r' - - (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -d thread) + - ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -d thread)) - echo -en 'travis_fold:end:test_threads\\r' + - echo 'Testing with native' && echo -en 'travis_fold:start:test_native\\r' - - (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --emit native) + - ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --emit native)) - echo -en 'travis_fold:end:test_native\\r' - - echo 'Testing with mpy' && echo -en 'travis_fold:start:test_mpy\\r' - - (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --via-mpy -d basics float) + + - (echo 'Testing with mpy' && echo -en 'travis_fold:start:test_mpy\\r') + - ([[ $TRAVIS_TEST != "unix" ]] || (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --via-mpy -d basics float)) - echo -en 'travis_fold:end:test_mpy\\r' # run coveralls coverage analysis (try to, even if some builds/tests failed) diff --git a/tools/build_adafruit_bins.sh b/tools/build_adafruit_bins.sh index c7488f28a9..47fe7c66ad 100755 --- a/tools/build_adafruit_bins.sh +++ b/tools/build_adafruit_bins.sh @@ -9,7 +9,13 @@ if [ "$TRAVIS" == "true" ]; then PARALLEL="-j 2" fi -for board in $ATMEL_BOARDS; do +if [ -z "$TRAVIS_BOARD" ]; then + boards=$ATMEL_BOARDS +else + boards=$TRAVIS_BOARD +fi + +for board in $boards; do make $PARALLEL -C ports/atmel-samd BOARD=$board (( exit_status = exit_status || $? )) done @@ -32,7 +38,7 @@ if [ "$TRAVIS" == "true" ]; then fi fi -for board in $ATMEL_BOARDS; do +for board in $boards; do mkdir -p bin/$board/ cp ports/atmel-samd/build-$board/firmware.bin bin/$board/adafruit-circuitpython-$board-$version.bin (( exit_status = exit_status || $? ))