From 861b3aa8a0d4845d336d4ee68239fa691b51cc14 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Sat, 21 Sep 2019 15:03:35 +0300 Subject: [PATCH] Update build scripts --- .travis.yml | 11 ++++++++--- travis/build-pio.sh | 40 ++++++++++++++++++++++++++++++++++++++++ travis/build.sh | 17 ++++++++++++++--- 3 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 travis/build-pio.sh diff --git a/.travis.yml b/.travis.yml index 020b430..bc36dba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ sudo: false -language: bash +language: python os: - linux @@ -12,11 +12,16 @@ stages: jobs: include: - - name: "Build Examples" + - name: "Arduino Build" if: tag IS blank AND (type = pull_request OR (type = push AND branch = master)) stage: build script: bash $TRAVIS_BUILD_DIR/travis/build.sh + - name: "PlatformIO Build" + if: tag IS blank AND (type = pull_request OR (type = push AND branch = master)) + stage: build + script: bash $TRAVIS_BUILD_DIR/travis/build-pio.sh + notifications: email: on_success: change @@ -26,4 +31,4 @@ notifications: - https://webhooks.gitter.im/e/60e65d0c78ea0a920347 on_success: change # options: [always|never|change] default: always on_failure: always # options: [always|never|change] default: always - on_start: never # options: [always|never|change] default: always + on_start: false # default: false diff --git a/travis/build-pio.sh b/travis/build-pio.sh new file mode 100644 index 0000000..083b473 --- /dev/null +++ b/travis/build-pio.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +echo -e "travis_fold:start:install_pio" +pip install -U platformio +if [ $? -ne 0 ]; then exit 1; fi +echo -e "travis_fold:end:install_pio" + +echo -e "travis_fold:start:install_lib" +python -m platformio lib --storage-dir $TRAVIS_BUILD_DIR install +if [ $? -ne 0 ]; then exit 1; fi +echo -e "travis_fold:end:install_lib" + +echo -e "travis_fold:start:test_pio" +if [ -d "$TRAVIS_BUILD_DIR/examples" ]; then + for EXAMPLE in $TRAVIS_BUILD_DIR/examples/*/*.ino; do + python -m platformio ci $EXAMPLE -l '.' -b esp32dev + if [ $? -ne 0 ]; then exit 1; fi + done +fi +echo -e "travis_fold:end:test_pio" + +echo -e "travis_fold:start:install_json" +python -m platformio lib -g install https://github.com/bblanchon/ArduinoJson.git +if [ $? -ne 0 ]; then exit 1; fi +echo -e "travis_fold:end:install_json" + +cd $HOME/ +echo -e "travis_fold:start:install_web_server" +git clone https://github.com/me-no-dev/ESPAsyncWebServer +if [ $? -ne 0 ]; then exit 1; fi +python -m platformio lib --storage-dir $HOME/ESPAsyncWebServer install +if [ $? -ne 0 ]; then exit 1; fi +echo -e "travis_fold:end:install_web_server" + +echo -e "travis_fold:start:test_web_server" +for EXAMPLE in $HOME/ESPAsyncWebServer/examples/*/*.ino; do + python -m platformio ci $EXAMPLE -l $TRAVIS_BUILD_DIR -l $HOME/ESPAsyncWebServer -b esp32dev + if [ $? -ne 0 ]; then exit 1; fi +done +echo -e "travis_fold:end:test_web_server" diff --git a/travis/build.sh b/travis/build.sh index 5b98306..4992310 100644 --- a/travis/build.sh +++ b/travis/build.sh @@ -30,6 +30,10 @@ cd $HOME/Arduino/libraries cp -rf $TRAVIS_BUILD_DIR AsyncTCP PLATFORM_EXAMPLES=$TRAVIS_BUILD_DIR/examples +git clone https://github.com/me-no-dev/ESPAsyncWebServer +git clone https://github.com/bblanchon/ArduinoJson +LIB_EXAMPLES=$HOME/Arduino/libraries/ESPAsyncWebServer/examples + cd $HOME/Arduino/hardware pip install pyserial mkdir espressif @@ -98,9 +102,12 @@ function build_sketch() function count_sketches() { - local sketches=$(find $PLATFORM_EXAMPLES -name *.ino) + local path=$1 + if [ ! -d "$path" ]; then + return 0 + fi + local sketches=$(find $path -name *.ino) local sketchnum=0 - rm -rf sketches.txt for sketch in $sketches; do local sketchdir=$(dirname $sketch) local sketchdirname=$(basename $sketchdir) @@ -123,8 +130,12 @@ function build_sketches() local chunk_idex=$1 local chunks_num=$2 - count_sketches + rm -rf sketches.txt + count_sketches $PLATFORM_EXAMPLES local sketchcount=$? + count_sketches $LIB_EXAMPLES + local libsketchcount=$? + sketchcount=$(($sketchcount + $libsketchcount)) local sketches=$(cat sketches.txt) local chunk_size=$(( $sketchcount / $chunks_num ))