Update CI scripts for better error handling (#3316)
This commit is contained in:
parent
85c77a9c3f
commit
d0b064a1ee
40
.github/scripts/install-arduino-core-esp32.sh
vendored
40
.github/scripts/install-arduino-core-esp32.sh
vendored
@ -2,39 +2,33 @@
|
|||||||
|
|
||||||
export ARDUINO_ESP32_PATH="$ARDUINO_USR_PATH/hardware/espressif/esp32"
|
export ARDUINO_ESP32_PATH="$ARDUINO_USR_PATH/hardware/espressif/esp32"
|
||||||
if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
|
if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
|
||||||
echo "Installing ESP32 Arduino Core in '$ARDUINO_ESP32_PATH'..."
|
echo "Installing ESP32 Arduino Core ..."
|
||||||
script_init_path="$PWD"
|
script_init_path="$PWD"
|
||||||
mkdir -p "$ARDUINO_USR_PATH/hardware/espressif" && \
|
mkdir -p "$ARDUINO_USR_PATH/hardware/espressif"
|
||||||
cd "$ARDUINO_USR_PATH/hardware/espressif"
|
cd "$ARDUINO_USR_PATH/hardware/espressif"
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
|
|
||||||
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
|
echo "Installing Python Serial ..."
|
||||||
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
|
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: GIT clone failed"; exit 1; fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd esp32 && \
|
|
||||||
echo "Updating Submodules..." && \
|
|
||||||
git submodule update --init --recursive > /dev/null 2>&1
|
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: Submodule update failed"; exit 1; fi
|
|
||||||
|
|
||||||
echo "Installing Python Serial..." && \
|
|
||||||
pip install pyserial > /dev/null
|
pip install pyserial > /dev/null
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; fi
|
|
||||||
|
|
||||||
if [ "$OS_IS_WINDOWS" == "1" ]; then
|
if [ "$OS_IS_WINDOWS" == "1" ]; then
|
||||||
echo "Installing Python Requests..."
|
echo "Installing Python Requests ..."
|
||||||
pip install requests > /dev/null
|
pip install requests > /dev/null
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing Platform Tools..."
|
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 tools && python get.py
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: Download failed"; exit 1; fi
|
|
||||||
cd $script_init_path
|
cd $script_init_path
|
||||||
|
|
||||||
echo "ESP32 Arduino has been installed in '$ARDUINO_ESP32_PATH'"
|
echo "ESP32 Arduino has been installed in '$ARDUINO_ESP32_PATH'"
|
||||||
|
23
.github/scripts/install-arduino-ide.sh
vendored
23
.github/scripts/install-arduino-ide.sh
vendored
@ -46,28 +46,23 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$ARDUINO_IDE_PATH" ]; then
|
if [ ! -d "$ARDUINO_IDE_PATH" ]; then
|
||||||
echo "Installing Arduino IDE on $OS_NAME..."
|
echo "Installing Arduino IDE on $OS_NAME ..."
|
||||||
echo "Downloading 'arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT' to 'arduino.$ARCHIVE_FORMAT'..."
|
echo "Downloading 'arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT' to 'arduino.$ARCHIVE_FORMAT' ..."
|
||||||
if [ "$OS_IS_LINUX" == "1" ]; then
|
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
|
wget -O "arduino.$ARCHIVE_FORMAT" "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: Download failed"; exit 1; fi
|
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
|
||||||
echo "Extracting 'arduino.$ARCHIVE_FORMAT'..."
|
|
||||||
tar xf "arduino.$ARCHIVE_FORMAT" > /dev/null
|
tar xf "arduino.$ARCHIVE_FORMAT" > /dev/null
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
mv arduino-nightly "$ARDUINO_IDE_PATH"
|
mv arduino-nightly "$ARDUINO_IDE_PATH"
|
||||||
else
|
else
|
||||||
curl -o "arduino.$ARCHIVE_FORMAT" -L "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
|
curl -o "arduino.$ARCHIVE_FORMAT" -L "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: Download failed"; exit 1; fi
|
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
|
||||||
echo "Extracting 'arduino.$ARCHIVE_FORMAT'..."
|
|
||||||
unzip "arduino.$ARCHIVE_FORMAT" > /dev/null
|
unzip "arduino.$ARCHIVE_FORMAT" > /dev/null
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
if [ "$OS_IS_MACOS" == "1" ]; then
|
if [ "$OS_IS_MACOS" == "1" ]; then
|
||||||
mv "Arduino.app" "/Applications/Arduino.app"
|
mv "Arduino.app" "/Applications/Arduino.app"
|
||||||
else
|
else
|
||||||
mv arduino-nightly "$ARDUINO_IDE_PATH"
|
mv arduino-nightly "$ARDUINO_IDE_PATH"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
rm -rf "arduino.$ARCHIVE_FORMAT"
|
rm -rf "arduino.$ARCHIVE_FORMAT"
|
||||||
|
|
||||||
mkdir -p "$ARDUINO_USR_PATH/libraries"
|
mkdir -p "$ARDUINO_USR_PATH/libraries"
|
||||||
@ -95,7 +90,7 @@ function build_sketch(){ # build_sketch <fqbn> <path-to-ino> [extra-options]
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Compiling '"$(basename "$sketch")"'..."
|
echo "Compiling '"$(basename "$sketch")"' ..."
|
||||||
mkdir -p "$ARDUINO_BUILD_DIR"
|
mkdir -p "$ARDUINO_BUILD_DIR"
|
||||||
mkdir -p "$ARDUINO_CACHE_DIR"
|
mkdir -p "$ARDUINO_CACHE_DIR"
|
||||||
$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 \
|
$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 \
|
||||||
@ -115,9 +110,13 @@ function build_sketch(){ # build_sketch <fqbn> <path-to-ino> [extra-options]
|
|||||||
function count_sketches() # count_sketches <examples-path>
|
function count_sketches() # count_sketches <examples-path>
|
||||||
{
|
{
|
||||||
local examples="$1"
|
local examples="$1"
|
||||||
|
rm -rf sketches.txt
|
||||||
|
if [ ! -d "$examples" ]; then
|
||||||
|
touch sketches.txt
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
local sketches=$(find $examples -name *.ino)
|
local sketches=$(find $examples -name *.ino)
|
||||||
local sketchnum=0
|
local sketchnum=0
|
||||||
rm -rf sketches.txt
|
|
||||||
for sketch in $sketches; do
|
for sketch in $sketches; do
|
||||||
local sketchdir=$(dirname $sketch)
|
local sketchdir=$(dirname $sketch)
|
||||||
local sketchdirname=$(basename $sketchdir)
|
local sketchdirname=$(basename $sketchdir)
|
||||||
@ -163,8 +162,10 @@ function build_sketches() # build_sketches <fqbn> <examples-path> <chunk> <total
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
set +e
|
||||||
count_sketches "$examples"
|
count_sketches "$examples"
|
||||||
local sketchcount=$?
|
local sketchcount=$?
|
||||||
|
set -e
|
||||||
local sketches=$(cat sketches.txt)
|
local sketches=$(cat sketches.txt)
|
||||||
rm -rf sketches.txt
|
rm -rf sketches.txt
|
||||||
|
|
||||||
|
30
.github/scripts/install-platformio-esp32.sh
vendored
Normal file → Executable file
30
.github/scripts/install-platformio-esp32.sh
vendored
Normal file → Executable file
@ -2,40 +2,34 @@
|
|||||||
|
|
||||||
export PLATFORMIO_ESP32_PATH="$HOME/.platformio/packages/framework-arduinoespressif32"
|
export PLATFORMIO_ESP32_PATH="$HOME/.platformio/packages/framework-arduinoespressif32"
|
||||||
|
|
||||||
echo "Installing Python Wheel..."
|
echo "Installing Python Wheel ..."
|
||||||
pip install wheel > /dev/null 2>&1
|
pip install wheel > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; fi
|
|
||||||
|
|
||||||
echo "Installing PlatformIO..."
|
echo "Installing PlatformIO ..."
|
||||||
pip install -U https://github.com/platformio/platformio/archive/develop.zip > /dev/null 2>&1
|
pip install -U https://github.com/platformio/platformio/archive/develop.zip > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; fi
|
|
||||||
|
|
||||||
echo "Installing Platform ESP32..."
|
echo "Installing Platform ESP32 ..."
|
||||||
python -m platformio platform install https://github.com/platformio/platform-espressif32.git#feature/stage > /dev/null 2>&1
|
python -m platformio platform install https://github.com/platformio/platform-espressif32.git#feature/stage > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; fi
|
|
||||||
|
|
||||||
echo "Replacing the framework version..."
|
echo "Replacing the framework version ..."
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
sed 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' "$HOME/.platformio/platforms/espressif32/platform.json" > "platform.json" && \
|
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"
|
mv -f "platform.json" "$HOME/.platformio/platforms/espressif32/platform.json"
|
||||||
else
|
else
|
||||||
sed -i 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' "$HOME/.platformio/platforms/espressif32/platform.json"
|
sed -i 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' "$HOME/.platformio/platforms/espressif32/platform.json"
|
||||||
fi
|
fi
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: Replace failed"; exit 1; fi
|
|
||||||
|
|
||||||
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
|
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
|
||||||
echo "Linking Core..." && \
|
echo "Linking Core..."
|
||||||
ln -s $GITHUB_WORKSPACE "$PLATFORMIO_ESP32_PATH"
|
ln -s $GITHUB_WORKSPACE "$PLATFORMIO_ESP32_PATH"
|
||||||
else
|
else
|
||||||
echo "Cloning Core Repository..." && \
|
echo "Cloning Core Repository ..."
|
||||||
git clone https://github.com/espressif/arduino-esp32.git "$PLATFORMIO_ESP32_PATH" > /dev/null 2>&1
|
git clone https://github.com/espressif/arduino-esp32.git "$PLATFORMIO_ESP32_PATH" > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then echo "ERROR: GIT clone failed"; exit 1; fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "PlatformIO for ESP32 has been installed"
|
echo "PlatformIO for ESP32 has been installed"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
function build_pio_sketch(){ # build_pio_sketch <board> <path-to-ino>
|
function build_pio_sketch(){ # build_pio_sketch <board> <path-to-ino>
|
||||||
if [ "$#" -lt 2 ]; then
|
if [ "$#" -lt 2 ]; then
|
||||||
echo "ERROR: Illegal number of parameters"
|
echo "ERROR: Illegal number of parameters"
|
||||||
@ -47,16 +41,20 @@ function build_pio_sketch(){ # build_pio_sketch <board> <path-to-ino>
|
|||||||
local sketch="$2"
|
local sketch="$2"
|
||||||
local sketch_dir=$(dirname "$sketch")
|
local sketch_dir=$(dirname "$sketch")
|
||||||
echo ""
|
echo ""
|
||||||
echo "Compiling '"$(basename "$sketch")"'..."
|
echo "Compiling '"$(basename "$sketch")"' ..."
|
||||||
python -m platformio ci --board "$board" "$sketch_dir" --project-option="board_build.partitions = huge_app.csv"
|
python -m platformio ci --board "$board" "$sketch_dir" --project-option="board_build.partitions = huge_app.csv"
|
||||||
}
|
}
|
||||||
|
|
||||||
function count_sketches() # count_sketches <examples-path>
|
function count_sketches() # count_sketches <examples-path>
|
||||||
{
|
{
|
||||||
local examples="$1"
|
local examples="$1"
|
||||||
|
rm -rf sketches.txt
|
||||||
|
if [ ! -d "$examples" ]; then
|
||||||
|
touch sketches.txt
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
local sketches=$(find $examples -name *.ino)
|
local sketches=$(find $examples -name *.ino)
|
||||||
local sketchnum=0
|
local sketchnum=0
|
||||||
rm -rf sketches.txt
|
|
||||||
for sketch in $sketches; do
|
for sketch in $sketches; do
|
||||||
local sketchdir=$(dirname $sketch)
|
local sketchdir=$(dirname $sketch)
|
||||||
local sketchdirname=$(basename $sketchdir)
|
local sketchdirname=$(basename $sketchdir)
|
||||||
@ -100,8 +98,10 @@ function build_pio_sketches() # build_pio_sketches <board> <examples-path> <chun
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
set +e
|
||||||
count_sketches "$examples"
|
count_sketches "$examples"
|
||||||
local sketchcount=$?
|
local sketchcount=$?
|
||||||
|
set -e
|
||||||
local sketches=$(cat sketches.txt)
|
local sketches=$(cat sketches.txt)
|
||||||
rm -rf sketches.txt
|
rm -rf sketches.txt
|
||||||
|
|
||||||
|
4
.github/scripts/on-push.sh
vendored
4
.github/scripts/on-push.sh
vendored
@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
if [ ! -z "$TRAVIS_TAG" ]; then
|
if [ ! -z "$TRAVIS_TAG" ]; then
|
||||||
echo "Skipping Test: Tagged build"
|
echo "Skipping Test: Tagged build"
|
||||||
exit 0
|
exit 0
|
||||||
@ -52,7 +54,6 @@ if [ "$BUILD_PIO" -eq 0 ]; then
|
|||||||
# CMake Test
|
# CMake Test
|
||||||
if [ "$CHUNK_INDEX" -eq 0 ]; then
|
if [ "$CHUNK_INDEX" -eq 0 ]; then
|
||||||
bash "$ARDUINO_ESP32_PATH/.github/scripts/check-cmakelists.sh"
|
bash "$ARDUINO_ESP32_PATH/.github/scripts/check-cmakelists.sh"
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
fi
|
fi
|
||||||
build_sketches "$FQBN" "$ARDUINO_ESP32_PATH/libraries" "$CHUNK_INDEX" "$CHUNKS_CNT"
|
build_sketches "$FQBN" "$ARDUINO_ESP32_PATH/libraries" "$CHUNK_INDEX" "$CHUNKS_CNT"
|
||||||
fi
|
fi
|
||||||
@ -68,4 +69,3 @@ else
|
|||||||
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
|
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
|
||||||
#build_pio_sketches esp32dev "$PLATFORMIO_ESP32_PATH/libraries"
|
#build_pio_sketches esp32dev "$PLATFORMIO_ESP32_PATH/libraries"
|
||||||
fi
|
fi
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
|
Loading…
Reference in New Issue
Block a user