diff --git a/.github/scripts/install-arduino-core-esp32.sh b/.github/scripts/install-arduino-core-esp32.sh index 05193132..cf1026d6 100755 --- a/.github/scripts/install-arduino-core-esp32.sh +++ b/.github/scripts/install-arduino-core-esp32.sh @@ -2,39 +2,33 @@ export ARDUINO_ESP32_PATH="$ARDUINO_USR_PATH/hardware/espressif/esp32" if [ ! -d "$ARDUINO_ESP32_PATH" ]; then - echo "Installing ESP32 Arduino Core in '$ARDUINO_ESP32_PATH'..." + echo "Installing ESP32 Arduino Core ..." script_init_path="$PWD" - mkdir -p "$ARDUINO_USR_PATH/hardware/espressif" && \ + mkdir -p "$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 "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..." && \ + echo "Installing Python Serial ..." pip install pyserial > /dev/null - if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; fi if [ "$OS_IS_WINDOWS" == "1" ]; then - echo "Installing Python Requests..." + echo "Installing Python Requests ..." pip install requests > /dev/null - if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; 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 - if [ $? -ne 0 ]; then echo "ERROR: Download failed"; exit 1; fi cd $script_init_path echo "ESP32 Arduino has been installed in '$ARDUINO_ESP32_PATH'" diff --git a/.github/scripts/install-arduino-ide.sh b/.github/scripts/install-arduino-ide.sh index 1ee02bf7..7950a49f 100755 --- a/.github/scripts/install-arduino-ide.sh +++ b/.github/scripts/install-arduino-ide.sh @@ -46,28 +46,23 @@ else 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'..." + 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 - 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 - if [ $? -ne 0 ]; then exit 1; fi 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 - 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 - if [ $? -ne 0 ]; then exit 1; fi if [ "$OS_IS_MACOS" == "1" ]; then mv "Arduino.app" "/Applications/Arduino.app" else mv arduino-nightly "$ARDUINO_IDE_PATH" fi fi - if [ $? -ne 0 ]; then exit 1; fi rm -rf "arduino.$ARCHIVE_FORMAT" mkdir -p "$ARDUINO_USR_PATH/libraries" @@ -95,7 +90,7 @@ function build_sketch(){ # build_sketch [extra-options] fi echo "" - echo "Compiling '"$(basename "$sketch")"'..." + 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 \ @@ -115,9 +110,13 @@ function build_sketch(){ # build_sketch [extra-options] function count_sketches() # count_sketches { local examples="$1" + rm -rf sketches.txt + if [ ! -d "$examples" ]; then + touch sketches.txt + return 0 + fi 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) @@ -163,8 +162,10 @@ function build_sketches() # build_sketches /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 -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 -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 - 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" else sed -i 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' "$HOME/.platformio/platforms/espressif32/platform.json" fi -if [ $? -ne 0 ]; then echo "ERROR: Replace failed"; exit 1; fi if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then - echo "Linking Core..." && \ + echo "Linking Core..." ln -s $GITHUB_WORKSPACE "$PLATFORMIO_ESP32_PATH" 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 - if [ $? -ne 0 ]; then echo "ERROR: GIT clone failed"; exit 1; fi fi echo "PlatformIO for ESP32 has been installed" echo "" - function build_pio_sketch(){ # build_pio_sketch if [ "$#" -lt 2 ]; then echo "ERROR: Illegal number of parameters" @@ -43,20 +37,24 @@ function build_pio_sketch(){ # build_pio_sketch return 1 fi - local board="$1" - local sketch="$2" - local sketch_dir=$(dirname "$sketch") - echo "" - echo "Compiling '"$(basename "$sketch")"'..." - python -m platformio ci --board "$board" "$sketch_dir" --project-option="board_build.partitions = huge_app.csv" + local board="$1" + local sketch="$2" + local sketch_dir=$(dirname "$sketch") + echo "" + echo "Compiling '"$(basename "$sketch")"' ..." + python -m platformio ci --board "$board" "$sketch_dir" --project-option="board_build.partitions = huge_app.csv" } function count_sketches() # count_sketches { - 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 sketchnum=0 - rm -rf sketches.txt for sketch in $sketches; do local sketchdir=$(dirname $sketch) local sketchdirname=$(basename $sketchdir) @@ -91,35 +89,37 @@ function build_pio_sketches() # build_pio_sketches