@@ -85,39 +85,52 @@ jobs:
85
85
chunks_count=0
86
86
87
87
if [[ $core_changed == 'true' ]] || [[ $is_pr != 'true' ]]; then
88
+ echo "Core files changed or not a PR. Building all."
88
89
build_all=true
89
90
chunks_count=${{ env.MAX_CHUNKS }}
90
91
elif [[ $lib_changed == 'true' ]] || [[ $examples_changed == 'true' ]]; then
92
+ echo "Libraries or examples changed. Building only affected sketches."
91
93
sketches=""
92
94
files="$LIB_FILES $EXAMPLES_FILES"
93
95
for file in $files; do
94
96
if [[ $file == "*.ino" ]]; then
95
97
# If file ends with .ino, add it to the list of sketches
98
+ echo "Sketch found: $file"
96
99
sketches+="$file "
97
100
continue
98
101
elif [[ $(dirname $file) == "**/src" ]]; then
99
102
# If file is in a src directory, find all sketches in the parent/examples directory
103
+ echo "Library src file found: $file"
100
104
lib=$(dirname $(dirname $file))
101
- sketches+=$(find $lib/examples -name *.ino)
105
+ lib_sketches+=$(find $lib/examples -name *.ino)
106
+ sketches+=$lib_sketches
107
+ echo "Library sketches: $lib_sketches"
102
108
else
103
109
# If file is in a example folder but it is not a sketch, find all sketches in the current directory
104
- sketches+=$(find $(dirname $file) -name *.ino)
110
+ echo "File in example folder found: $file"
111
+ sketch=$(find $(dirname $file) -name *.ino)
112
+ sketches+=$sketch
113
+ echo "Sketch in example folder: $sketch"
105
114
fi
106
115
done
107
116
108
117
# Remove duplicates
109
118
sketches=$(echo $sketches | tr ' ' '\n' | sort | uniq)
119
+ echo "Unique sketches: $sketches"
110
120
111
121
for sketch in $sketches; do
112
122
echo $sketch >> sketches_found.txt
113
123
chunks_count=$((chunks_count+1))
114
124
done
125
+
126
+ echo "Number of sketches found: $chunks_count"
115
127
else
116
128
echo "Unhandled change triggered the build. This should not happen."
117
129
exit 1
118
130
fi
119
131
120
132
if [[ $chunks_count -gt ${{ env.MAX_CHUNKS }} ]]; then
133
+ echo "Too many sketches found. Limiting to ${{ env.MAX_CHUNKS }} sketches."
121
134
chunks_count=${{ env.MAX_CHUNKS }}
122
135
fi
123
136
0 commit comments