Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e11776c

Browse files
Merge branch 'master' into feaz/zigbee-binary-output
2 parents 9138626 + f9bc177 commit e11776c

File tree

180 files changed

+4105
-825
lines changed

Some content is hidden

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

180 files changed

+4105
-825
lines changed

‎.github/scripts/get_affected.py

Lines changed: 841 additions & 0 deletions
Large diffs are not rendered by default.

‎.github/scripts/on-push-idf.sh

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,33 @@ CHECK_REQUIREMENTS="./components/arduino-esp32/.github/scripts/sketch_utils.sh c
77
# Export IDF environment
88
. ${IDF_PATH}/export.sh
99

10-
# Find all examples in ./components/arduino-esp32/idf_component_examples
11-
idf_component_examples=$(find ./components/arduino-esp32/idf_component_examples -mindepth 1 -maxdepth 1 -type d)
12-
13-
for example in $idf_component_examples; do
14-
if [ -f "$example"/ci.json ]; then
10+
if [ -n "1ドル" ]; then
11+
# If a file is provided, use it to get the affected examples.
12+
affected_examples=$(cat "1ドル" | sort)
13+
else
14+
# Otherwise, find all examples in ./components/arduino-esp32/idf_component_examples
15+
affected_examples=$(find ./components/arduino-esp32/idf_component_examples -mindepth 1 -maxdepth 1 -type d | sed 's|^\./components/arduino-esp32/||' | sort)
16+
fi
17+
18+
for example in $affected_examples; do
19+
example_path="$PWD/components/arduino-esp32/$example"
20+
if [ -f "$example_path/ci.json" ]; then
1521
# If the target is listed as false, skip the sketch. Otherwise, include it.
16-
is_target=$(jq -r --arg target "$IDF_TARGET" '.targets[$target]' "$example"/ci.json)
22+
is_target=$(jq -r --arg target "$IDF_TARGET" '.targets[$target]' "$example_path/ci.json")
1723
if [[ "$is_target" == "false" ]]; then
1824
printf "\n033円[93mSkipping %s for target %s033円[0m\n\n" "$example" "$IDF_TARGET"
1925
continue
2026
fi
2127
fi
2228

23-
idf.py -C "$example" set-target "$IDF_TARGET"
29+
idf.py -C "$example_path" set-target "$IDF_TARGET"
2430

25-
has_requirements=$(${CHECK_REQUIREMENTS} "$example" "$example/sdkconfig")
31+
has_requirements=$(${CHECK_REQUIREMENTS} "$example_path" "$example_path/sdkconfig")
2632
if [ "$has_requirements" -eq 0 ]; then
2733
printf "\n033円[93m%s does not meet the requirements for %s. Skipping...033円[0m\n\n" "$example" "$IDF_TARGET"
2834
continue
2935
fi
3036

3137
printf "\n033円[95mBuilding %s033円[0m\n\n" "$example"
32-
idf.py -C "$example" -DEXTRA_COMPONENT_DIRS="$PWD/components" build
38+
idf.py -C "$example_path" -DEXTRA_COMPONENT_DIRS="$PWD/components" build
3339
done

‎.github/scripts/set_push_chunks.sh

Lines changed: 0 additions & 83 deletions
This file was deleted.

‎.github/scripts/sketch_utils.sh

