From 0e235f9aa48500cd3e10cc5194370e51d805a963 Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Date: Thu, 3 Oct 2024 16:18:11 -0300 Subject: [PATCH] fix(json): Skip requirements if libs are not installed --- .github/scripts/sketch_utils.sh | 39 +++++++++++++++++++------------ .github/scripts/tests_run.sh | 19 +++++++-------- .github/workflows/tests_build.yml | 1 + .github/workflows/tests_hw.yml | 4 ---- 4 files changed, 33 insertions(+), 30 deletions(-) diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh index 8316c328e9c..47d9271e171 100755 --- a/.github/scripts/sketch_utils.sh +++ b/.github/scripts/sketch_utils.sh @@ -1,6 +1,12 @@ #!/bin/bash -SDKCONFIG_DIR="$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs" +if [ -d "$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs" ]; then + SDKCONFIG_DIR="$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs" +elif [ -d "$GITHUB_WORKSPACE/tools/esp32-arduino-libs" ]; then + SDKCONFIG_DIR="$GITHUB_WORKSPACE/tools/esp32-arduino-libs" +else + SDKCONFIG_DIR="tools/esp32-arduino-libs" +fi function build_sketch(){ # build_sketch [extra-options] while [ ! -z "$1" ]; do @@ -278,10 +284,11 @@ function build_sketch(){ # build_sketch [ex unset options } -function count_sketches(){ # count_sketches [target] [file] +function count_sketches(){ # count_sketches [target] [file] [ignore-requirements] local path=$1 local target=$2 - local file=$3 + local ignore_requirements=$3 + local file=$4 if [ $# -lt 1 ]; then echo "ERROR: Illegal number of parameters" @@ -294,7 +301,7 @@ function count_sketches(){ # count_sketches [target] [file] return 0 fi - if [ -n "$file" ]; then + if [ -f "$file" ]; then local sketches=$(cat $file) else local sketches=$(find $path -name *.ino | sort) @@ -314,16 +321,18 @@ function count_sketches(){ # count_sketches [target] [file] continue fi - # Check if the sketch requires any configuration options - requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json) - if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then - for requirement in $requirements; do - requirement=$(echo $requirement | xargs) - found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig) - if [[ "$found_line" == "" ]]; then - continue 2 - fi - done + if [ "$ignore_requirements" != "1" ]; then + # Check if the sketch requires any configuration options + requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json) + if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then + for requirement in $requirements; do + requirement=$(echo $requirement | xargs) + found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig) + if [[ "$found_line" == "" ]]; then + continue 2 + fi + done + fi fi fi echo $sketch >> sketches.txt @@ -401,7 +410,7 @@ function build_sketches(){ # build_sketches