Skip to content

Commit

Permalink
Merge branch 'master' into release/v3.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
me-no-dev authored Oct 23, 2024
2 parents 6e88445 + 3502b9c commit 3554927
Show file tree
Hide file tree
Showing 23 changed files with 2,463 additions and 50 deletions.
67 changes: 23 additions & 44 deletions .github/scripts/find_new_boards.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,39 @@

# Get inputs from command
owner_repository=$1
pr_number=$2
base_ref=$2

url="https://api.github.com/repos/$owner_repository/pulls/$pr_number/files"
echo $url
# Download the boards.txt file from the base branch
curl -L -o boards_base.txt https://raw.githubusercontent.com/$owner_repository/$base_ref/boards.txt

# Get changes in boards.txt file from PR
Patch=$(curl $url | jq -r '.[] | select(.filename == "boards.txt") | .patch ')
# Compare boards.txt file in the repo with the modified file from PR
diff=$(diff -u boards_base.txt boards.txt)

# Extract only changed lines number and count
substring_patch=$(echo "$Patch" | grep -o '@@[^@]*@@')

params_array=()
# Check if the diff is empty
if [ -z "$diff" ]
then
echo "No changes in boards.txt file"
echo "FQBNS="
exit 0
fi

IFS=$'\n' read -d '' -ra params <<< $(echo "$substring_patch" | grep -oE '[-+][0-9]+,[0-9]+')
# Extract added or modified lines (lines starting with '+' or '-')
modified_lines=$(echo "$diff" | grep -E '^[+-][^+-]')

for param in "${params[@]}"
do
echo "The parameter is $param"
params_array+=("$param")
done
# Print the modified lines for debugging
echo "Modified lines:"
echo "$modified_lines"

boards_array=()
previous_board=""
file="boards.txt"

# Loop through boards.txt file and extract all boards that were added
for (( c=0; c<${#params_array[@]}; c+=2 ))
# Extract board names from the modified lines, and add them to the boards_array
while read -r line
do
deletion_count=$( echo "${params_array[c]}" | cut -d',' -f2 | cut -d' ' -f1 )
addition_line=$( echo "${params_array[c+1]}" | cut -d'+' -f2 | cut -d',' -f1 )
addition_count=$( echo "${params_array[c+1]}" | cut -d'+' -f2 | cut -d',' -f2 | cut -d' ' -f1 )
addition_end=$(($addition_line+$addition_count))

addition_line=$(($addition_line + 3))
addition_end=$(($addition_end - $deletion_count))

echo $addition_line
echo $addition_end

i=0

while read -r line
do
i=$((i+1))
if [ $i -lt $addition_line ]
then
continue
elif [ $i -gt $addition_end ]
then
break
fi
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1)
if [ "$board_name" != "" ] && [ "$board_name" != "esp32_family" ]
# remove + or - from the board name at the beginning
board_name=$(echo "$board_name" | sed 's/^[+-]//')
if [ "$board_name" != "" ] && [ "$board_name" != "+" ] && [ "$board_name" != "-" ] && [ "$board_name" != "esp32_family" ]
then
if [ "$board_name" != "$previous_board" ]
then
Expand All @@ -63,8 +43,7 @@ do
echo "Added 'espressif:esp32:$board_name' to array"
fi
fi
done < "$file"
done
done <<< "$modified_lines"

# Create JSON like string with all boards found and pass it to env variable
board_count=${#boards_array[@]}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/boards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- name: Get board name
run:
bash .github/scripts/find_new_boards.sh ${{ github.repository }} ${{github.event.number}}
bash .github/scripts/find_new_boards.sh ${{ github.repository }} ${{github.base_ref}}

test-boards:
needs: find-boards
Expand All @@ -42,6 +42,7 @@ jobs:
name: "espressif:esp32"
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.find-boards.outputs.fqbns) }}

steps:
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,20 @@ on:
- 'idf_component.yml'
- 'Kconfig.projbuild'
- 'package.json'
- 'CMakeLists.txt'
- '.github/workflows/push.yml'
- '.github/scripts/**'
- '!.github/scripts/find_*'
- '!.github/scripts/on-release.sh'
- '!.github/scripts/tests_*'
- '!.github/scripts/upload_*'
- "variants/esp32/**/*"
- "variants/esp32s2/**/*"
- "variants/esp32s3/**/*"
- "variants/esp32c2/**/*"
- "variants/esp32c3/**/*"
- "variants/esp32c6/**/*"
- "variants/esp32h2/**/*"

concurrency:
group: build-${{github.event.pull_request.number || github.ref}}
Expand Down Expand Up @@ -74,6 +82,12 @@ jobs:
- '!tools/platformio-build.py'
- 'platform.txt'
- 'programmers.txt'
- "variants/esp32/**/*"
- "variants/esp32s2/**/*"
- "variants/esp32s3/**/*"
- "variants/esp32c3/**/*"
- "variants/esp32c6/**/*"
- "variants/esp32h2/**/*"
libraries:
- 'libraries/**/examples/**'
- 'libraries/**/src/**'
Expand All @@ -92,6 +106,8 @@ jobs:
idf:
- 'idf_component.yml'
- 'Kconfig.projbuild'
- 'CMakeLists.txt'
- "variants/esp32c2/**/*"
platformio:
- 'package.json'
- '.github/scripts/install-platformio-esp32.sh'
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ set(ARDUINO_LIBRARY_HTTPUpdate_SRCS libraries/HTTPUpdate/src/HTTPUpdate.cpp)
set(ARDUINO_LIBRARY_Insights_SRCS libraries/Insights/src/Insights.cpp)

set(ARDUINO_LIBRARY_LittleFS_SRCS libraries/LittleFS/src/LittleFS.cpp)
set(ARDUINO_LIBRARY_LittleFS_REQUIRES joltwallet__littlefs)

set(ARDUINO_LIBRARY_NetBIOS_SRCS libraries/NetBIOS/src/NetBIOS.cpp)

Expand Down
Loading

0 comments on commit 3554927

Please sign in to comment.