From cc9e799fc1ae8f74df4c6a103f6fe9465a6caa3c Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 13 Dec 2017 21:54:52 +0800 Subject: [PATCH] ci: split into multiple jobs --- .travis.yml | 15 +++++++++++-- tests/common.sh | 56 +++++++++++++++++++------------------------------ 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/.travis.yml b/.travis.yml index 29c925bb0..feb90d184 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,18 @@ language: bash os: linux dist: trusty -env: - - BUILD_TYPE=build +matrix: + include: + - env: + - BUILD_TYPE=build + - env: + - BUILD_TYPE=platformio + - env: + - BUILD_TYPE=docs + - env: + - BUILD_TYPE=package + - env: + - BUILD_TYPE=host_tests install: - pip install --user -r doc/requirements.txt @@ -25,6 +35,7 @@ deploy: on: repo: esp8266/Arduino tags: true + condition: "$BUILD_TYPE = package" notifications: email: diff --git a/tests/common.sh b/tests/common.sh index b1e3737bd..9c7563032 100755 --- a/tests/common.sh +++ b/tests/common.sh @@ -169,31 +169,8 @@ function build_sketches_with_platformio() set -e } -function run_travis_ci_build() +function install_arduino() { - # Build documentation using Sphinx - echo -e "travis_fold:start:docs" - cd $TRAVIS_BUILD_DIR/doc - build_docs - echo -e "travis_fold:end:docs" - - # Build release package - echo -e "travis_fold:start:build_package" - cd $TRAVIS_BUILD_DIR/package - build_package - echo -e "travis_fold:end:build_package" - - if [ "$TRAVIS_TAG" != "" ]; then - echo "Skipping tests for tagged build" - return 0; - fi - - # Run host side tests - echo -e "travis_fold:start:host_tests" - cd $TRAVIS_BUILD_DIR/tests - run_host_tests - echo -e "travis_fold:end:host_tests" - # Install Arduino IDE and required libraries echo -e "travis_fold:start:sketch_test_env_prepare" cd $TRAVIS_BUILD_DIR @@ -202,7 +179,10 @@ function run_travis_ci_build() cd $TRAVIS_BUILD_DIR install_libraries echo -e "travis_fold:end:sketch_test_env_prepare" +} +function build_sketches_with_arduino() +{ # Compile sketches echo -e "travis_fold:start:sketch_test" build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries" @@ -212,20 +192,28 @@ function run_travis_ci_build() echo -e "travis_fold:start:size_report" cat size.log echo -e "travis_fold:end:size_report" - - # PlatformIO - echo -e "travis_fold:start:install_platformio" - install_platformio - echo -e "travis_fold:end:install_platformio" - - echo -e "travis_fold:start:build_sketches_with_platformio" - build_sketches_with_platformio $TRAVIS_BUILD_DIR/libraries "--board nodemcuv2 --verbose" - echo -e "travis_fold:end:build_sketches_with_platformio" } set -e if [ "$BUILD_TYPE" = "build" ]; then - run_travis_ci_build + install_arduino + build_sketches_with_arduino +elif [ "$BUILD_TYPE" = "platformio" ]; then + # PlatformIO + install_platformio + build_sketches_with_platformio $TRAVIS_BUILD_DIR/libraries "--board nodemcuv2 --verbose" +elif [ "$BUILD_TYPE" = "docs" ]; then + # Build documentation using Sphinx + cd $TRAVIS_BUILD_DIR/doc + build_docs +elif [ "$BUILD_TYPE" = "package" ]; then + # Build release package + cd $TRAVIS_BUILD_DIR/package + build_package +elif [ "$BUILD_TYPE" = "host_tests" ]; then + # Run host side tests + cd $TRAVIS_BUILD_DIR/tests + run_host_tests fi