|
2 | 2 |
|
3 | 3 | build_all=false
|
4 | 4 | chunks_count=0
|
| 5 | +last_check_files="" |
| 6 | +last_check_result="" |
| 7 | +gh_output="" |
| 8 | + |
| 9 | +# Define the file patterns |
| 10 | +core_files=( |
| 11 | + '\.github/.*' |
| 12 | + 'cores/.*' |
| 13 | + 'package/.*' |
| 14 | + 'tools/.*' |
| 15 | + 'platform\.txt' |
| 16 | + 'programmers\.txt' |
| 17 | + 'variants/esp32/.*' |
| 18 | + 'variants/esp32c3/.*' |
| 19 | + 'variants/esp32c6/.*' |
| 20 | + 'variants/esp32h2/.*' |
| 21 | + 'variants/esp32p4/.*' |
| 22 | + 'variants/esp32s2/.*' |
| 23 | + 'variants/esp32s3/.*' |
| 24 | +) |
| 25 | +library_files=( |
| 26 | + 'libraries/.*/examples/.*' |
| 27 | + 'libraries/.*/src/.*' |
| 28 | +) |
| 29 | +networking_files=( |
| 30 | + 'libraries/Network/src/.*' |
| 31 | +) |
| 32 | +fs_files=( |
| 33 | + 'libraries/FS/src/.*' |
| 34 | +) |
| 35 | +static_sketches_files=( |
| 36 | + 'libraries/NetworkClientSecure/examples/WiFiClientSecure/WiFiClientSecure\.ino' |
| 37 | + 'libraries/BLE/examples/Server/Server\.ino' |
| 38 | + 'libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer\.ino' |
| 39 | + 'libraries/Insights/examples/MinimalDiagnostics/MinimalDiagnostics\.ino' |
| 40 | + 'libraries/NetworkClientSecure/src/.*' |
| 41 | + 'libraries/BLE/src/.*' |
| 42 | + 'libraries/Insights/src/.*' |
| 43 | +) |
| 44 | +idf_files=( |
| 45 | + 'idf_component\.yml' |
| 46 | + 'Kconfig\.projbuild' |
| 47 | + 'CMakeLists\.txt' |
| 48 | + 'variants/esp32c2/.*' |
| 49 | +) |
| 50 | + |
| 51 | +# Function to check if any files match the patterns |
| 52 | +check_files() { |
| 53 | + local patterns=("$@") |
| 54 | + local files_found="" |
| 55 | + for pattern in "${patterns[@]}"; do |
| 56 | + echo "Checking pattern: $pattern" |
| 57 | + matched_files=$(echo "$gh_output" | grep -E "$pattern") |
| 58 | + echo "matched_files: $matched_files" |
| 59 | + files_found+="$matched_files " |
| 60 | + done |
| 61 | + |
| 62 | + last_check_files=$(echo "$files_found" | xargs) |
| 63 | + if [[ -n $last_check_files ]]; then |
| 64 | + last_check_result="true" |
| 65 | + else |
| 66 | + last_check_result="false" |
| 67 | + fi |
| 68 | + echo "last_check_result: $last_check_result" |
| 69 | +} |
| 70 | + |
| 71 | +if [[ $IS_PR != 'true' ]]; then |
| 72 | + gh_output=$(gh api repos/espressif/arduino-esp32/commits/"$GITHUB_SHA" --jq '.files[].filename') |
| 73 | +else |
| 74 | + gh_output=$(gh pr diff "$PR_NUM" --name-only) |
| 75 | +fi |
| 76 | +echo "gh_output: $gh_output" |
| 77 | + |
| 78 | +# Output the results |
| 79 | +check_files "${core_files[@]}" |
| 80 | +CORE_CHANGED=$last_check_result |
| 81 | +check_files "${library_files[@]}" |
| 82 | +LIB_CHANGED=$last_check_result |
| 83 | +LIB_FILES=$last_check_files |
| 84 | +check_files "${networking_files[@]}" |
| 85 | +NETWORKING_CHANGED=$last_check_result |
| 86 | +check_files "${fs_files[@]}" |
| 87 | +FS_CHANGED=$last_check_result |
| 88 | +check_files "${static_sketches_files[@]}" |
| 89 | +STATIC_SKETCHES_CHANGED=$last_check_result |
| 90 | +check_files "${idf_files[@]}" |
| 91 | +IDF_CHANGED=$last_check_result |
5 | 92 |
|
6 | 93 | if [[ $CORE_CHANGED == 'true' ]] || [[ $IS_PR != 'true' ]]; then
|
7 | 94 | echo "Core files changed or not a PR. Building all."
|
@@ -76,9 +163,9 @@ chunks+="]"
|
76 | 163 |
|
77 | 164 | {
|
78 | 165 | echo "build_all=$build_all"
|
79 |
| - echo "build_libraries=$BUILD_LIBRARIES" |
80 |
| - echo "build_static_sketches=$BUILD_STATIC_SKETCHES" |
81 |
| - echo "build_idf=$BUILD_IDF" |
| 166 | + echo "build_libraries=$LIB_CHANGED" |
| 167 | + echo "build_static_sketches=$STATIC_SKETCHES_CHANGED" |
| 168 | + echo "build_idf=$IDF_CHANGED" |
82 | 169 | echo "chunk_count=$chunks_count"
|
83 | 170 | echo "chunks=$chunks"
|
84 | 171 | } >> "$GITHUB_OUTPUT"
|
0 commit comments