Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasssvaz committed Nov 2, 2024
1 parent c649cf7 commit 481b682
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/install-platformio-esp32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-
continue
fi

if ! ${CHECK_REQUIREMENTS} $sketchdir "$SDKCONFIG_DIR/esp32/sdkconfig"; then
if [ ${CHECK_REQUIREMENTS} $sketchdir "$SDKCONFIG_DIR/esp32/sdkconfig" -eq 0 ]; then
continue
fi
fi
Expand Down
15 changes: 10 additions & 5 deletions .github/scripts/sketch_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ function check_requirements(){ # check_requirements <sketchdir> <sdkconfig_path>
local sketchdir=$1
local sdkconfig_path=$2

if [ ! -f "$sdkconfig_path" ] || [ ! -f "$sketchdir/ci.json" ]; then
echo "ERROR: sdkconfig or ci.json not found"
exit 1
fi

# Check if the sketch requires any configuration options (AND)
local 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_path")
if [[ "$found_line" == "" ]]; then
return 0
echo 0
fi
done
fi
Expand All @@ -37,11 +42,11 @@ function check_requirements(){ # check_requirements <sketchdir> <sdkconfig_path>
fi
done
if [[ "$found" == "false" ]]; then
return 0
echo 0
fi
fi

return 1
echo 1
}

function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [extra-options]
Expand Down Expand Up @@ -207,7 +212,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
exit 0
fi

if ! check_requirements "$sketchdir" "$SDKCONFIG_DIR/$target/sdkconfig"; then
if [ $(check_requirements "$sketchdir" "$SDKCONFIG_DIR/$target/sdkconfig") -eq 0 ]; then
echo "Target $target does not meet the requirements for $sketchname. Skipping."
exit 0
fi
Expand Down Expand Up @@ -358,7 +363,7 @@ function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requi
fi

if [ "$ignore_requirements" != "1" ]; then
if ! check_requirements "$sketchdir" "$SDKCONFIG_DIR/$target/sdkconfig"; then
if [ $(check_requirements "$sketchdir" "$SDKCONFIG_DIR/$target/sdkconfig") -eq 0 ]; then
continue
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/tests_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function run_test() {
return 0
fi

if ! ${CHECK_REQUIREMENTS} $sketchdir $sdkconfig_path; then
if [ ${CHECK_REQUIREMENTS} $sketchdir "$sdkconfig_path" -eq 0 ]; then
printf "\033[93mTarget $target does not meet the requirements for $sketchname. Skipping.\033[0m\n"
printf "\n\n\n"
return 0
Expand Down

0 comments on commit 481b682

Please sign in to comment.