Skip to content

Commit 44f5522

Browse files
authored
Merge branch 'master' into feature/zigbee-library
2 parents 7d763df + 84ddf0a commit 44f5522

File tree

176 files changed

+968
-700
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+968
-700
lines changed

.github/scripts/install-platformio-esp32.sh

+38-9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ PLATFORMIO_ESP32_URL="https://github.com/platformio/platform-espressif32.git"
66
TOOLCHAIN_VERSION="12.2.0+20230208"
77
ESPTOOLPY_VERSION="~1.40501.0"
88
ESPRESSIF_ORGANIZATION_NAME="espressif"
9+
LIBS_DIR="tools/esp32-arduino-libs"
910

1011
echo "Installing Python Wheel ..."
1112
pip install wheel > /dev/null 2>&1
@@ -88,12 +89,25 @@ function count_sketches(){ # count_sketches <examples-path>
8889
local sketchname=$(basename $sketch)
8990
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
9091
continue
92+
elif [ -f $sketchdir/ci.json ]; then
93+
# If the target is listed as false, skip the sketch. Otherwise, include it.
94+
is_target=$(jq -r '.targets[esp32]' $sketchdir/ci.json)
95+
if [[ "$is_target" == "false" ]]; then
96+
continue
97+
fi
98+
99+
# Check if the sketch requires any configuration options
100+
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
101+
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
102+
for requirement in $requirements; do
103+
found_line=$(grep -E "^$requirement" $LIBS_DIR/esp32/sdkconfig)
104+
if [[ "$found_line" == "" ]]; then
105+
continue 2
106+
fi
107+
done
108+
fi
91109
fi
92-
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
93-
# If the target is listed as false, skip the sketch. Otherwise, include it.
94-
if [[ "$is_target" == "false" ]]; then
95-
continue
96-
fi
110+
97111
echo $sketch >> sketches.txt
98112
sketchnum=$(($sketchnum + 1))
99113
done
@@ -163,12 +177,27 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-
163177
local sketchdir=$(dirname $sketch)
164178
local sketchdirname=$(basename $sketchdir)
165179
local sketchname=$(basename $sketch)
166-
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
167-
# If the target is listed as false, skip the sketch. Otherwise, include it.
168-
if [ "${sketchdirname}.ino" != "$sketchname" ] \
169-
|| [[ "$is_target" == "false" ]]; then
180+
if [[ "$sketchdirname.ino" != "$sketchname" ]]; then
170181
continue
182+
elif [ -f $sketchdir/ci.json ]; then
183+
# If the target is listed as false, skip the sketch. Otherwise, include it.
184+
is_target=$(jq -r '.targets[esp32]' $sketchdir/ci.json)
185+
if [[ "$is_target" == "false" ]]; then
186+
continue
187+
fi
188+
189+
# Check if the sketch requires any configuration options
190+
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
191+
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
192+
for requirement in $requirements; do
193+
found_line=$(grep -E "^$requirement" $LIBS_DIR/esp32/sdkconfig)
194+
if [[ "$found_line" == "" ]]; then
195+
continue 2
196+
fi
197+
done
198+
fi
171199
fi
200+
172201
sketchnum=$(($sketchnum + 1))
173202
if [ "$sketchnum" -le "$start_index" ] \
174203
|| [ "$sketchnum" -gt "$end_index" ]; then

.github/scripts/sketch_utils.sh

+31-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
LIBS_DIR="tools/esp32-arduino-libs"
4+
35
function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [extra-options]
46
while [ ! -z "$1" ]; do
57
case "$1" in
@@ -140,16 +142,25 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
140142

141143
sketchname=$(basename $sketchdir)
142144

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

150-
if [[ "$is_target" == "false" ]]; then
151-
echo "Skipping $sketchname for target $target"
152-
exit 0
153+
# Check if the sketch requires any configuration options
154+
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
155+
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
156+
for requirement in $requirements; do
157+
found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig)
158+
if [[ "$found_line" == "" ]]; then
159+
echo "Target $target does not meet the requirement $requirement for $sketchname. Skipping."
160+
exit 0
161+
fi
162+
done
163+
fi
153164
fi
154165

155166
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
@@ -288,16 +299,23 @@ function count_sketches(){ # count_sketches <path> [target] [file]
288299
local sketchname=$(basename $sketch)
289300
if [[ "$sketchdirname.ino" != "$sketchname" ]]; then
290301
continue
291-
elif [[ -n $target ]]; then
302+
elif [[ -n $target ]] && [[ -f $sketchdir/ci.json ]]; then
292303
# If the target is listed as false, skip the sketch. Otherwise, include it.
293-
if [ -f $sketchdir/ci.json ]; then
294-
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
295-
else
296-
is_target="true"
297-
fi
304+
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
298305
if [[ "$is_target" == "false" ]]; then
299306
continue
300307
fi
308+
309+
# Check if the sketch requires any configuration options
310+
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
311+
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
312+
for requirement in $requirements; do
313+
found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig)
314+
if [[ "$found_line" == "" ]]; then
315+
continue 2
316+
fi
317+
done
318+
fi
301319
fi
302320
echo $sketch >> sketches.txt
303321
sketchnum=$(($sketchnum + 1))

.github/scripts/tests_run.sh

+20-9
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,29 @@ function run_test() {
1010
local result=0
1111
local error=0
1212

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

22-
if [[ $is_target == "false" ]] || [[ $selected_platform == "false" ]]; then
23-
printf "\033[93mSkipping $sketchname test for $target, platform: $platform\033[0m\n"
24-
printf "\n\n\n"
25-
return 0
18+
if [[ $is_target == "false" ]] || [[ $selected_platform == "false" ]]; then
19+
printf "\033[93mSkipping $sketchname test for $target, platform: $platform\033[0m\n"
20+
printf "\n\n\n"
21+
return 0
22+
fi
23+
24+
# Check if the sketch requires any configuration options
25+
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
26+
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
27+
for requirement in $requirements; do
28+
found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig)
29+
if [[ "$found_line" == "" ]]; then
30+
printf "\033[93mTarget $target does not meet the requirement $requirement for $sketchname. Skipping.\033[0m\n"
31+
printf "\n\n\n"
32+
return 0
33+
fi
34+
done
35+
fi
2636
fi
2737

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

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

114125
platform="hardware"
115126
wokwi_timeout=60000

0 commit comments

Comments
 (0)