Skip to content

Commit 6935131

Browse files
committed
Merge branch 'master' into release/v3.1.x
2 parents 7a01384 + e403f0b commit 6935131

File tree

171 files changed

+932
-818
lines changed

Some content is hidden

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

171 files changed

+932
-818
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
@@ -144,16 +146,25 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
144146

145147
sketchname=$(basename $sketchdir)
146148

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

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

159170
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
@@ -292,16 +303,23 @@ function count_sketches(){ # count_sketches <path> [target] [file]
292303
local sketchname=$(basename $sketch)
293304
if [[ "$sketchdirname.ino" != "$sketchname" ]]; then
294305
continue
295-
elif [[ -n $target ]]; then
306+
elif [[ -n $target ]] && [[ -f $sketchdir/ci.json ]]; then
296307
# If the target is listed as false, skip the sketch. Otherwise, include it.
297-
if [ -f $sketchdir/ci.json ]; then
298-
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
299-
else
300-
is_target="true"
301-
fi
308+
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
302309
if [[ "$is_target" == "false" ]]; then
303310
continue
304311
fi
312+
313+
# Check if the sketch requires any configuration options
314+
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
315+
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
316+
for requirement in $requirements; do
317+
found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig)
318+
if [[ "$found_line" == "" ]]; then
319+
continue 2
320+
fi
321+
done
322+
fi
305323
fi
306324
echo $sketch >> sketches.txt
307325
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)