forked from esp8266/Arduino
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplatformio.sh
executable file
·79 lines (71 loc) · 2.35 KB
/
platformio.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
cache_dir=$(mktemp -d)
source "$TRAVIS_BUILD_DIR"/tests/common.sh
function install_platformio()
{
pip3 install --user -U https://github.com/platformio/platformio/archive/develop.zip
platformio platform install "https://github.com/platformio/platform-espressif8266.git#feature/stage"
sed -i 's/https:\/\/github\.com\/esp8266\/Arduino\.git/*/' ~/.platformio/platforms/espressif8266/platform.json
ln -sf $TRAVIS_BUILD_DIR ~/.platformio/packages/framework-arduinoespressif8266
# Install dependencies:
# - esp8266/examples/ConfigFile
pio lib --global install "ArduinoJson@^6.11.0"
}
function build_sketches_with_platformio()
{
set +e
local srcpath=$1
local build_arg=$2
local build_mod=$3
local build_rem=$4
local sketches=$(find $srcpath -name *.ino | sort)
local testcnt=0
for sketch in $sketches; do
testcnt=$(( ($testcnt + 1) % $build_mod ))
if [ $testcnt -ne $build_rem ]; then
continue # Not ours to do
fi
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
echo "Skipping $sketch, beacause it is not the main sketch file";
continue
fi;
if [[ -f "$sketchdir/.test.skip" ]]; then
echo -e "\n ------------ Skipping $sketch ------------ \n";
continue
fi
if [[ $(skip_ino $sketch) = 1 ]]; then
echo -e "\n ------------ Skipping $sketch ------------ \n";
continue
fi
local build_cmd="pio ci $sketchdir $build_arg"
echo -e "\n ------------ Building $sketch ------------ \n";
echo "$build_cmd"
time ($build_cmd >build.log)
local result=$?
if [ $result -ne 0 ]; then
echo "Build failed ($1)"
echo "Build log:"
cat build.log
set -e
return $result
fi
rm build.log
done
set -e
}
if [ -z "$BUILD_PARITY" ]; then
mod=1
rem=0
elif [ "$BUILD_PARITY" = "even" ]; then
mod=2
rem=0
elif [ "$BUILD_PARITY" = "odd" ]; then
mod=2
rem=1
fi
install_platformio
build_sketches_with_platformio "$TRAVIS_BUILD_DIR"/libraries "--board nodemcuv2 --verbose" "$mod" "$rem"
rm -rf "$cache_dir"