Skip to content

Commit a4e32c1

Browse files
committed
fix(ci): Fix test requirements check
1 parent 2ef9f78 commit a4e32c1

File tree

5 files changed

+36
-17
lines changed

5 files changed

+36
-17
lines changed

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

+3-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="$PLATFORMIO_ESP32_PATH/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,7 @@ 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+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
104104
if [[ "$found_line" == "" ]]; then
105105
continue 2
106106
fi
@@ -190,7 +190,7 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-
190190
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
191191
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
192192
for requirement in $requirements; do
193-
found_line=$(grep -E "^$requirement" "$LIBS_DIR/esp32/sdkconfig")
193+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
194194
if [[ "$found_line" == "" ]]; then
195195
continue 2
196196
fi

.github/scripts/sketch_utils.sh

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

3-
LIBS_DIR="$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs"
3+
SDKCONFIG_DIR="$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs"
44

55
function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [extra-options]
66
while [ ! -z "$1" ]; do
@@ -154,7 +154,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
154154
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
155155
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
156156
for requirement in $requirements; do
157-
found_line=$(grep -E "^$requirement" "$LIBS_DIR/$target/sdkconfig")
157+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/$target/sdkconfig")
158158
if [[ "$found_line" == "" ]]; then
159159
echo "Target $target does not meet the requirement $requirement for $sketchname. Skipping."
160160
exit 0
@@ -310,7 +310,7 @@ function count_sketches(){ # count_sketches <path> [target] [file]
310310
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
311311
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
312312
for requirement in $requirements; do
313-
found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig)
313+
found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig)
314314
if [[ "$found_line" == "" ]]; then
315315
continue 2
316316
fi

.github/scripts/tests_run.sh

+24-11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ 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+
1322
if [ -f $sketchdir/ci.json ]; then
1423
# If the target or platform is listed as false, skip the sketch. Otherwise, include it.
1524
is_target=$(jq -r --arg target $target '.targets[$target]' $sketchdir/ci.json)
@@ -21,11 +30,21 @@ function run_test() {
2130
return 0
2231
fi
2332

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+
2443
# Check if the sketch requires any configuration options
2544
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
2645
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
2746
for requirement in $requirements; do
28-
found_line=$(grep -E "^$requirement" "$LIBS_DIR/$target/sdkconfig")
47+
found_line=$(grep -E "^$requirement" "$SDKCONFIG_PATH")
2948
if [[ "$found_line" == "" ]]; then
3049
printf "\033[93mTarget $target does not meet the requirement $requirement for $sketchname. Skipping.\033[0m\n"
3150
printf "\n\n\n"
@@ -35,15 +54,6 @@ function run_test() {
3554
fi
3655
fi
3756

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-
4757
if [ $len -eq 1 ]; then
4858
# build_dir="$sketchdir/build"
4959
build_dir="$HOME/.arduino/tests/$sketchname/build.tmp"
@@ -120,7 +130,10 @@ function run_test() {
120130

121131
SCRIPTS_DIR="./.github/scripts"
122132
COUNT_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh count"
123-
LIBS_DIR="$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs"
133+
134+
if [ -d $ARDUINO_ESP32_PATH/tools/esp32-arduino-libs ]; then
135+
SDKCONFIG_DIR="$ARDUINO_ESP32_PATH/tools/esp32-arduino-libs"
136+
fi
124137

125138
platform="hardware"
126139
wokwi_timeout=60000

.github/workflows/tests_build.yml

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
~/.arduino/tests/**/build*.tmp/*.bin
7676
~/.arduino/tests/**/build*.tmp/*.elf
7777
~/.arduino/tests/**/build*.tmp/*.json
78+
~/.arduino/tests/**/build*.tmp/sdkconfig
7879
7980
- name: Upload ${{ inputs.chip }} ${{ inputs.type }} binaries as artifacts
8081
uses: actions/upload-artifact@v4
@@ -85,3 +86,4 @@ jobs:
8586
~/.arduino/tests/**/build*.tmp/*.bin
8687
~/.arduino/tests/**/build*.tmp/*.elf
8788
~/.arduino/tests/**/build*.tmp/*.json
89+
~/.arduino/tests/**/build*.tmp/sdkconfig

platform.txt

+4
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ recipe.hooks.prebuild.7.pattern.windows=cmd /c type nul > "{file_opts.path}"
143143
recipe.hooks.core.prebuild.1.pattern.windows=cmd /c echo "-DARDUINO_CORE_BUILD" > "{file_opts.path}"
144144
recipe.hooks.core.postbuild.1.pattern.windows=cmd /c type nul > "{file_opts.path}"
145145

146+
# Copy sdkconfig to build folder
147+
recipe.hooks.prebuild.8.pattern=/usr/bin/env bash -c "cp -f "{runtime.platform.path}"/tools/esp32-arduino-libs/{build.mcu}/sdkconfig "{build.path}"/sdkconfig"
148+
recipe.hooks.prebuild.8.pattern.windows=cmd /c COPY /y "{runtime.platform.path}\tools\esp32-arduino-libs\{build.mcu}\sdkconfig" "{build.path}\sdkconfig"
149+
146150
## Compile c files
147151
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.extra_flags} {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_VARIANT="{build.variant}" -DARDUINO_PARTITION_{build.partitions} {build.extra_flags} {compiler.cpreprocessor.flags} {includes} "@{build.opt.path}" "@{file_opts.path}" "{source_file}" -o "{object_file}"
148152

0 commit comments

Comments
 (0)