Skip to content

Commit 222b47a

Browse files
committed
fix
1 parent 414d1e8 commit 222b47a

File tree

6 files changed

+40
-32
lines changed

6 files changed

+40
-32
lines changed

.github/scripts/on-push.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ fi
7474

7575
SCRIPTS_DIR="./.github/scripts"
7676
if [ "$BUILD_PIO" -eq 0 ]; then
77-
source ${SCRIPTS_DIR}/install-arduino-cli.sh
78-
source ${SCRIPTS_DIR}/install-arduino-core-esp32.sh
77+
source "${SCRIPTS_DIR}/install-arduino-cli.sh"
78+
source "${SCRIPTS_DIR}/install-arduino-core-esp32.sh"
7979

8080
SKETCHES_ESP32=(
8181
"$ARDUINO_ESP32_PATH/libraries/NetworkClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino"
@@ -106,7 +106,7 @@ if [ "$BUILD_PIO" -eq 0 ]; then
106106
echo "]}" >> "$sizes_file"
107107
fi
108108
else
109-
source ${SCRIPTS_DIR}/install-platformio-esp32.sh
109+
source "${SCRIPTS_DIR}/install-platformio-esp32.sh"
110110
# PlatformIO ESP32 Test
111111
BOARD="esp32dev"
112112
OPTIONS="board_build.partitions = huge_app.csv"

.github/scripts/on-release.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ RELEASE_TAG=$(echo "$EVENT_JSON" | jq -r '.release.tag_name')
2525
RELEASE_BRANCH=$(echo "$EVENT_JSON" | jq -r '.release.target_commitish')
2626
RELEASE_ID=$(echo "$EVENT_JSON" | jq -r '.release.id')
2727

28+
SCRIPTS_DIR="./.github/scripts"
2829
OUTPUT_DIR="$GITHUB_WORKSPACE/build"
2930
PACKAGE_NAME="esp32-$RELEASE_TAG"
3031
PACKAGE_JSON_MERGE="$GITHUB_WORKSPACE/.github/scripts/merge_packages.py"
@@ -396,7 +397,7 @@ fi
396397

397398
echo "Installing arduino-cli ..."
398399
export PATH="/home/runner/bin:$PATH"
399-
source ./.github/scripts/install-arduino-cli.sh
400+
source "${SCRIPTS_DIR}/install-arduino-cli.sh"
400401

401402
echo "Testing $PACKAGE_JSON_DEV install ..."
402403

.github/scripts/set_push_chunks.sh

+29-22
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
build_all=false
44
chunks_count=0
5+
networking_sketches=()
6+
fs_sketches=()
7+
lib_sketches=()
8+
sketches=()
59

610
if [[ $CORE_CHANGED == 'true' ]] || [[ $IS_PR != 'true' ]]; then
711
echo "Core files changed or not a PR. Building all."
@@ -11,56 +15,59 @@ elif [[ $LIB_CHANGED == 'true' ]]; then
1115
echo "Libraries changed. Building only affected sketches."
1216
if [[ $NETWORKING_CHANGED == 'true' ]]; then
1317
echo "Networking libraries changed. Building networking related sketches."
14-
networking_sketches="$(find libraries/WiFi -name '*.ino') "
15-
networking_sketches+="$(find libraries/Ethernet -name '*.ino') "
16-
networking_sketches+="$(find libraries/PPP -name '*.ino') "
17-
networking_sketches+="$(find libraries/NetworkClientSecure -name '*.ino') "
18-
networking_sketches+="$(find libraries/WebServer -name '*.ino') "
18+
while IFS='' read -r line; do networking_sketches+=("$line"); done < <(find libraries/WiFi -name '*.ino')
19+
while IFS='' read -r line; do networking_sketches+=("$line"); done < <(find libraries/Ethernet -name '*.ino')
20+
while IFS='' read -r line; do networking_sketches+=("$line"); done < <(find libraries/PPP -name '*.ino')
21+
while IFS='' read -r line; do networking_sketches+=("$line"); done < <(find libraries/NetworkClientSecure -name '*.ino')
22+
while IFS='' read -r line; do networking_sketches+=("$line"); done < <(find libraries/WebServer -name '*.ino')
1923
fi
2024
if [[ $FS_CHANGED == 'true' ]]; then
2125
echo "FS libraries changed. Building FS related sketches."
22-
fs_sketches="$(find libraries/SD -name '*.ino') "
23-
fs_sketches+="$(find libraries/SD_MMC -name '*.ino') "
24-
fs_sketches+="$(find libraries/SPIFFS -name '*.ino') "
25-
fs_sketches+="$(find libraries/LittleFS -name '*.ino') "
26-
fs_sketches+="$(find libraries/FFat -name '*.ino') "
26+
while IFS='' read -r line; do fs_sketches+=("$line"); done < <(find libraries/SD -name '*.ino')
27+
while IFS='' read -r line; do fs_sketches+=("$line"); done < <(find libraries/SD_MMC -name '*.ino')
28+
while IFS='' read -r line; do fs_sketches+=("$line"); done < <(find libraries/SPIFFS -name '*.ino')
29+
while IFS='' read -r line; do fs_sketches+=("$line"); done < <(find libraries/LittleFS -name '*.ino')
30+
while IFS='' read -r line; do fs_sketches+=("$line"); done < <(find libraries/FFat -name '*.ino')
2731
fi
28-
sketches="$networking_sketches $fs_sketches"
32+
sketches=("${networking_sketches[@]}" "${fs_sketches[@]}")
2933
for file in $LIB_FILES; do
3034
lib=$(echo "$file" | awk -F "/" '{print $1"/"$2}')
3135
if [[ "$file" == *.ino ]]; then
3236
# If file ends with .ino, add it to the list of sketches
3337
echo "Sketch found: $file"
34-
sketches+="$file "
38+
sketches+=("$file")
3539
elif [[ "$file" == "$lib/src/"* ]]; then
3640
# If file is inside the src directory, find all sketches in the lib/examples directory
3741
echo "Library src file found: $file"
3842
if [[ -d $lib/examples ]]; then
39-
lib_sketches=$(find "$lib"/examples -name '*.ino')
40-
sketches+="$lib_sketches "
41-
echo "Library sketches: $lib_sketches"
43+
while IFS='' read -r line; do lib_sketches+=("$line"); done < <(find "$lib"/examples -name '*.ino')
44+
sketches+=("${lib_sketches[@]}")
45+
printf "Library sketches: %s\n" "${lib_sketches[@]}"
4246
fi
4347
else
4448
# If file is in a example folder but it is not a sketch, find all sketches in the current directory
4549
echo "File in example folder found: $file"
46-
sketch=$(find "$(dirname "$file")" -name '*.ino')
47-
sketches+="$sketch "
48-
echo "Sketch in example folder: $sketch"
50+
sketch=()
51+
while IFS='' read -r line; do sketch+=("$line"); done < <(find "$(dirname "$file")" -name '*.ino')
52+
sketches+=("${sketch[@]}")
53+
printf "Sketch in example folder: %s\n" "${sketch[@]}"
4954
fi
5055
echo ""
5156
done
5257
fi
5358

54-
if [[ -n $sketches ]]; then
59+
if [[ ${#sketches[@]} -gt 0 ]]; then
5560
# Remove duplicates
56-
sketches=$(echo "$sketches" | tr ' ' '\n' | sort | uniq)
57-
for sketch in $sketches; do
61+
duped_sketches=("${sketches[@]}")
62+
sketches=()
63+
while IFS='' read -r line; do sketches+=("$line"); done < <(printf "%s\n" "${duped_sketches[@]}" | sort | uniq)
64+
for sketch in "${sketches[@]}"; do
5865
echo "$sketch" >> sketches_found.txt
5966
chunks_count=$((chunks_count+1))
6067
done
6168
echo "Number of sketches found: $chunks_count"
6269
echo "Sketches:"
63-
echo "$sketches"
70+
printf "%s\n" "${sketches[@]}"
6471

6572
if [[ $chunks_count -gt $MAX_CHUNKS ]]; then
6673
echo "More sketches than the allowed number of chunks found. Limiting to $MAX_CHUNKS chunks."

.github/scripts/tests_build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ while [ -n "$1" ]; do
5151
shift
5252
done
5353

54-
source ${SCRIPTS_DIR}/install-arduino-cli.sh
55-
source ${SCRIPTS_DIR}/install-arduino-core-esp32.sh
54+
source "${SCRIPTS_DIR}/install-arduino-cli.sh"
55+
source "${SCRIPTS_DIR}/install-arduino-core-esp32.sh"
5656

5757
args=("-ai" "$ARDUINO_IDE_PATH" "-au" "$ARDUINO_USR_PATH")
5858

.github/scripts/tests_run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ while [ -n "$1" ]; do
199199
done
200200

201201
if [ ! $platform == "qemu" ]; then
202-
source ${SCRIPTS_DIR}/install-arduino-ide.sh
202+
source "${SCRIPTS_DIR}/install-arduino-ide.sh"
203203
fi
204204

205205
# If sketch is provided and test type is not, test type is inferred from the sketch path

.shellcheckrc

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ enable=add-default-case,deprecate-which,avoid-nullary-conditions
66
# Enable search for external sources
77
external-sources=true
88

9-
# Search folder for sourced files
10-
# Considering the scripts being in .github/scripts, the source path is set to the root of the repository.
11-
source-path=SCRIPTDIR/../..
9+
# Search folder for sourced files.
10+
# Set to the folder where the original script is located.
11+
source-path=SCRIPTDIR

0 commit comments

Comments
 (0)