Lines changed: 167 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,14 @@ function build_sketch { # build_sketch <ide_path> <user_path> <path-to-ino> [ext
244244
fi
245245
fi
246246

247+
# Install libraries from ci.json if they exist
248+
install_libs -ai "$ide_path" -s "$sketchdir"
249+
install_result=$?
250+
if [ $install_result -ne 0 ]; then
251+
echo "ERROR: Library installation failed for $sketchname" >&2
252+
exit $install_result
253+
fi
254+
247255
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
248256
if [ -n "$ARDUINO_BUILD_DIR" ]; then
249257
build_dir="$ARDUINO_BUILD_DIR"
@@ -349,7 +357,7 @@ function build_sketch { # build_sketch <ide_path> <user_path> <path-to-ino> [ext
349357
unset options
350358
}
351359

352-
function count_sketches { # count_sketches <path> [target] [file] [ignore-requirements]
360+
function count_sketches { # count_sketches <path> [target] [ignore-requirements] [file]
353361
local path=1ドル
354362
local target=2ドル
355363
local ignore_requirements=3ドル
@@ -368,7 +376,7 @@ function count_sketches { # count_sketches <path> [target] [file] [ignore-requir
368376
fi
369377

370378
if [ -f "$file" ]; then
371-
sketches=$(cat "$file")
379+
sketches=$(cat "$file"| sort)
372380
else
373381
sketches=$(find "$path" -name '*.ino' | sort)
374382
fi
@@ -580,13 +588,168 @@ function build_sketches { # build_sketches <ide_path> <user_path> <target> <path
580588
return 0
581589
}
582590

591+
# Return 0 if the string looks like a git URL we should pass to --git-url
592+
is_git_like_url() {
593+
local u=1ドル
594+
[[ "$u" =~ ^https?://.+ ]] || [[ "$u" =~ ^git@[^:]+:.+ ]]
595+
}
596+
597+
# If status!=0, print errors/warnings from captured output (fallback to full output)
598+
print_err_warnings() {
599+
local status=1ドル; shift
600+
local out=$*
601+
if [ "$status" -ne 0 ]; then
602+
printf '%s\n' "$out" | grep -Ei "error|warning|warn" >&2 || printf '%s\n' "$out" >&2
603+
fi
604+
}
605+
606+
function install_libs { # install_libs <ide_path> <sketchdir> [-v]
607+
local ide_path=""
608+
local sketchdir=""
609+
local verbose=false
610+
611+
while [ -n "1ドル" ]; do
612+
case "1ドル" in
613+
-ai ) shift; ide_path=1ドル ;;
614+
-s ) shift; sketchdir=1ドル ;;
615+
-v ) verbose=true ;;
616+
* )
617+
echo "ERROR: Unknown argument: 1ドル" >&2
618+
echo "USAGE: install_libs -ai <ide_path> -s <sketchdir> [-v]" >&2
619+
return 1
620+
;;
621+
esac
622+
shift
623+
done
624+
625+
if [ -z "$ide_path" ]; then
626+
echo "ERROR: IDE path not provided" >&2
627+
echo "USAGE: install_libs -ai <ide_path> -s <sketchdir> [-v]" >&2
628+
return 1
629+
fi
630+
if [ -z "$sketchdir" ]; then
631+
echo "ERROR: Sketch directory not provided" >&2
632+
echo "USAGE: install_libs -ai <ide_path> -s <sketchdir> [-v]" >&2
633+
return 1
634+
fi
635+
if [ ! -f "$ide_path/arduino-cli" ]; then
636+
echo "ERROR: arduino-cli not found at $ide_path/arduino-cli" >&2
637+
return 1
638+
fi
639+
640+
if [ ! -f "$sketchdir/ci.json" ]; then
641+
[ "$verbose" = true ] && echo "No ci.json found in $sketchdir, skipping library installation"
642+
return 0
643+
fi
644+
if ! jq -e . "$sketchdir/ci.json" >/dev/null 2>&1; then
645+
echo "ERROR: $sketchdir/ci.json is not valid JSON" >&2
646+
return 1
647+
fi
648+
649+
local libs_type
650+
libs_type=$(jq -r '.libs | type' "$sketchdir/ci.json" 2>/dev/null)
651+
if [ -z "$libs_type" ] || [ "$libs_type" = "null" ]; then
652+
[ "$verbose" = true ] && echo "No libs field found in ci.json, skipping library installation"
653+
return 0
654+
elif [ "$libs_type" != "array" ]; then
655+
echo "ERROR: libs field in ci.json must be an array, found: $libs_type" >&2
656+
return 1
657+
fi
658+
659+
local libs_count
660+
libs_count=$(jq -r '.libs | length' "$sketchdir/ci.json" 2>/dev/null)
661+
if [ "$libs_count" -eq 0 ]; then
662+
[ "$verbose" = true ] && echo "libs array is empty in ci.json, skipping library installation"
663+
return 0
664+
fi
665+
666+
echo "Installing $libs_count libraries from $sketchdir/ci.json"
667+
668+
local needs_unsafe=false
669+
local original_unsafe_setting=""
670+
local libs
671+
libs=$(jq -r '.libs[]? // empty' "$sketchdir/ci.json")
672+
673+
# Detect any git-like URL (GitHub/GitLab/Bitbucket/self-hosted/ssh)
674+
for lib in $libs; do
675+
if is_git_like_url "$lib"; then
676+
needs_unsafe=true
677+
break
678+
fi
679+
done
680+
681+
if [ "$needs_unsafe" = true ]; then
682+
[ "$verbose" = true ] && echo "Checking current unsafe install setting..."
683+
original_unsafe_setting=$("$ide_path/arduino-cli" config get library.enable_unsafe_install 2>/dev/null || echo "false")
684+
if [ "$original_unsafe_setting" = "false" ]; then
685+
[ "$verbose" = true ] && echo "Enabling unsafe installs for Git URLs..."
686+
"$ide_path/arduino-cli" config set library.enable_unsafe_install true >/dev/null 2>&1 || \
687+
echo "WARNING: Failed to enable unsafe installs, Git URL installs may fail" >&2
688+
else
689+
[ "$verbose" = true ] && echo "Unsafe installs already enabled"
690+
fi
691+
fi
692+
693+
local rc=0 install_status=0 output=""
694+
for lib in $libs; do
695+
[ "$verbose" = true ] && echo "Processing library: $lib"
696+
697+
if is_git_like_url "$lib"; then
698+
[ "$verbose" = true ] && echo "Installing library from git URL: $lib"
699+
if [ "$verbose" = true ]; then
700+
"$ide_path/arduino-cli" lib install --git-url "$lib"
701+
install_status=$?
702+
else
703+
output=$("$ide_path/arduino-cli" lib install --git-url "$lib" 2>&1)
704+
install_status=$?
705+
fi
706+
else
707+
[ "$verbose" = true ] && echo "Installing library by name: $lib"
708+
if [ "$verbose" = true ]; then
709+
"$ide_path/arduino-cli" lib install "$lib"
710+
install_status=$?
711+
else
712+
output=$("$ide_path/arduino-cli" lib install "$lib" 2>&1)
713+
install_status=$?
714+
fi
715+
fi
716+
717+
# Treat "already installed"/"up to date" as success (idempotent)
718+
if [ $install_status -ne 0 ] && echo "$output" | grep -qiE 'already installed|up to date'; then
719+
install_status=0
720+
fi
721+
722+
if [ "$verbose" != true ]; then
723+
print_err_warnings "$install_status" "$output"
724+
fi
725+
726+
if [ $install_status -ne 0 ]; then
727+
echo "ERROR: Failed to install library: $lib" >&2
728+
rc=$install_status
729+
break
730+
else
731+
[ "$verbose" = true ] && echo "Successfully installed library: $lib"
732+
fi
733+
done
734+
735+
if [ "$needs_unsafe" = true ] && [ "$original_unsafe_setting" = "false" ]; then
736+
[ "$verbose" = true ] && echo "Restoring original unsafe install setting..."
737+
"$ide_path/arduino-cli" config set library.enable_unsafe_install false >/dev/null 2>&1 || true
738+
fi
739+
740+
[ $rc -eq 0 ] && echo "Library installation completed"
741+
return $rc
742+
}
743+
744+
583745
USAGE="
584746
USAGE: ${0} [command] [options]
585747
Available commands:
586748
count: Count sketches.
587749
build: Build a sketch.
588750
chunk_build: Build a chunk of sketches.
589751
check_requirements: Check if target meets sketch requirements.
752+
install_libs: Install libraries from ci.json file.
590753
"
591754

592755
cmd=1ドル
@@ -606,6 +769,8 @@ case "$cmd" in
606769
;;
607770
"check_requirements") check_requirements "$@"
608771
;;
772+
"install_libs") install_libs "$@"
773+
;;
609774
*)
610775
echo "ERROR: Unrecognized command"
611776
echo "$USAGE"

