Skip to content

Commit 861b3aa

Browse files
committed
Update build scripts
1 parent 6937856 commit 861b3aa

File tree

3 files changed

+62
-6
lines changed

3 files changed

+62
-6
lines changed

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
sudo: false
2-
language: bash
2+
language: python
33
os:
44
- linux
55

@@ -12,11 +12,16 @@ stages:
1212
jobs:
1313
include:
1414

15-
- name: "Build Examples"
15+
- name: "Arduino Build"
1616
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
1717
stage: build
1818
script: bash $TRAVIS_BUILD_DIR/travis/build.sh
1919

20+
- name: "PlatformIO Build"
21+
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
22+
stage: build
23+
script: bash $TRAVIS_BUILD_DIR/travis/build-pio.sh
24+
2025
notifications:
2126
email:
2227
on_success: change
@@ -26,4 +31,4 @@ notifications:
2631
- https://webhooks.gitter.im/e/60e65d0c78ea0a920347
2732
on_success: change # options: [always|never|change] default: always
2833
on_failure: always # options: [always|never|change] default: always
29-
on_start: never # options: [always|never|change] default: always
34+
on_start: false # default: false

travis/build-pio.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
echo -e "travis_fold:start:install_pio"
4+
pip install -U platformio
5+
if [ $? -ne 0 ]; then exit 1; fi
6+
echo -e "travis_fold:end:install_pio"
7+
8+
echo -e "travis_fold:start:install_lib"
9+
python -m platformio lib --storage-dir $TRAVIS_BUILD_DIR install
10+
if [ $? -ne 0 ]; then exit 1; fi
11+
echo -e "travis_fold:end:install_lib"
12+
13+
echo -e "travis_fold:start:test_pio"
14+
if [ -d "$TRAVIS_BUILD_DIR/examples" ]; then
15+
for EXAMPLE in $TRAVIS_BUILD_DIR/examples/*/*.ino; do
16+
python -m platformio ci $EXAMPLE -l '.' -b esp32dev
17+
if [ $? -ne 0 ]; then exit 1; fi
18+
done
19+
fi
20+
echo -e "travis_fold:end:test_pio"
21+
22+
echo -e "travis_fold:start:install_json"
23+
python -m platformio lib -g install https://github.com/bblanchon/ArduinoJson.git
24+
if [ $? -ne 0 ]; then exit 1; fi
25+
echo -e "travis_fold:end:install_json"
26+
27+
cd $HOME/
28+
echo -e "travis_fold:start:install_web_server"
29+
git clone https://github.com/me-no-dev/ESPAsyncWebServer
30+
if [ $? -ne 0 ]; then exit 1; fi
31+
python -m platformio lib --storage-dir $HOME/ESPAsyncWebServer install
32+
if [ $? -ne 0 ]; then exit 1; fi
33+
echo -e "travis_fold:end:install_web_server"
34+
35+
echo -e "travis_fold:start:test_web_server"
36+
for EXAMPLE in $HOME/ESPAsyncWebServer/examples/*/*.ino; do
37+
python -m platformio ci $EXAMPLE -l $TRAVIS_BUILD_DIR -l $HOME/ESPAsyncWebServer -b esp32dev
38+
if [ $? -ne 0 ]; then exit 1; fi
39+
done
40+
echo -e "travis_fold:end:test_web_server"

travis/build.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ cd $HOME/Arduino/libraries
3030
cp -rf $TRAVIS_BUILD_DIR AsyncTCP
3131
PLATFORM_EXAMPLES=$TRAVIS_BUILD_DIR/examples
3232

33+
git clone https://github.com/me-no-dev/ESPAsyncWebServer
34+
git clone https://github.com/bblanchon/ArduinoJson
35+
LIB_EXAMPLES=$HOME/Arduino/libraries/ESPAsyncWebServer/examples
36+
3337
cd $HOME/Arduino/hardware
3438
pip install pyserial
3539
mkdir espressif
@@ -98,9 +102,12 @@ function build_sketch()
98102

99103
function count_sketches()
100104
{
101-
local sketches=$(find $PLATFORM_EXAMPLES -name *.ino)
105+
local path=$1
106+
if [ ! -d "$path" ]; then
107+
return 0
108+
fi
109+
local sketches=$(find $path -name *.ino)
102110
local sketchnum=0
103-
rm -rf sketches.txt
104111
for sketch in $sketches; do
105112
local sketchdir=$(dirname $sketch)
106113
local sketchdirname=$(basename $sketchdir)
@@ -123,8 +130,12 @@ function build_sketches()
123130

124131
local chunk_idex=$1
125132
local chunks_num=$2
126-
count_sketches
133+
rm -rf sketches.txt
134+
count_sketches $PLATFORM_EXAMPLES
127135
local sketchcount=$?
136+
count_sketches $LIB_EXAMPLES
137+
local libsketchcount=$?
138+
sketchcount=$(($sketchcount + $libsketchcount))
128139
local sketches=$(cat sketches.txt)
129140

130141
local chunk_size=$(( $sketchcount / $chunks_num ))

0 commit comments

Comments
 (0)