Skip to content

Commit

Permalink
Merge branch 'master' into release/v3.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
me-no-dev authored Oct 23, 2024
2 parents 5042912 + 4285912 commit ebe34f6
Show file tree
Hide file tree
Showing 27 changed files with 298 additions and 134 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ indent_size = 2
indent_style = space

[*.{bash,sh}]
indent_size = 2
indent_size = 4
indent_style = space

[*.{c,cc,cp,cpp,cxx,h,hh,hpp,hxx,ii,inl,ino,ixx,pde,tpl,tpp,txx}]
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/Issue-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ body:
options:
- latest master (checkout manually)
- latest development Release Candidate (RC-X)
- v3.0.6
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
Expand Down
54 changes: 16 additions & 38 deletions .github/scripts/find_new_boards.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,32 @@ url="https://api.github.com/repos/$owner_repository/pulls/$pr_number/files"
echo $url

# Get changes in boards.txt file from PR
Patch=$(curl $url | jq -r '.[] | select(.filename == "boards.txt") | .patch ')
Boards_modified_url=$(curl -s $url | jq -r '.[] | select(.filename == "boards.txt") | .raw_url')

# Extract only changed lines number and count
substring_patch=$(echo "$Patch" | grep -o '@@[^@]*@@')
# Echo the modified boards.txt file URL
echo "Modified boards.txt file URL:"
echo $Boards_modified_url

params_array=()
# Download the modified boards.txt file
curl -L -o boards_pr.txt $Boards_modified_url

IFS=$'\n' read -d '' -ra params <<< $(echo "$substring_patch" | grep -oE '[-+][0-9]+,[0-9]+')
# Compare boards.txt file in the repo with the modified file
diff=$(diff -u boards.txt boards_pr.txt)

for param in "${params[@]}"
do
echo "The parameter is $param"
params_array+=("$param")
done
# Extract added or modified lines (lines starting with '+' or '-')
modified_lines=$(echo "$diff" | grep -E '^[+-][^+-]')

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 +42,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
42 changes: 38 additions & 4 deletions .github/scripts/install-platformio-esp32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ function count_sketches(){ # count_sketches <examples-path>
continue
fi

# Check if the sketch requires any configuration options
# Check if the sketch requires any configuration options (AND)
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then
for requirement in $requirements; do
requirement=$(echo $requirement | xargs)
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
Expand All @@ -107,6 +107,23 @@ function count_sketches(){ # count_sketches <examples-path>
fi
done
fi

# Check if the sketch requires any configuration options (OR)
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then
found=false
for requirement in $requirements_or; do
requirement=$(echo $requirement | xargs)
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
if [[ "$found_line" != "" ]]; then
found=true
break
fi
done
if [[ "$found" == "false" ]]; then
continue
fi
fi
fi

echo $sketch >> sketches.txt
Expand Down Expand Up @@ -187,9 +204,9 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-
continue
fi

# Check if the sketch requires any configuration options
# Check if the sketch requires any configuration options (AND)
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then
for requirement in $requirements; do
requirement=$(echo $requirement | xargs)
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
Expand All @@ -198,6 +215,23 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-
fi
done
fi

# Check if the sketch requires any configuration options (OR)
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then
found=false
for requirement in $requirements_or; do
requirement=$(echo $requirement | xargs)
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")
if [[ "$found_line" != "" ]]; then
found=true
break
fi
done
if [[ "$found" == "false" ]]; then
continue
fi
fi
fi

sketchnum=$(($sketchnum + 1))
Expand Down
79 changes: 61 additions & 18 deletions .github/scripts/sketch_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,34 +98,42 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex

# Default FQBN options if none were passed in the command line.

esp32_opts="PSRAM=enabled,FlashMode=dio${fqbn_append:+,$fqbn_append}"
esp32s2_opts="PSRAM=enabled,FlashMode=dio${fqbn_append:+,$fqbn_append}"
esp32s3_opts="PSRAM=opi,USBMode=default,FlashMode=dio${fqbn_append:+,$fqbn_append}"
esp32c3_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}"
esp32c6_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}"
esp32h2_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}"
esp32_opts="PSRAM=enabled${fqbn_append:+,$fqbn_append}"
esp32s2_opts="PSRAM=enabled${fqbn_append:+,$fqbn_append}"
esp32s3_opts="PSRAM=opi,USBMode=default${fqbn_append:+,$fqbn_append}"
esp32c3_opts="$fqbn_append"
esp32c6_opts="$fqbn_append"
esp32h2_opts="$fqbn_append"

# Select the common part of the FQBN based on the target. The rest will be
# appended depending on the passed options.

opt=""

