Skip to content

Commit e647e60

Browse files
authored
Merge branch 'master' into master
2 parents bca1f9b + 8ce5f77 commit e647e60

File tree

30 files changed

+2494
-269
lines changed

30 files changed

+2494
-269
lines changed

Diff for: .github/scripts/install-platformio-esp32.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +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"
9+
SDKCONFIG_DIR="$PLATFORMIO_ESP32_PATH/tools/esp32-arduino-libs"
1010

1111
echo "Installing Python Wheel ..."
1212
pip install wheel > /dev/null 2>&1
@@ -100,7 +100,8 @@ function count_sketches(){ # count_sketches <examples-path>
100100
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
101101
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
102102
for requirement in $requirements; do
103-
found_line=$(grep -E "^$requirement" $LIBS_DIR/esp32/sdkconfig)
103+
requirement=$(echo $requirement | xargs)
104+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
104105
if [[ "$found_line" == "" ]]; then
105106
continue 2
106107
fi
@@ -190,7 +191,8 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-
190191
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
191192
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
192193
for requirement in $requirements; do
193-
found_line=$(grep -E "^$requirement" $LIBS_DIR/esp32/sdkconfig)
194+
requirement=$(echo $requirement | xargs)
195+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
194196
if [[ "$found_line" == "" ]]; then
195197
continue 2
196198
fi

Diff for: .github/scripts/sketch_utils.sh

+39-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#!/bin/bash
22

3-
LIBS_DIR="tools/esp32-arduino-libs"
3+
if [ -d "$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs" ]; then
4+
SDKCONFIG_DIR="$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs"
5+
elif [ -d "$GITHUB_WORKSPACE/tools/esp32-arduino-libs" ]; then
6+
SDKCONFIG_DIR="$GITHUB_WORKSPACE/tools/esp32-arduino-libs"
7+
else
8+
SDKCONFIG_DIR="tools/esp32-arduino-libs"
9+
fi
410

511
function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [extra-options]
612
while [ ! -z "$1" ]; do
@@ -83,14 +89,21 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
8389

8490
len=1
8591

92+
if [ -f $sketchdir/ci.json ]; then
93+
fqbn_append=`jq -r '.fqbn_append' $sketchdir/ci.json`
94+
if [ $fqbn_append == "null" ]; then
95+
fqbn_append=""
96+
fi
97+
fi
98+
8699
# Default FQBN options if none were passed in the command line.
87100

88-
esp32_opts="PSRAM=enabled,PartitionScheme=huge_app,FlashMode=dio"
89-
esp32s2_opts="PSRAM=enabled,PartitionScheme=huge_app,FlashMode=dio"
90-
esp32s3_opts="PSRAM=opi,USBMode=default,PartitionScheme=huge_app,FlashMode=dio"
91-
esp32c3_opts="PartitionScheme=huge_app,FlashMode=dio"
92-
esp32c6_opts="PartitionScheme=huge_app,FlashMode=dio"
93-
esp32h2_opts="PartitionScheme=huge_app,FlashMode=dio"
101+
esp32_opts="PSRAM=enabled,FlashMode=dio${fqbn_append:+,$fqbn_append}"
102+
esp32s2_opts="PSRAM=enabled,FlashMode=dio${fqbn_append:+,$fqbn_append}"
103+
esp32s3_opts="PSRAM=opi,USBMode=default,FlashMode=dio${fqbn_append:+,$fqbn_append}"
104+
esp32c3_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}"
105+
esp32c6_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}"
106+
esp32h2_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}"
94107

95108
# Select the common part of the FQBN based on the target. The rest will be
96109
# appended depending on the passed options.
@@ -154,7 +167,8 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
154167
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
155168
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
156169
for requirement in $requirements; do
157-
found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig)
170+
requirement=$(echo $requirement | xargs)
171+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/$target/sdkconfig")
158172
if [[ "$found_line" == "" ]]; then
159173
echo "Target $target does not meet the requirement $requirement for $sketchname. Skipping."
160174
exit 0
@@ -270,10 +284,11 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
270284
unset options
271285
}
272286

273-
function count_sketches(){ # count_sketches <path> [target] [file]
287+
function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requirements]
274288
local path=$1
275289
local target=$2
276-
local file=$3
290+
local ignore_requirements=$3
291+
local file=$4
277292

278293
if [ $# -lt 1 ]; then
279294
echo "ERROR: Illegal number of parameters"
@@ -286,7 +301,7 @@ function count_sketches(){ # count_sketches <path> [target] [file]
286301
return 0
287302
fi
288303

289-
if [ -n "$file" ]; then
304+
if [ -f "$file" ]; then
290305
local sketches=$(cat $file)
291306
else
292307
local sketches=$(find $path -name *.ino | sort)
@@ -306,15 +321,18 @@ function count_sketches(){ # count_sketches <path> [target] [file]
306321
continue
307322
fi
308323

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
324+
if [ "$ignore_requirements" != "1" ]; then
325+
# Check if the sketch requires any configuration options
326+
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
327+
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
328+
for requirement in $requirements; do
329+
requirement=$(echo $requirement | xargs)
330+
found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig)
331+
if [[ "$found_line" == "" ]]; then
332+
continue 2
333+
fi
334+
done
335+
fi
318336
fi
319337
fi
320338
echo $sketch >> sketches.txt
@@ -392,7 +410,7 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
392410

393411
set +e
394412
if [ -n "$sketches_file" ]; then
395-
count_sketches "$path" "$target" "$sketches_file"
413+
count_sketches "$path" "$target" "0" "$sketches_file"
396414
local sketchcount=$?
397415
else
398416
count_sketches "$path" "$target"

Diff for: .github/scripts/tests_run.sh

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

13+
if [ $options -eq 0 ] && [ -f $sketchdir/ci.json ]; then
14+
len=`jq -r --arg target $target '.fqbn[$target] | length' $sketchdir/ci.json`
15+
if [ $len -eq 0 ]; then
16+
len=1
17+
fi
18+
else
19+
len=1
20+
fi
21+
22+
if [ $len -eq 1 ]; then
23+
SDKCONFIG_PATH="$HOME/.arduino/tests/$sketchname/build.tmp/sdkconfig"
24+
else
25+
SDKCONFIG_PATH="$HOME/.arduino/tests/$sketchname/build0.tmp/sdkconfig"
26+
fi
27+
1328
if [ -f $sketchdir/ci.json ]; then
1429
# If the target or platform is listed as false, skip the sketch. Otherwise, include it.
1530
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
@@ -25,7 +40,8 @@ function run_test() {
2540
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
2641
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
2742
for requirement in $requirements; do
28-
found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig)
43+
requirement=$(echo $requirement | xargs)
44+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_PATH")
2945
if [[ "$found_line" == "" ]]; then
3046
printf "\033[93mTarget $target does not meet the requirement $requirement for $sketchname. Skipping.\033[0m\n"
3147
printf "\n\n\n"
@@ -35,15 +51,6 @@ function run_test() {
3551
fi
3652
fi
3753

38-
if [ $options -eq 0 ] && [ -f $sketchdir/ci.json ]; then
39-
len=`jq -r --arg target $target '.fqbn[$target] | length' $sketchdir/ci.json`
40-
if [ $len -eq 0 ]; then
41-
len=1
42-
fi
43-
else
44-
len=1
45-
fi
46-
4754
if [ $len -eq 1 ]; then
4855
# build_dir="$sketchdir/build"
4956
build_dir="$HOME/.arduino/tests/$sketchname/build.tmp"
@@ -120,7 +127,6 @@ function run_test() {
120127

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

125131
platform="hardware"
126132
wokwi_timeout=60000
@@ -223,7 +229,8 @@ else
223229
fi
224230

225231
set +e
226-
${COUNT_SKETCHES} $test_folder $target
232+
# Ignore requirements as we don't have the libs. The requirements will be checked in the run_test function
233+
${COUNT_SKETCHES} "$test_folder" "$target" "1"
227234
sketchcount=$?
228235
set -e
229236
sketches=$(cat sketches.txt)

Diff for: .github/workflows/tests_build.yml

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
~/.arduino/tests/**/build*.tmp/*.bin
3030
~/.arduino/tests/**/build*.tmp/*.elf
3131
~/.arduino/tests/**/build*.tmp/*.json
32+
~/.arduino/tests/**/build*.tmp/sdkconfig
3233
3334
- name: Evaluate if tests should be built
3435
id: check-build
@@ -75,6 +76,7 @@ jobs:
7576
~/.arduino/tests/**/build*.tmp/*.bin
7677
~/.arduino/tests/**/build*.tmp/*.elf
7778
~/.arduino/tests/**/build*.tmp/*.json
79+
~/.arduino/tests/**/build*.tmp/sdkconfig
7880
7981
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} binaries as artifacts
8082
uses: actions/upload-artifact@v4
@@ -85,3 +87,4 @@ jobs:
8587
~/.arduino/tests/**/build*.tmp/*.bin
8688
~/.arduino/tests/**/build*.tmp/*.elf
8789
~/.arduino/tests/**/build*.tmp/*.json
90+
~/.arduino/tests/**/build*.tmp/sdkconfig

Diff for: .github/workflows/tests_hw.yml

-4
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ jobs:
5959
sparse-checkout: |
6060
*
6161
62-
- name: List files
63-
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
64-
run: ls -la
65-
6662
# setup-python currently only works on ubuntu images
6763
# - uses: actions/setup-python@v5
6864
# if: ${{ steps.check-tests.outputs.enabled == 'true' }}

0 commit comments

Comments
 (0)