Skip to content

Commit

Permalink
Merge branch 'master' into feature/zigbee-library
Browse files Browse the repository at this point in the history
  • Loading branch information
P-R-O-C-H-Y authored Oct 2, 2024
2 parents 7d763df + 84ddf0a commit 44f5522
Show file tree
Hide file tree
Showing 176 changed files with 968 additions and 700 deletions.
47 changes: 38 additions & 9 deletions .github/scripts/install-platformio-esp32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ PLATFORMIO_ESP32_URL="https://github.com/platformio/platform-espressif32.git"
TOOLCHAIN_VERSION="12.2.0+20230208"
ESPTOOLPY_VERSION="~1.40501.0"
ESPRESSIF_ORGANIZATION_NAME="espressif"
LIBS_DIR="tools/esp32-arduino-libs"

echo "Installing Python Wheel ..."
pip install wheel > /dev/null 2>&1
Expand Down Expand Up @@ -88,12 +89,25 @@ function count_sketches(){ # count_sketches <examples-path>
local sketchname=$(basename $sketch)
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
continue
elif [ -f $sketchdir/ci.json ]; then
# If the target is listed as false, skip the sketch. Otherwise, include it.
is_target=$(jq -r '.targets[esp32]' $sketchdir/ci.json)
if [[ "$is_target" == "false" ]]; then
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
found_line=$(grep -E "^$requirement" $LIBS_DIR/esp32/sdkconfig)
if [[ "$found_line" == "" ]]; then
continue 2
fi
done
fi
fi
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
# If the target is listed as false, skip the sketch. Otherwise, include it.
if [[ "$is_target" == "false" ]]; then
continue
fi

echo $sketch >> sketches.txt
sketchnum=$(($sketchnum + 1))
done
Expand Down Expand Up @@ -163,12 +177,27 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
local sketchname=$(basename $sketch)
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
# If the target is listed as false, skip the sketch. Otherwise, include it.
if [ "${sketchdirname}.ino" != "$sketchname" ] \
|| [[ "$is_target" == "false" ]]; then
if [[ "$sketchdirname.ino" != "$sketchname" ]]; then
continue
elif [ -f $sketchdir/ci.json ]; then
# If the target is listed as false, skip the sketch. Otherwise, include it.
is_target=$(jq -r '.targets[esp32]' $sketchdir/ci.json)
if [[ "$is_target" == "false" ]]; then
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
found_line=$(grep -E "^$requirement" $LIBS_DIR/esp32/sdkconfig)
if [[ "$found_line" == "" ]]; then
continue 2
fi
done
fi
fi

sketchnum=$(($sketchnum + 1))
if [ "$sketchnum" -le "$start_index" ] \
|| [ "$sketchnum" -gt "$end_index" ]; then
Expand Down
44 changes: 31 additions & 13 deletions .github/scripts/sketch_utils.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

LIBS_DIR="tools/esp32-arduino-libs"

function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [extra-options]
while [ ! -z "$1" ]; do
case "$1" in
Expand Down Expand Up @@ -140,16 +142,25 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex

sketchname=$(basename $sketchdir)

# If the target is listed as false, skip the sketch. Otherwise, include it.
if [ -f $sketchdir/ci.json ]; then
# If the target is listed as false, skip the sketch. Otherwise, include it.
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
else
is_target="true"
fi
if [[ "$is_target" == "false" ]]; then
echo "Skipping $sketchname for target $target"
exit 0
fi

if [[ "$is_target" == "false" ]]; then
echo "Skipping $sketchname for target $target"
exit 0
# 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
found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig)
if [[ "$found_line" == "" ]]; then
echo "Target $target does not meet the requirement $requirement for $sketchname. Skipping."
exit 0
fi
done
fi
fi

ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
Expand Down Expand Up @@ -288,16 +299,23 @@ function count_sketches(){ # count_sketches <path> [target] [file]
local sketchname=$(basename $sketch)
if [[ "$sketchdirname.ino" != "$sketchname" ]]; then
continue
elif [[ -n $target ]]; then
elif [[ -n $target ]] && [[ -f $sketchdir/ci.json ]]; then
# If the target is listed as false, skip the sketch. Otherwise, include it.
if [ -f $sketchdir/ci.json ]; then
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
else
is_target="true"
fi
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
if [[ "$is_target" == "false" ]]; then
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
found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig)
if [[ "$found_line" == "" ]]; then
continue 2
fi
done
fi
fi
echo $sketch >> sketches.txt
sketchnum=$(($sketchnum + 1))
Expand Down
29 changes: 20 additions & 9 deletions .github/scripts/tests_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,29 @@ function run_test() {
local result=0
local error=0

# If the target or platform is listed as false, skip the sketch. Otherwise, include it.
if [ -f $sketchdir/ci.json ]; then
# If the target or platform is listed as false, skip the sketch. Otherwise, include it.
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
selected_platform=$(jq -r --arg platform $platform '.platforms[$platform]' $sketchdir/ci.json)
else
is_target="true"
selected_platform="true"
fi

if [[ $is_target == "false" ]] || [[ $selected_platform == "false" ]]; then
printf "\033[93mSkipping $sketchname test for $target, platform: $platform\033[0m\n"
printf "\n\n\n"
return 0
if [[ $is_target == "false" ]] || [[ $selected_platform == "false" ]]; then
printf "\033[93mSkipping $sketchname test for $target, platform: $platform\033[0m\n"
printf "\n\n\n"
return 0
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
found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig)
if [[ "$found_line" == "" ]]; then
printf "\033[93mTarget $target does not meet the requirement $requirement for $sketchname. Skipping.\033[0m\n"
printf "\n\n\n"
return 0
fi
done
fi
fi

if [ $options -eq 0 ] && [ -f $sketchdir/ci.json ]; then
Expand Down Expand Up @@ -110,6 +120,7 @@ function run_test() {

SCRIPTS_DIR="./.github/scripts"
COUNT_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh count"
LIBS_DIR="tools/esp32-arduino-libs"

platform="hardware"
wokwi_timeout=60000
Expand Down
Loading

0 comments on commit 44f5522

Please sign in to comment.