case "$target" in
"esp32")
fqbn="espressif:esp32:esp32:${options:-$esp32_opts}"
[ -n "${options:-$esp32_opts}" ] && opt=":${options:-$esp32_opts}"
fqbn="espressif:esp32:esp32$opt"
;;
"esp32s2")
fqbn="espressif:esp32:esp32s2:${options:-$esp32s2_opts}"
[ -n "${options:-$esp32s2_opts}" ] && opt=":${options:-$esp32s2_opts}"
fqbn="espressif:esp32:esp32s2$opt"
;;
"esp32c3")
fqbn="espressif:esp32:esp32c3:${options:-$esp32c3_opts}"
[ -n "${options:-$esp32c3_opts}" ] && opt=":${options:-$esp32c3_opts}"
fqbn="espressif:esp32:esp32c3$opt"
;;
"esp32s3")
fqbn="espressif:esp32:esp32s3:${options:-$esp32s3_opts}"
[ -n "${options:-$esp32s3_opts}" ] && opt=":${options:-$esp32s3_opts}"
fqbn="espressif:esp32:esp32s3$opt"
;;
"esp32c6")
fqbn="espressif:esp32:esp32c6:${options:-$esp32c6_opts}"
[ -n "${options:-$esp32c6_opts}" ] && opt=":${options:-$esp32c6_opts}"
fqbn="espressif:esp32:esp32c6$opt"
;;
"esp32h2")
fqbn="espressif:esp32:esp32h2:${options:-$esp32h2_opts}"
[ -n "${options:-$esp32h2_opts}" ] && opt=":${options:-$esp32h2_opts}"
fqbn="espressif:esp32:esp32h2$opt"
;;
esac

Expand Down Expand Up @@ -163,9 +171,9 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
exit 0
fi

# Check if the sketch requires any configuration options
# Check if the sketch requires any configuration options (AND)
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then
for requirement in $requirements; do
requirement=$(echo $requirement | xargs)
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/$target/sdkconfig")
Expand All @@ -175,6 +183,24 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
fi
done
fi

# Check if the sketch excludes any configuration options (OR)
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then
found=false
for requirement in $requirements_or; do
requirement=$(echo $requirement | xargs)
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/$target/sdkconfig")
if [[ "$found_line" != "" ]]; then
found=true
break
fi
done
if [[ "$found" == "false" ]]; then
echo "Target $target meets none of the requirements in requires_any for $sketchname. Skipping."
exit 0
fi
fi
fi

ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
Expand Down Expand Up @@ -213,9 +239,9 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
--build-cache-path "$ARDUINO_CACHE_DIR" \
--build-path "$build_dir" \
$xtra_opts "${sketchdir}" \
> $output_file
2>&1 | tee $output_file

exit_status=$?
exit_status=${PIPESTATUS[0]}
if [ $exit_status -ne 0 ]; then
echo "ERROR: Compilation failed with error code $exit_status"
exit $exit_status
Expand Down Expand Up @@ -322,9 +348,9 @@ function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requi
fi

if [ "$ignore_requirements" != "1" ]; then
# Check if the sketch requires any configuration options
# Check if the sketch requires any configuration options (AND)
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then
for requirement in $requirements; do
requirement=$(echo $requirement | xargs)
found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig)
Expand All @@ -333,6 +359,23 @@ function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requi
fi
done
fi

# Check if the sketch excludes any configuration options (OR)
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then
found=false
for requirement in $requirements_or; do
requirement=$(echo $requirement | xargs)
found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig)
if [[ "$found_line" != "" ]]; then
found=true
break
fi
done
if [[ "$found" == "false" ]]; then
continue 2
fi
fi
fi
fi
echo $sketch >> sketches.txt
Expand Down
26 changes: 26 additions & 0 deletions .github/scripts/tests_matrix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

build_types="'validation'"
hw_types="'validation'"
wokwi_types="'validation'"
qemu_types="'validation'"

if [[ $IS_PR != 'true' ]] || [[ $PERFORMANCE_ENABLED == 'true' ]]; then
build_types+=",'performance'"
hw_types+=",'performance'"
#wokwi_types+=",'performance'"
#qemu_types+=",'performance'"
fi

targets="'esp32','esp32s2','esp32s3','esp32c3','esp32c6','esp32h2'"

mkdir -p info

echo "[$wokwi_types]" > info/wokwi_types.txt
echo "[$targets]" > info/targets.txt

echo "build-types=[$build_types]" >> $GITHUB_OUTPUT
echo "hw-types=[$hw_types]" >> $GITHUB_OUTPUT
echo "wokwi-types=[$wokwi_types]" >> $GITHUB_OUTPUT
echo "qemu-types=[$qemu_types]" >> $GITHUB_OUTPUT
echo "targets=[$targets]" >> $GITHUB_OUTPUT
23 changes: 21 additions & 2 deletions .github/scripts/tests_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ function run_test() {
return 0
fi

# Check if the sketch requires any configuration options
# Check if the sketch requires any configuration options (AND)
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)
if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then
for requirement in $requirements; do
requirement=$(echo $requirement | xargs)
found_line=$(grep -E "^$requirement" "$SDKCONFIG_PATH")
Expand All @@ -49,6 +49,25 @@ function run_test() {
fi
done
fi

# Check if the sketch requires any configuration options (OR)
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then
found=false
for requirement in $requirements_or; do
requirement=$(echo $requirement | xargs)
found_line=$(grep -E "^$requirement" "$SDKCONFIG_PATH")
if [[ "$found_line" != "" ]]; then
found=true
break
fi
done
if [[ "$found" == "false" ]]; then
printf "\033[93mTarget $target meets none of the requirements in requires_any for $sketchname. Skipping.\033[0m\n"
printf "\n\n\n"
return 0
fi
fi
fi

if [ $len -eq 1 ]; then
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/dangerjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ jobs:
- name: DangerJS pull request linter
uses: espressif/shared-github-dangerjs@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
rule-max-commits: 'false'
commit-messages-min-summary-length: '10'
Loading

0 comments on commit ebe34f6

Please sign in to comment.