‎.github/scripts/tests_run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ function run_test {
115115
rm "$sketchdir"/diagram.json 2>/dev/null || true
116116

117117
result=0
118-
printf "033円[95mpytest \"%s/test_%s.py\" --build-dir \"%s\" --junit-xml=\"%s\" -o junit_suite_name=%s_%s_%s_%s%s %s033円[0m\n" "$sketchdir" "$sketchname" "$build_dir" "$report_file" "$test_type" "$platform" "$target" "$sketchname" "$i" "${extra_args[*]@Q}"
119-
bash -c "set +e; pytest \"$sketchdir/test_$sketchname.py\" --build-dir \"$build_dir\" --junit-xml=\"$report_file\" -o junit_suite_name=${test_type}_${platform}_${target}_${sketchname}${i} ${extra_args[*]@Q}; exit \$?" || result=$?
118+
printf "033円[95mpytest -s \"%s/test_%s.py\" --build-dir \"%s\" --junit-xml=\"%s\" -o junit_suite_name=%s_%s_%s_%s%s %s033円[0m\n" "$sketchdir" "$sketchname" "$build_dir" "$report_file" "$test_type" "$platform" "$target" "$sketchname" "$i" "${extra_args[*]@Q}"
119+
bash -c "set +e; pytest -s \"$sketchdir/test_$sketchname.py\" --build-dir \"$build_dir\" --junit-xml=\"$report_file\" -o junit_suite_name=${test_type}_${platform}_${target}_${sketchname}${i} ${extra_args[*]@Q}; exit \$?" || result=$?
120120
printf "\n"
121121
if [ $result -ne 0 ]; then
122122
result=0
123123
printf "033円[95mRetrying test: %s -- Config: %s033円[0m\n" "$sketchname" "$i"
124-
printf "033円[95mpytest \"%s/test_%s.py\" --build-dir \"%s\" --junit-xml=\"%s\" -o junit_suite_name=%s_%s_%s_%s%s %s033円[0m\n" "$sketchdir" "$sketchname" "$build_dir" "$report_file" "$test_type" "$platform" "$target" "$sketchname" "$i" "${extra_args[*]@Q}"
125-
bash -c "set +e; pytest \"$sketchdir/test_$sketchname.py\" --build-dir \"$build_dir\" --junit-xml=\"$report_file\" -o junit_suite_name=${test_type}_${platform}_${target}_${sketchname}${i} ${extra_args[*]@Q}; exit \$?" || result=$?
124+
printf "033円[95mpytest -s \"%s/test_%s.py\" --build-dir \"%s\" --junit-xml=\"%s\" -o junit_suite_name=%s_%s_%s_%s%s %s033円[0m\n" "$sketchdir" "$sketchname" "$build_dir" "$report_file" "$test_type" "$platform" "$target" "$sketchname" "$i" "${extra_args[*]@Q}"
125+
bash -c "set +e; pytest -s \"$sketchdir/test_$sketchname.py\" --build-dir \"$build_dir\" --junit-xml=\"$report_file\" -o junit_suite_name=${test_type}_${platform}_${target}_${sketchname}${i} ${extra_args[*]@Q}; exit \$?" || result=$?
126126
printf "\n"
127127
if [ $result -ne 0 ]; then
128128
printf "033円[91mFailed test: %s -- Config: %s033円[0m\n\n" "$sketchname" "$i"

‎.github/workflows/allboards.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
repository_dispatch:
66
types: [test-boards]
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
find-boards:
1013
runs-on: ubuntu-latest
@@ -36,10 +39,6 @@ jobs:
3639
with:
3740
ref: ${{ github.event.client_payload.branch }}
3841

39-
- run: npm install
40-
- name: Setup jq
41-
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
42-
4342
- id: set-test-chunks
4443
name: Set Chunks
4544
run: echo "test-chunks<<EOF" >> $GITHUB_OUTPUT

‎.github/workflows/boards.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
- "libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"
99
- ".github/workflows/boards.yml"
1010

11+
permissions:
12+
contents: read
13+
1114
env:
1215
# It's convenient to set variables for values used multiple times in the workflow
1316
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -24,9 +27,6 @@ jobs:
2427
- name: Checkout repository
2528
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2629

27-
- name: Setup jq
28-
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
29-
3030
- name: Get board name
3131
run: bash .github/scripts/find_new_boards.sh ${{ github.repository }} ${{github.base_ref}}
3232

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /