Skip to content

Commit 0e235f9

Browse files
committed
fix(json): Skip requirements if libs are not installed
1 parent 613536a commit 0e235f9

File tree

4 files changed

+33
-30
lines changed

4 files changed

+33
-30
lines changed

Diff for: .github/scripts/sketch_utils.sh

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

3-
SDKCONFIG_DIR="$ARDUINO_ESP32_PATH/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
@@ -278,10 +284,11 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
278284
unset options
279285
}
280286

281-
function count_sketches(){ # count_sketches <path> [target] [file]
287+
function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requirements]
282288
local path=$1
283289
local target=$2
284-
local file=$3
290+
local ignore_requirements=$3
291+
local file=$4
285292

286293
if [ $# -lt 1 ]; then
287294
echo "ERROR: Illegal number of parameters"
@@ -294,7 +301,7 @@ function count_sketches(){ # count_sketches <path> [target] [file]
294301
return 0
295302
fi
296303

297-
if [ -n "$file" ]; then
304+
if [ -f "$file" ]; then
298305
local sketches=$(cat $file)
299306
else
300307
local sketches=$(find $path -name *.ino | sort)
@@ -314,16 +321,18 @@ function count_sketches(){ # count_sketches <path> [target] [file]
314321
continue
315322
fi
316323

317-
# Check if the sketch requires any configuration options
318-
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
319-
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
320-
for requirement in $requirements; do
321-
requirement=$(echo $requirement | xargs)
322-
found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig)
323-
if [[ "$found_line" == "" ]]; then
324-
continue 2
325-
fi
326-
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
327336
fi
328337
fi
329338
echo $sketch >> sketches.txt
@@ -401,7 +410,7 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
401410

402411
set +e
403412
if [ -n "$sketches_file" ]; then
404-
count_sketches "$path" "$target" "$sketches_file"
413+
count_sketches "$path" "$target" "0" "$sketches_file"
405414
local sketchcount=$?
406415
else
407416
count_sketches "$path" "$target"

Diff for: .github/scripts/tests_run.sh

+8-11
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ function run_test() {
1919
len=1
2020
fi
2121

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+
2228
if [ -f $sketchdir/ci.json ]; then
2329
# If the target or platform is listed as false, skip the sketch. Otherwise, include it.
2430
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
@@ -30,16 +36,6 @@ function run_test() {
3036
return 0
3137
fi
3238

33-
if [ -d $ARDUINO_ESP32_PATH/tools/esp32-arduino-libs ]; then
34-
SDKCONFIG_PATH="$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs/$target/sdkconfig"
35-
else
36-
if [ $len -eq 1 ]; then
37-
SDKCONFIG_PATH="$HOME/.arduino/tests/$sketchname/build.tmp/sdkconfig"
38-
else
39-
SDKCONFIG_PATH="$HOME/.arduino/tests/$sketchname/build0.tmp/sdkconfig"
40-
fi
41-
fi
42-
4339
# Check if the sketch requires any configuration options
4440
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
4541
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
@@ -233,7 +229,8 @@ else
233229
fi
234230

235231
set +e
236-
${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"
237234
sketchcount=$?
238235
set -e
239236
sketches=$(cat sketches.txt)

Diff for: .github/workflows/tests_build.yml

+1
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

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)