Merge pull request #62 from me-no-dev/github-ci

Update build scripts
This commit is contained in:
Me No Dev
2019-09-21 15:03:55 +03:00
committed by GitHub
3 changed files with 62 additions and 6 deletions

View File

@@ -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

40
travis/build-pio.sh Normal file
View File

@@ -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"

View File

@@ -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 ))