Ci update (#610)
This commit is contained in:
parent
2f37037029
commit
3c6f5f914c
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export ARDUINO_ESP32_PATH="$ARDUINO_USR_PATH/hardware/espressif/esp32"
|
||||||
|
if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
|
||||||
|
echo "Installing ESP32 Arduino Core ..."
|
||||||
|
script_init_path="$PWD"
|
||||||
|
mkdir -p "$ARDUINO_USR_PATH/hardware/espressif"
|
||||||
|
cd "$ARDUINO_USR_PATH/hardware/espressif"
|
||||||
|
|
||||||
|
echo "Installing Python Serial ..."
|
||||||
|
pip install pyserial > /dev/null
|
||||||
|
|
||||||
|
if [ "$OS_IS_WINDOWS" == "1" ]; then
|
||||||
|
echo "Installing Python Requests ..."
|
||||||
|
pip install requests > /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
|
||||||
|
echo "Linking Core..."
|
||||||
|
ln -s $GITHUB_WORKSPACE esp32
|
||||||
|
else
|
||||||
|
echo "Cloning Core Repository..."
|
||||||
|
git clone https://github.com/espressif/arduino-esp32.git esp32 > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Updating Submodules ..."
|
||||||
|
cd esp32
|
||||||
|
git submodule update --init --recursive > /dev/null 2>&1
|
||||||
|
|
||||||
|
echo "Installing Platform Tools ..."
|
||||||
|
cd tools && python get.py
|
||||||
|
cd $script_init_path
|
||||||
|
|
||||||
|
echo "ESP32 Arduino has been installed in '$ARDUINO_ESP32_PATH'"
|
||||||
|
echo ""
|
||||||
|
fi
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Installing ESP8266 Arduino Core ..."
|
||||||
|
script_init_path="$PWD"
|
||||||
|
mkdir -p "$ARDUINO_USR_PATH/hardware/esp8266com"
|
||||||
|
cd "$ARDUINO_USR_PATH/hardware/esp8266com"
|
||||||
|
|
||||||
|
echo "Installing Python Serial ..."
|
||||||
|
pip install pyserial > /dev/null
|
||||||
|
|
||||||
|
if [ "$OS_IS_WINDOWS" == "1" ]; then
|
||||||
|
echo "Installing Python Requests ..."
|
||||||
|
pip install requests > /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Cloning Core Repository ..."
|
||||||
|
git clone https://github.com/esp8266/Arduino.git esp8266 > /dev/null 2>&1
|
||||||
|
|
||||||
|
echo "Updating submodules ..."
|
||||||
|
cd esp8266
|
||||||
|
git submodule update --init --recursive > /dev/null 2>&1
|
||||||
|
|
||||||
|
echo "Installing Platform Tools ..."
|
||||||
|
cd tools
|
||||||
|
python get.py > /dev/null
|
||||||
|
cd $script_init_path
|
||||||
|
|
||||||
|
echo "ESP8266 Arduino has been installed in '$ARDUINO_USR_PATH/hardware/esp8266com'"
|
||||||
|
echo ""
|
|
@ -0,0 +1,213 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#OSTYPE: 'linux-gnu', ARCH: 'x86_64' => linux64
|
||||||
|
#OSTYPE: 'msys', ARCH: 'x86_64' => win32
|
||||||
|
#OSTYPE: 'darwin18', ARCH: 'i386' => macos
|
||||||
|
|
||||||
|
OSBITS=`arch`
|
||||||
|
if [[ "$OSTYPE" == "linux"* ]]; then
|
||||||
|
export OS_IS_LINUX="1"
|
||||||
|
ARCHIVE_FORMAT="tar.xz"
|
||||||
|
if [[ "$OSBITS" == "i686" ]]; then
|
||||||
|
OS_NAME="linux32"
|
||||||
|
elif [[ "$OSBITS" == "x86_64" ]]; then
|
||||||
|
OS_NAME="linux64"
|
||||||
|
elif [[ "$OSBITS" == "armv7l" || "$OSBITS" == "aarch64" ]]; then
|
||||||
|
OS_NAME="linuxarm"
|
||||||
|
else
|
||||||
|
OS_NAME="$OSTYPE-$OSBITS"
|
||||||
|
echo "Unknown OS '$OS_NAME'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
export OS_IS_MACOS="1"
|
||||||
|
ARCHIVE_FORMAT="zip"
|
||||||
|
OS_NAME="macosx"
|
||||||
|
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
|
||||||
|
export OS_IS_WINDOWS="1"
|
||||||
|
ARCHIVE_FORMAT="zip"
|
||||||
|
OS_NAME="windows"
|
||||||
|
else
|
||||||
|
OS_NAME="$OSTYPE-$OSBITS"
|
||||||
|
echo "Unknown OS '$OS_NAME'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
export OS_NAME
|
||||||
|
|
||||||
|
ARDUINO_BUILD_DIR="$HOME/.arduino/build.tmp"
|
||||||
|
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
|
||||||
|
|
||||||
|
if [ "$OS_IS_MACOS" == "1" ]; then
|
||||||
|
export ARDUINO_IDE_PATH="/Applications/Arduino.app/Contents/Java"
|
||||||
|
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
|
||||||
|
else
|
||||||
|
export ARDUINO_IDE_PATH="$HOME/arduino_ide"
|
||||||
|
export ARDUINO_USR_PATH="$HOME/Arduino"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$ARDUINO_IDE_PATH" ]; then
|
||||||
|
echo "Installing Arduino IDE on $OS_NAME ..."
|
||||||
|
echo "Downloading 'arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT' to 'arduino.$ARCHIVE_FORMAT' ..."
|
||||||
|
if [ "$OS_IS_LINUX" == "1" ]; then
|
||||||
|
wget -O "arduino.$ARCHIVE_FORMAT" "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
|
||||||
|
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
|
||||||
|
tar xf "arduino.$ARCHIVE_FORMAT" > /dev/null
|
||||||
|
mv arduino-nightly "$ARDUINO_IDE_PATH"
|
||||||
|
else
|
||||||
|
curl -o "arduino.$ARCHIVE_FORMAT" -L "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
|
||||||
|
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
|
||||||
|
unzip "arduino.$ARCHIVE_FORMAT" > /dev/null
|
||||||
|
if [ "$OS_IS_MACOS" == "1" ]; then
|
||||||
|
mv "Arduino.app" "/Applications/Arduino.app"
|
||||||
|
else
|
||||||
|
mv arduino-nightly "$ARDUINO_IDE_PATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
rm -rf "arduino.$ARCHIVE_FORMAT"
|
||||||
|
|
||||||
|
mkdir -p "$ARDUINO_USR_PATH/libraries"
|
||||||
|
mkdir -p "$ARDUINO_USR_PATH/hardware"
|
||||||
|
|
||||||
|
echo "Arduino IDE Installed in '$ARDUINO_IDE_PATH'"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
function build_sketch(){ # build_sketch <fqbn> <path-to-ino> [extra-options]
|
||||||
|
if [ "$#" -lt 2 ]; then
|
||||||
|
echo "ERROR: Illegal number of parameters"
|
||||||
|
echo "USAGE: build_sketch <fqbn> <path-to-ino> [extra-options]"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local fqbn="$1"
|
||||||
|
local sketch="$2"
|
||||||
|
local xtra_opts="$3"
|
||||||
|
local win_opts=""
|
||||||
|
if [ "$OS_IS_WINDOWS" == "1" ]; then
|
||||||
|
local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"`
|
||||||
|
local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"`
|
||||||
|
win_opts="-prefs=runtime.tools.ctags.path=$ARDUINO_IDE_PATH/tools-builder/ctags/$ctags_version -prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Compiling '"$(basename "$sketch")"' ..."
|
||||||
|
mkdir -p "$ARDUINO_BUILD_DIR"
|
||||||
|
mkdir -p "$ARDUINO_CACHE_DIR"
|
||||||
|
$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 \
|
||||||
|
-fqbn=$fqbn \
|
||||||
|
-warnings="all" \
|
||||||
|
-tools "$ARDUINO_IDE_PATH/tools-builder" \
|
||||||
|
-tools "$ARDUINO_IDE_PATH/tools" \
|
||||||
|
-built-in-libraries "$ARDUINO_IDE_PATH/libraries" \
|
||||||
|
-hardware "$ARDUINO_IDE_PATH/hardware" \
|
||||||
|
-hardware "$ARDUINO_USR_PATH/hardware" \
|
||||||
|
-libraries "$ARDUINO_USR_PATH/libraries" \
|
||||||
|
-build-cache "$ARDUINO_CACHE_DIR" \
|
||||||
|
-build-path "$ARDUINO_BUILD_DIR" \
|
||||||
|
$win_opts $xtra_opts "$sketch"
|
||||||
|
}
|
||||||
|
|
||||||
|
function count_sketches() # count_sketches <examples-path>
|
||||||
|
{
|
||||||
|
local examples="$1"
|
||||||
|
local sketches=$(find $examples -name *.ino)
|
||||||
|
local sketchnum=0
|
||||||
|
rm -rf sketches.txt
|
||||||
|
for sketch in $sketches; do
|
||||||
|
local sketchdir=$(dirname $sketch)
|
||||||
|
local sketchdirname=$(basename $sketchdir)
|
||||||
|
local sketchname=$(basename $sketch)
|
||||||
|
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
||||||
|
continue
|
||||||
|
fi;
|
||||||
|
if [[ -f "$sketchdir/.test.skip" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo $sketch >> sketches.txt
|
||||||
|
sketchnum=$(($sketchnum + 1))
|
||||||
|
done
|
||||||
|
return $sketchnum
|
||||||
|
}
|
||||||
|
|
||||||
|
function build_sketches() # build_sketches <fqbn> <examples-path> <chunk> <total-chunks> [extra-options]
|
||||||
|
{
|
||||||
|
local fqbn=$1
|
||||||
|
local examples=$2
|
||||||
|
local chunk_idex=$3
|
||||||
|
local chunks_num=$4
|
||||||
|
local xtra_opts=$5
|
||||||
|
|
||||||
|
if [ "$#" -lt 2 ]; then
|
||||||
|
echo "ERROR: Illegal number of parameters"
|
||||||
|
echo "USAGE: build_sketches <fqbn> <examples-path> [<chunk> <total-chunks>] [extra-options]"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$#" -lt 4 ]; then
|
||||||
|
chunk_idex="0"
|
||||||
|
chunks_num="1"
|
||||||
|
xtra_opts=$3
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$chunks_num" -le 0 ]; then
|
||||||
|
echo "ERROR: Chunks count must be positive number"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ "$chunk_idex" -ge "$chunks_num" ]; then
|
||||||
|
echo "ERROR: Chunk index must be less than chunks count"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
set +e
|
||||||
|
count_sketches "$examples"
|
||||||
|
local sketchcount=$?
|
||||||
|
set -e
|
||||||
|
local sketches=$(cat sketches.txt)
|
||||||
|
rm -rf sketches.txt
|
||||||
|
|
||||||
|
local chunk_size=$(( $sketchcount / $chunks_num ))
|
||||||
|
local all_chunks=$(( $chunks_num * $chunk_size ))
|
||||||
|
if [ "$all_chunks" -lt "$sketchcount" ]; then
|
||||||
|
chunk_size=$(( $chunk_size + 1 ))
|
||||||
|
fi
|
||||||
|
|
||||||
|
local start_index=$(( $chunk_idex * $chunk_size ))
|
||||||
|
if [ "$sketchcount" -le "$start_index" ]; then
|
||||||
|
echo "Skipping job"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
|
||||||
|
if [ "$end_index" -gt "$sketchcount" ]; then
|
||||||
|
end_index=$sketchcount
|
||||||
|
fi
|
||||||
|
|
||||||
|
local start_num=$(( $start_index + 1 ))
|
||||||
|
echo "Found $sketchcount Sketches";
|
||||||
|
echo "Chunk Count : $chunks_num"
|
||||||
|
echo "Chunk Size : $chunk_size"
|
||||||
|
echo "Start Sketch: $start_num"
|
||||||
|
echo "End Sketch : $end_index"
|
||||||
|
|
||||||
|
local sketchnum=0
|
||||||
|
for sketch in $sketches; do
|
||||||
|
local sketchdir=$(dirname $sketch)
|
||||||
|
local sketchdirname=$(basename $sketchdir)
|
||||||
|
local sketchname=$(basename $sketch)
|
||||||
|
if [ "${sketchdirname}.ino" != "$sketchname" ] \
|
||||||
|
|| [ -f "$sketchdir/.test.skip" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
sketchnum=$(($sketchnum + 1))
|
||||||
|
if [ "$sketchnum" -le "$start_index" ] \
|
||||||
|
|| [ "$sketchnum" -gt "$end_index" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
build_sketch "$fqbn" "$sketch" "$xtra_opts"
|
||||||
|
local result=$?
|
||||||
|
if [ $result -ne 0 ]; then
|
||||||
|
return $result
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
|
@ -0,0 +1,150 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export PLATFORMIO_ESP32_PATH="$HOME/.platformio/packages/framework-arduinoespressif32"
|
||||||
|
|
||||||
|
echo "Installing Python Wheel ..."
|
||||||
|
pip install wheel > /dev/null 2>&1
|
||||||
|
|
||||||
|
echo "Installing PlatformIO ..."
|
||||||
|
pip install -U https://github.com/platformio/platformio/archive/develop.zip > /dev/null 2>&1
|
||||||
|
|
||||||
|
echo "Installing Platform ESP32 ..."
|
||||||
|
python -m platformio platform install https://github.com/platformio/platform-espressif32.git#feature/stage > /dev/null 2>&1
|
||||||
|
|
||||||
|
echo "Replacing the framework version ..."
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
sed 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' "$HOME/.platformio/platforms/espressif32/platform.json" > "platform.json"
|
||||||
|
mv -f "platform.json" "$HOME/.platformio/platforms/espressif32/platform.json"
|
||||||
|
else
|
||||||
|
sed -i 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' "$HOME/.platformio/platforms/espressif32/platform.json"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
|
||||||
|
echo "Linking Core ..."
|
||||||
|
ln -s $GITHUB_WORKSPACE "$PLATFORMIO_ESP32_PATH"
|
||||||
|
else
|
||||||
|
echo "Cloning Core Repository ..."
|
||||||
|
git clone https://github.com/espressif/arduino-esp32.git "$PLATFORMIO_ESP32_PATH" > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "PlatformIO for ESP32 has been installed"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
function build_pio_sketch(){ # build_pio_sketch <board> <path-to-ino>
|
||||||
|
if [ "$#" -lt 2 ]; then
|
||||||
|
echo "ERROR: Illegal number of parameters"
|
||||||
|
echo "USAGE: build_pio_sketch <board> <path-to-ino>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local board="$1"
|
||||||
|
local sketch="$2"
|
||||||
|
local sketch_dir=$(dirname "$sketch")
|
||||||
|
echo ""
|
||||||
|
echo "Compiling '"$(basename "$sketch")"' ..."
|
||||||
|
python -m platformio ci -l '.' --board "$board" "$sketch_dir" --project-option="board_build.partitions = huge_app.csv"
|
||||||
|
}
|
||||||
|
|
||||||
|
function count_sketches() # count_sketches <examples-path>
|
||||||
|
{
|
||||||
|
local examples="$1"
|
||||||
|
local sketches=$(find $examples -name *.ino)
|
||||||
|
local sketchnum=0
|
||||||
|
rm -rf sketches.txt
|
||||||
|
for sketch in $sketches; do
|
||||||
|
local sketchdir=$(dirname $sketch)
|
||||||
|
local sketchdirname=$(basename $sketchdir)
|
||||||
|
local sketchname=$(basename $sketch)
|
||||||
|
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
||||||
|
continue
|
||||||
|
fi;
|
||||||
|
if [[ -f "$sketchdir/.test.skip" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo $sketch >> sketches.txt
|
||||||
|
sketchnum=$(($sketchnum + 1))
|
||||||
|
done
|
||||||
|
return $sketchnum
|
||||||
|
}
|
||||||
|
|
||||||
|
function build_pio_sketches() # build_pio_sketches <board> <examples-path> <chunk> <total-chunks>
|
||||||
|
{
|
||||||
|
if [ "$#" -lt 2 ]; then
|
||||||
|
echo "ERROR: Illegal number of parameters"
|
||||||
|
echo "USAGE: build_pio_sketches <board> <examples-path> [<chunk> <total-chunks>]"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local board=$1
|
||||||
|
local examples=$2
|
||||||
|
local chunk_idex=$3
|
||||||
|
local chunks_num=$4
|
||||||
|
|
||||||
|
if [ "$#" -lt 4 ]; then
|
||||||
|
chunk_idex="0"
|
||||||
|
chunks_num="1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$chunks_num" -le 0 ]; then
|
||||||
|
echo "ERROR: Chunks count must be positive number"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ "$chunk_idex" -ge "$chunks_num" ]; then
|
||||||
|
echo "ERROR: Chunk index must be less than chunks count"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
set +e
|
||||||
|
count_sketches "$examples"
|
||||||
|
local sketchcount=$?
|
||||||
|
set -e
|
||||||
|
local sketches=$(cat sketches.txt)
|
||||||
|
rm -rf sketches.txt
|
||||||
|
|
||||||
|
local chunk_size=$(( $sketchcount / $chunks_num ))
|
||||||
|
local all_chunks=$(( $chunks_num * $chunk_size ))
|
||||||
|
if [ "$all_chunks" -lt "$sketchcount" ]; then
|
||||||
|
chunk_size=$(( $chunk_size + 1 ))
|
||||||
|
fi
|
||||||
|
|
||||||
|
local start_index=$(( $chunk_idex * $chunk_size ))
|
||||||
|
if [ "$sketchcount" -le "$start_index" ]; then
|
||||||
|
echo "Skipping job"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
|
||||||
|
if [ "$end_index" -gt "$sketchcount" ]; then
|
||||||
|
end_index=$sketchcount
|
||||||
|
fi
|
||||||
|
|
||||||
|
local start_num=$(( $start_index + 1 ))
|
||||||
|
echo "Found $sketchcount Sketches";
|
||||||
|
echo "Chunk Count : $chunks_num"
|
||||||
|
echo "Chunk Size : $chunk_size"
|
||||||
|
echo "Start Sketch: $start_num"
|
||||||
|
echo "End Sketch : $end_index"
|
||||||
|
|
||||||
|
local sketchnum=0
|
||||||
|
for sketch in $sketches; do
|
||||||
|
local sketchdir=$(dirname $sketch)
|
||||||
|
local sketchdirname=$(basename $sketchdir)
|
||||||
|
local sketchname=$(basename $sketch)
|
||||||
|
if [ "${sketchdirname}.ino" != "$sketchname" ] \
|
||||||
|
|| [ -f "$sketchdir/.test.skip" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
sketchnum=$(($sketchnum + 1))
|
||||||
|
if [ "$sketchnum" -le "$start_index" ] \
|
||||||
|
|| [ "$sketchnum" -gt "$end_index" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
build_pio_sketch "$board" "$sketch"
|
||||||
|
local result=$?
|
||||||
|
if [ $result -ne 0 ]; then
|
||||||
|
return $result
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ ! -z "$TRAVIS_BUILD_DIR" ]; then
|
||||||
|
export GITHUB_WORKSPACE="$TRAVIS_BUILD_DIR"
|
||||||
|
export GITHUB_REPOSITORY="$TRAVIS_REPO_SLUG"
|
||||||
|
elif [ -z "$GITHUB_WORKSPACE" ]; then
|
||||||
|
export GITHUB_WORKSPACE="$PWD"
|
||||||
|
export GITHUB_REPOSITORY="me-no-dev/ESPAsyncWebServer"
|
||||||
|
fi
|
||||||
|
|
||||||
|
TARGET_PLATFORM="$1"
|
||||||
|
CHUNK_INDEX=$2
|
||||||
|
CHUNKS_CNT=$3
|
||||||
|
BUILD_PIO=0
|
||||||
|
if [ "$#" -lt 1 ]; then
|
||||||
|
TARGET_PLATFORM="esp32"
|
||||||
|
fi
|
||||||
|
if [ "$#" -lt 3 ] || [ "$CHUNKS_CNT" -le 0 ]; then
|
||||||
|
CHUNK_INDEX=0
|
||||||
|
CHUNKS_CNT=1
|
||||||
|
elif [ "$CHUNK_INDEX" -gt "$CHUNKS_CNT" ]; then
|
||||||
|
CHUNK_INDEX=$CHUNKS_CNT
|
||||||
|
elif [ "$CHUNK_INDEX" -eq "$CHUNKS_CNT" ]; then
|
||||||
|
BUILD_PIO=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$BUILD_PIO" -eq 0 ]; then
|
||||||
|
# ArduinoIDE Test
|
||||||
|
source ./.github/scripts/install-arduino-ide.sh
|
||||||
|
|
||||||
|
echo "Installing ESPAsyncWebServer ..."
|
||||||
|
cp -rf "$GITHUB_WORKSPACE" "$ARDUINO_USR_PATH/libraries/ESPAsyncWebServer"
|
||||||
|
echo "Installing ArduinoJson ..."
|
||||||
|
git clone https://github.com/bblanchon/ArduinoJson "$ARDUINO_USR_PATH/libraries/ArduinoJson" > /dev/null 2>&1
|
||||||
|
|
||||||
|
if [[ "$TARGET_PLATFORM" == "esp32" ]]; then
|
||||||
|
echo "Installing AsyncTCP ..."
|
||||||
|
git clone https://github.com/me-no-dev/AsyncTCP "$ARDUINO_USR_PATH/libraries/AsyncTCP" > /dev/null 2>&1
|
||||||
|
FQBN="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"
|
||||||
|
source ./.github/scripts/install-arduino-core-esp32.sh
|
||||||
|
echo "BUILDING ESP32 EXAMPLES"
|
||||||
|
else
|
||||||
|
echo "Installing ESPAsyncTCP ..."
|
||||||
|
git clone https://github.com/me-no-dev/ESPAsyncTCP "$ARDUINO_USR_PATH/libraries/ESPAsyncTCP" > /dev/null 2>&1
|
||||||
|
FQBN="esp8266com:esp8266:generic:eesz=4M1M,ip=lm2f"
|
||||||
|
source ./.github/scripts/install-arduino-core-esp8266.sh
|
||||||
|
echo "BUILDING ESP8266 EXAMPLES"
|
||||||
|
fi
|
||||||
|
build_sketches "$FQBN" "$GITHUB_WORKSPACE/examples" "$CHUNK_INDEX" "$CHUNKS_CNT"
|
||||||
|
else
|
||||||
|
# PlatformIO Test
|
||||||
|
source ./.github/scripts/install-platformio-esp32.sh
|
||||||
|
python -m platformio lib --storage-dir "$GITHUB_WORKSPACE" install
|
||||||
|
echo "Installing ArduinoJson ..."
|
||||||
|
python -m platformio lib -g install https://github.com/bblanchon/ArduinoJson.git > /dev/null 2>&1
|
||||||
|
if [[ "$TARGET_PLATFORM" == "esp32" ]]; then
|
||||||
|
BOARD="esp32dev"
|
||||||
|
echo "Installing AsyncTCP ..."
|
||||||
|
python -m platformio lib -g install https://github.com/me-no-dev/AsyncTCP.git > /dev/null 2>&1
|
||||||
|
echo "BUILDING ESP32 EXAMPLES"
|
||||||
|
else
|
||||||
|
BOARD="esp12e"
|
||||||
|
echo "Installing ESPAsyncTCP ..."
|
||||||
|
python -m platformio lib -g install https://github.com/me-no-dev/ESPAsyncTCP.git > /dev/null 2>&1
|
||||||
|
echo "BUILDING ESP8266 EXAMPLES"
|
||||||
|
fi
|
||||||
|
build_pio_sketches "$BOARD" "$GITHUB_WORKSPACE/examples"
|
||||||
|
fi
|
|
@ -1,54 +0,0 @@
|
||||||
name: ESP Async Web Server CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- release/*
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
build-arduino-esp32:
|
|
||||||
name: Build Arduino ESP32
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- name: Build Tests
|
|
||||||
env:
|
|
||||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
|
||||||
run: bash $TRAVIS_BUILD_DIR/travis/build.sh esp32
|
|
||||||
|
|
||||||
build-arduino-esp8266:
|
|
||||||
name: Build Arduino ESP8266
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- name: Build Tests
|
|
||||||
env:
|
|
||||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
|
||||||
run: bash $TRAVIS_BUILD_DIR/travis/build.sh esp8266
|
|
||||||
|
|
||||||
build-pio-esp32:
|
|
||||||
name: Build PlatformIO ESP32
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- name: Install Python Wheel
|
|
||||||
run: pip install wheel
|
|
||||||
- name: Build Tests
|
|
||||||
env:
|
|
||||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
|
||||||
run: bash $TRAVIS_BUILD_DIR/travis/build-pio.sh esp32dev
|
|
||||||
|
|
||||||
build-pio-esp8266:
|
|
||||||
name: Build PlatformIO ESP8266
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- name: Install Python Wheel
|
|
||||||
run: pip install wheel
|
|
||||||
- name: Build Tests
|
|
||||||
env:
|
|
||||||
TRAVIS_BUILD_DIR: ${{ github.workspace }}
|
|
||||||
run: bash $TRAVIS_BUILD_DIR/travis/build-pio.sh esp12e
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
name: ESP Async Web Server CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- release/*
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build-arduino:
|
||||||
|
name: Arduino for ${{ matrix.board }} on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
board: [esp32, esp8266]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Build Tests
|
||||||
|
run: bash ./.github/scripts/on-push.sh ${{ matrix.board }} 0 1
|
||||||
|
|
||||||
|
build-pio:
|
||||||
|
name: PlatformIO for ${{ matrix.board }} on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
board: [esp32, esp8266]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Build Tests
|
||||||
|
run: bash ./.github/scripts/on-push.sh ${{ matrix.board }} 1 1
|
|
@ -17,22 +17,22 @@ jobs:
|
||||||
- name: "Build Arduino ESP32"
|
- name: "Build Arduino ESP32"
|
||||||
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
|
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
|
||||||
stage: build
|
stage: build
|
||||||
script: bash $TRAVIS_BUILD_DIR/travis/build.sh esp32
|
script: bash $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh esp32
|
||||||
|
|
||||||
- name: "Build Arduino ESP8266"
|
- name: "Build Arduino ESP8266"
|
||||||
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
|
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
|
||||||
stage: build
|
stage: build
|
||||||
script: bash $TRAVIS_BUILD_DIR/travis/build.sh esp8266
|
script: bash $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh esp8266
|
||||||
|
|
||||||
- name: "Build Platformio ESP32"
|
- name: "Build Platformio ESP32"
|
||||||
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
|
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
|
||||||
stage: build
|
stage: build
|
||||||
script: bash $TRAVIS_BUILD_DIR/travis/build-pio.sh esp32dev
|
script: bash $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh esp32 1 1
|
||||||
|
|
||||||
- name: "Build Platformio ESP8266"
|
- name: "Build Platformio ESP8266"
|
||||||
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
|
if: tag IS blank AND (type = pull_request OR (type = push AND branch = master))
|
||||||
stage: build
|
stage: build
|
||||||
script: bash $TRAVIS_BUILD_DIR/travis/build-pio.sh esp12e
|
script: bash $TRAVIS_BUILD_DIR/.github/scripts/on-push.sh esp8266 1 1
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
|
|
|
@ -24,7 +24,7 @@ void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventT
|
||||||
client->printf("Hello Client %u :)", client->id());
|
client->printf("Hello Client %u :)", client->id());
|
||||||
client->ping();
|
client->ping();
|
||||||
} else if(type == WS_EVT_DISCONNECT){
|
} else if(type == WS_EVT_DISCONNECT){
|
||||||
Serial.printf("ws[%s][%u] disconnect: %u\n", server->url(), client->id());
|
Serial.printf("ws[%s][%u] disconnect\n", server->url(), client->id());
|
||||||
} else if(type == WS_EVT_ERROR){
|
} else if(type == WS_EVT_ERROR){
|
||||||
Serial.printf("ws[%s][%u] error(%u): %s\n", server->url(), client->id(), *((uint16_t*)arg), (char*)data);
|
Serial.printf("ws[%s][%u] error(%u): %s\n", server->url(), client->id(), *((uint16_t*)arg), (char*)data);
|
||||||
} else if(type == WS_EVT_PONG){
|
} else if(type == WS_EVT_PONG){
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
BOARD=$1
|
|
||||||
|
|
||||||
echo -e "travis_fold:start:install_pio"
|
|
||||||
pip install -U platformio
|
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
|
|
||||||
python -m platformio lib --storage-dir $TRAVIS_BUILD_DIR install
|
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
|
|
||||||
python -m platformio lib -g install https://github.com/bblanchon/ArduinoJson.git
|
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
|
|
||||||
case $BOARD in
|
|
||||||
esp32dev)
|
|
||||||
python -m platformio lib -g install https://github.com/me-no-dev/AsyncTCP.git
|
|
||||||
;;
|
|
||||||
esp12e)
|
|
||||||
python -m platformio lib -g install https://github.com/me-no-dev/ESPAsyncTCP.git || true
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
echo -e "travis_fold:end:install_pio"
|
|
||||||
|
|
||||||
echo -e "travis_fold:start:test_pio"
|
|
||||||
for EXAMPLE in $TRAVIS_BUILD_DIR/examples/*/*.ino; do
|
|
||||||
python -m platformio ci $EXAMPLE -l '.' -b $BOARD
|
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
done
|
|
||||||
echo -e "travis_fold:end:test_pio"
|
|
237
travis/build.sh
237
travis/build.sh
|
@ -1,237 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
PLATFORM=$1
|
|
||||||
CHUNK_INDEX=$2
|
|
||||||
CHUNKS_CNT=$3
|
|
||||||
if [ "$#" -lt 3 ]; then
|
|
||||||
echo "Building all sketches"
|
|
||||||
CHUNK_INDEX=0
|
|
||||||
CHUNKS_CNT=1
|
|
||||||
fi
|
|
||||||
if [ "$CHUNKS_CNT" -le 0 ]; then
|
|
||||||
echo "Chunks count must be positive number"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ "$CHUNK_INDEX" -ge "$CHUNKS_CNT" ]; then
|
|
||||||
echo "Chunk index must be less than chunks count"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $PLATFORM == "esp32" ]; then
|
|
||||||
echo "BUILDING ESP32 EXAMPLES"
|
|
||||||
elif [ $PLATFORM == "esp8266" ]; then
|
|
||||||
echo "BUILDING ESP8266 EXAMPLES"
|
|
||||||
else
|
|
||||||
echo "UNKNOWN PLATFORM $PLATFORM"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "travis_fold:start:prep_arduino_ide"
|
|
||||||
# Install Arduino IDE
|
|
||||||
wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
|
|
||||||
tar xf arduino.tar.xz
|
|
||||||
mv arduino-nightly $HOME/arduino_ide
|
|
||||||
mkdir -p $HOME/Arduino/libraries
|
|
||||||
mkdir -p $HOME/Arduino/hardware
|
|
||||||
echo -e "travis_fold:end:prep_arduino_ide"
|
|
||||||
|
|
||||||
echo -e "travis_fold:start:sketch_test_env_prepare"
|
|
||||||
cd $HOME/Arduino/libraries
|
|
||||||
cp -rf $TRAVIS_BUILD_DIR ESPAsyncWebServer
|
|
||||||
git clone https://github.com/bblanchon/ArduinoJson
|
|
||||||
#wget https://github.com/bblanchon/ArduinoJson/releases/download/v6.11.0/ArduinoJson-v6.11.0.zip && unzip ArduinoJson-v6.11.0.zip
|
|
||||||
PLATFORM_EXAMPLES=$TRAVIS_BUILD_DIR/examples
|
|
||||||
|
|
||||||
if [ $PLATFORM == "esp32" ]; then
|
|
||||||
# ESP32
|
|
||||||
cd $HOME/Arduino/libraries
|
|
||||||
git clone https://github.com/me-no-dev/AsyncTCP
|
|
||||||
cd $HOME/Arduino/hardware
|
|
||||||
pip install pyserial
|
|
||||||
mkdir espressif
|
|
||||||
cd espressif
|
|
||||||
git clone https://github.com/espressif/arduino-esp32.git esp32
|
|
||||||
cd esp32
|
|
||||||
git submodule update --init --recursive
|
|
||||||
cd tools
|
|
||||||
python get.py
|
|
||||||
PLATFORM_FQBN="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,DebugLevel=none"
|
|
||||||
PLATFORM_SIZE_BIN=$HOME/Arduino/hardware/espressif/esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-size
|
|
||||||
elif [ $PLATFORM == "esp8266" ]; then
|
|
||||||
# ESP8266
|
|
||||||
cd $HOME/Arduino/libraries
|
|
||||||
git clone https://github.com/me-no-dev/ESPAsyncTCP
|
|
||||||
cd $HOME/Arduino/hardware
|
|
||||||
mkdir esp8266com
|
|
||||||
cd esp8266com
|
|
||||||
git clone https://github.com/esp8266/Arduino.git esp8266
|
|
||||||
cd esp8266
|
|
||||||
git submodule update --init --recursive
|
|
||||||
cd tools
|
|
||||||
python get.py
|
|
||||||
PLATFORM_FQBN="esp8266com:esp8266:generic:xtal=80,FlashFreq=40,FlashMode=qio,baud=921600,eesz=4M1M,ip=lm2f,ResetMethod=nodemcu"
|
|
||||||
PLATFORM_SIZE_BIN=$HOME/Arduino/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-size
|
|
||||||
fi
|
|
||||||
echo -e "travis_fold:end:sketch_test_env_prepare"
|
|
||||||
|
|
||||||
cd $TRAVIS_BUILD_DIR
|
|
||||||
|
|
||||||
ARDUINO_IDE_PATH=$HOME/arduino_ide
|
|
||||||
ARDUINO_USR_PATH=$HOME/Arduino
|
|
||||||
ARDUINO_BUILD_DIR=$HOME/build.tmp
|
|
||||||
ARDUINO_CACHE_DIR=$HOME/cache.tmp
|
|
||||||
ARDUINO_BUILD_CMD="$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 -hardware \"$ARDUINO_IDE_PATH/hardware\" -hardware \"$ARDUINO_USR_PATH/hardware\" -tools \"$ARDUINO_IDE_PATH/tools-builder\" -built-in-libraries \"$ARDUINO_IDE_PATH/libraries\" -libraries \"$ARDUINO_USR_PATH/libraries\" -fqbn=$PLATFORM_FQBN -warnings=\"all\" -build-cache \"$ARDUINO_CACHE_DIR\" -build-path \"$ARDUINO_BUILD_DIR\" -verbose"
|
|
||||||
|
|
||||||
function print_size_info()
|
|
||||||
{
|
|
||||||
elf_file=$1
|
|
||||||
|
|
||||||
if [ -z "$elf_file" ]; then
|
|
||||||
if [ $PLATFORM == "esp32" ]; then
|
|
||||||
printf "sketch iram0.text flash.text flash.rodata dram0.data dram0.bss dram flash\n"
|
|
||||||
elif [ $PLATFORM == "esp8266" ]; then
|
|
||||||
printf "sketch data rodata bss text irom0.text dram flash\n"
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
elf_name=$(basename $elf_file)
|
|
||||||
sketch_name="${elf_name%.*}"
|
|
||||||
declare -A segments
|
|
||||||
while read -a tokens; do
|
|
||||||
seg=${tokens[0]}
|
|
||||||
seg=${seg//./}
|
|
||||||
size=${tokens[1]}
|
|
||||||
addr=${tokens[2]}
|
|
||||||
if [ "$addr" -eq "$addr" -a "$addr" -ne "0" ] 2>/dev/null; then
|
|
||||||
segments[$seg]=$size
|
|
||||||
fi
|
|
||||||
done < <($PLATFORM_SIZE_BIN --format=sysv $elf_file)
|
|
||||||
|
|
||||||
if [ $PLATFORM == "esp32" ]; then
|
|
||||||
total_ram=$((${segments[dram0data]} + ${segments[dram0bss]}))
|
|
||||||
total_flash=$((${segments[iram0text]} + ${segments[flashtext]} + ${segments[dram0data]} + ${segments[flashrodata]}))
|
|
||||||
printf "%-32s %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n" $sketch_name ${segments[iram0text]} ${segments[flashtext]} ${segments[flashrodata]} ${segments[dram0data]} ${segments[dram0bss]} $total_ram $total_flash
|
|
||||||
elif [ $PLATFORM == "esp8266" ]; then
|
|
||||||
total_ram=$((${segments[data]} + ${segments[rodata]} + ${segments[bss]}))
|
|
||||||
total_flash=$((${segments[data]} + ${segments[rodata]} + ${segments[text]} + ${segments[irom0text]}))
|
|
||||||
printf "%-28s %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n" $sketch_name ${segments[data]} ${segments[rodata]} ${segments[bss]} ${segments[text]} ${segments[irom0text]} $total_ram $total_flash
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function build_sketch()
|
|
||||||
{
|
|
||||||
local sketch=$1
|
|
||||||
echo -e "\n------------ Building $sketch ------------\n";
|
|
||||||
rm -rf $ARDUINO_BUILD_DIR/*
|
|
||||||
time ($ARDUINO_BUILD_CMD $sketch >build.log)
|
|
||||||
local result=$?
|
|
||||||
if [ $result -ne 0 ]; then
|
|
||||||
echo "Build failed ($1)"
|
|
||||||
echo "Build log:"
|
|
||||||
cat build.log
|
|
||||||
return $result
|
|
||||||
fi
|
|
||||||
rm build.log
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function count_sketches()
|
|
||||||
{
|
|
||||||
local sketches=$(find $PLATFORM_EXAMPLES -name *.ino)
|
|
||||||
local sketchnum=0
|
|
||||||
rm -rf sketches.txt
|
|
||||||
for sketch in $sketches; do
|
|
||||||
local sketchdir=$(dirname $sketch)
|
|
||||||
local sketchdirname=$(basename $sketchdir)
|
|
||||||
local sketchname=$(basename $sketch)
|
|
||||||
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
echo $sketch >> sketches.txt
|
|
||||||
sketchnum=$(($sketchnum + 1))
|
|
||||||
done
|
|
||||||
return $sketchnum
|
|
||||||
}
|
|
||||||
|
|
||||||
function build_sketches()
|
|
||||||
{
|
|
||||||
mkdir -p $ARDUINO_BUILD_DIR
|
|
||||||
mkdir -p $ARDUINO_CACHE_DIR
|
|
||||||
mkdir -p $ARDUINO_USR_PATH/libraries
|
|
||||||
mkdir -p $ARDUINO_USR_PATH/hardware
|
|
||||||
|
|
||||||
local chunk_idex=$1
|
|
||||||
local chunks_num=$2
|
|
||||||
count_sketches
|
|
||||||
local sketchcount=$?
|
|
||||||
local sketches=$(cat sketches.txt)
|
|
||||||
|
|
||||||
local chunk_size=$(( $sketchcount / $chunks_num ))
|
|
||||||
local all_chunks=$(( $chunks_num * $chunk_size ))
|
|
||||||
if [ "$all_chunks" -lt "$sketchcount" ]; then
|
|
||||||
chunk_size=$(( $chunk_size + 1 ))
|
|
||||||
fi
|
|
||||||
|
|
||||||
local start_index=$(( $chunk_idex * $chunk_size ))
|
|
||||||
if [ "$sketchcount" -le "$start_index" ]; then
|
|
||||||
echo "Skipping job"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
|
|
||||||
if [ "$end_index" -gt "$sketchcount" ]; then
|
|
||||||
end_index=$sketchcount
|
|
||||||
fi
|
|
||||||
|
|
||||||
local start_num=$(( $start_index + 1 ))
|
|
||||||
#echo -e "Sketches: \n$sketches\n"
|
|
||||||
echo "Found $sketchcount Sketches";
|
|
||||||
echo "Chunk Count : $chunks_num"
|
|
||||||
echo "Chunk Size : $chunk_size"
|
|
||||||
echo "Start Sketch: $start_num"
|
|
||||||
echo "End Sketch : $end_index"
|
|
||||||
|
|
||||||
local sketchnum=0
|
|
||||||
print_size_info >size.log
|
|
||||||
for sketch in $sketches; do
|
|
||||||
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 "Skipping $sketch marked";
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
sketchnum=$(($sketchnum + 1))
|
|
||||||
if [ "$sketchnum" -le "$start_index" ]; then
|
|
||||||
#echo "Skipping $sketch index low"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if [ "$sketchnum" -gt "$end_index" ]; then
|
|
||||||
#echo "Skipping $sketch index high"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
build_sketch $sketch
|
|
||||||
local result=$?
|
|
||||||
if [ $result -ne 0 ]; then
|
|
||||||
return $result
|
|
||||||
fi
|
|
||||||
print_size_info $ARDUINO_BUILD_DIR/*.elf >>size.log
|
|
||||||
done
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
echo -e "travis_fold:start:test_arduino_ide"
|
|
||||||
# Build Examples
|
|
||||||
build_sketches $CHUNK_INDEX $CHUNKS_CNT
|
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
echo -e "travis_fold:end:test_arduino_ide"
|
|
||||||
|
|
||||||
echo -e "travis_fold:start:size_report"
|
|
||||||
cat size.log
|
|
||||||
echo -e "travis_fold:end:size_report"
|
|
Loading…
Reference in New Issue