Skip to content

Commit 0dc9ae4

Browse files
authored
Merge branch 'espressif:master' into ble_fix
2 parents 46ef06e + 855f526 commit 0dc9ae4

File tree

113 files changed

+5596
-1690
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+5596
-1690
lines changed

Diff for: .github/ISSUE_TEMPLATE/Issue-report.yml

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ body:
4141
options:
4242
- latest master (checkout manually)
4343
- latest development Release Candidate (RC-X)
44+
- v2.0.9
45+
- v2.0.8
4446
- v2.0.7
4547
- v2.0.6
4648
- v2.0.5

Diff for: .github/scripts/find_all_boards.sh

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
# Get all boards
4+
boards_array=()
5+
6+
for line in `grep '.tarch=' boards.txt`; do
7+
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1)
8+
boards_array+=("espressif:esp32:$board_name")
9+
echo "Added 'espressif:esp32:$board_name' to array"
10+
done
11+
12+
# Create JSON like string with all boards found and pass it to env variable
13+
board_count=${#boards_array[@]}
14+
echo "Boards found: $board_count"
15+
echo "BOARD-COUNT=$board_count" >> $GITHUB_ENV
16+
17+
if [ $board_count -gt 0 ]
18+
then
19+
json_matrix='['
20+
for board in ${boards_array[@]}
21+
do
22+
json_matrix+='"'$board'"'
23+
if [ $board_count -gt 1 ]
24+
then
25+
json_matrix+=","
26+
fi
27+
board_count=$(($board_count - 1))
28+
done
29+
json_matrix+=']'
30+
31+
echo $json_matrix
32+
echo "FQBNS=${json_matrix}" >> $GITHUB_ENV
33+
else
34+
echo "FQBNS=" >> $GITHUB_ENV
35+
fi

Diff for: .github/scripts/find_new_boards.sh

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/bin/bash
2+
3+
# Get inputs from command
4+
owner_repository=$1
5+
pr_number=$2
6+
7+
url="https://api.github.com/repos/$owner_repository/pulls/$pr_number/files"
8+
echo $url
9+
10+
# Get changes in boards.txt file from PR
11+
Patch=$(curl $url | jq -r '.[] | select(.filename == "boards.txt") | .patch ')
12+
13+
# Extract only changed lines number and count
14+
substring_patch=$(echo "$Patch" | grep -o '@@[^@]*@@')
15+
16+
params_array=()
17+
18+
IFS=$'\n' read -d '' -ra params <<< $(echo "$substring_patch" | grep -oE '[-+][0-9]+,[0-9]+')
19+
20+
for param in "${params[@]}"
21+
do
22+
echo "The parameter is $param"
23+
params_array+=("$param")
24+
done
25+
26+
boards_array=()
27+
previous_board=""
28+
file="boards.txt"
29+
30+
# Loop through boards.txt file and extract all boards that were added
31+
for (( c=0; c<${#params_array[@]}; c+=2 ))
32+
do
33+
deletion_count=$( echo "${params_array[c]}" | cut -d',' -f2 | cut -d' ' -f1 )
34+
addition_line=$( echo "${params_array[c+1]}" | cut -d'+' -f2 | cut -d',' -f1 )
35+
addition_count=$( echo "${params_array[c+1]}" | cut -d'+' -f2 | cut -d',' -f2 | cut -d' ' -f1 )
36+
addition_end=$(($addition_line+$addition_count))
37+
38+
addition_line=$(($addition_line + 3))
39+
addition_end=$(($addition_end - $deletion_count))
40+
41+
echo $addition_line
42+
echo $addition_end
43+
44+
i=0
45+
46+
while read -r line
47+
do
48+
i=$((i+1))
49+
if [ $i -lt $addition_line ]
50+
then
51+
continue
52+
elif [ $i -gt $addition_end ]
53+
then
54+
break
55+
fi
56+
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1)
57+
if [ "$board_name" != "" ]
58+
then
59+
if [ "$board_name" != "$previous_board" ]
60+
then
61+
boards_array+=("espressif:esp32:$board_name")
62+
previous_board="$board_name"
63+
echo "Added 'espressif:esp32:$board_name' to array"
64+
fi
65+
fi
66+
done < "$file"
67+
done
68+
69+
# Create JSON like string with all boards found and pass it to env variable
70+
board_count=${#boards_array[@]}
71+
72+
if [ $board_count -gt 0 ]
73+
then
74+
json_matrix='{"fqbn": ['
75+
for board in ${boards_array[@]}
76+
do
77+
json_matrix+='"'$board'"'
78+
if [ $board_count -gt 1 ]
79+
then
80+
json_matrix+=","
81+
fi
82+
board_count=$(($board_count - 1))
83+
done
84+
json_matrix+=']}'
85+
86+
echo $json_matrix
87+
echo "FQBNS=${json_matrix}" >> $GITHUB_ENV
88+
else
89+
echo "FQBNS=" >> $GITHUB_ENV
90+
fi

Diff for: .github/scripts/sketch_utils.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -117,26 +117,27 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
117117
# 3. Created at the sketch level as "buildX" where X is the number
118118
# of configuration built in case of a multiconfiguration test.
119119

120+
sketchname=$(basename $sketchdir)
121+
120122
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
121123
if [ -n "$ARDUINO_BUILD_DIR" ]; then
122124
build_dir="$ARDUINO_BUILD_DIR"
123125
elif [ $len -eq 1 ]; then
124126
# build_dir="$sketchdir/build"
125-
build_dir="$HOME/.arduino/build.tmp"
127+
build_dir="$HOME/.arduino/tests/$sketchname/build.tmp"
126128
fi
127129

128130
mkdir -p "$ARDUINO_CACHE_DIR"
129131
for i in `seq 0 $(($len - 1))`
130132
do
131133
if [ $len -ne 1 ]; then
132134
# build_dir="$sketchdir/build$i"
133-
build_dir="$HOME/.arduino/build$i.tmp"
135+
build_dir="$HOME/.arduino/tests/$sketchname/build$i.tmp"
134136
fi
135137
rm -rf $build_dir
136138
mkdir -p $build_dir
137139

138140
currfqbn=`echo $fqbn | jq -r --argjson i $i '.[$i]'`
139-
sketchname=$(basename $sketchdir)
140141

141142
if [ -f "$ide_path/arduino-cli" ]; then
142143
echo "Building $sketchname with arduino-cli and FQBN=$currfqbn"
@@ -152,6 +153,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
152153
$xtra_opts "${sketchdir}"
153154
elif [ -f "$ide_path/arduino-builder" ]; then
154155
echo "Building $sketchname with arduino-builder and FQBN=$currfqbn"
156+
echo "Build path = $build_dir"
155157

156158
$ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \
157159
-fqbn=\"$currfqbn\" \

Diff for: .github/scripts/tests_run.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ function run_test() {
1515
fi
1616

1717
if [ $len -eq 1 ]; then
18-
build_dir="tests/$sketchname/build"
18+
# build_dir="tests/$sketchname/build"
19+
build_dir="$HOME/.arduino/tests/$sketchname/build.tmp"
1920
report_file="tests/$sketchname/$sketchname.xml"
2021
fi
2122

@@ -27,7 +28,8 @@ function run_test() {
2728
fi
2829

2930
if [ $len -ne 1 ]; then
30-
build_dir="tests/$sketchname/build$i"
31+
# build_dir="tests/$sketchname/build$i"
32+
build_dir="$HOME/.arduino/tests/$sketchname/build$i.tmp"
3133
report_file="tests/$sketchname/$sketchname$i.xml"
3234
fi
3335

Diff for: .github/workflows/allboards.yml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Boards Test - Remote trigger
2+
3+
# The workflow will run on remote dispath with event-type set to "test-boards"
4+
on:
5+
repository_dispatch:
6+
types: [test-boards]
7+
8+
jobs:
9+
find-boards:
10+
runs-on: ubuntu-latest
11+
12+
outputs:
13+
fqbns: ${{ env.FQBNS }}
14+
board-count: ${{ env.BOARD-COUNT }}
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
with:
20+
ref: ${{ github.event.client_payload.branch }}
21+
22+
- name: Get boards fqbns
23+
run:
24+
bash .github/scripts/find_all_boards.sh
25+
26+
setup-chunks:
27+
needs: find-boards
28+
runs-on: ubuntu-latest
29+
if: needs.find-boards.outputs.fqbns != ''
30+
31+
outputs:
32+
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}
33+
34+
steps:
35+
- uses: actions/checkout@v3
36+
- run: npm install
37+
- name: Setup jq
38+
uses: dcarbone/[email protected]
39+
40+
- id: set-test-chunks
41+
name: Set Chunks
42+
run:
43+
echo "test-chunks<<EOF" >> $GITHUB_OUTPUT
44+
45+
echo "$( jq -nc '${{ needs.find-boards.outputs.fqbns }} | [_nwise( ${{ needs.find-boards.outputs.board-count }}/15 | ceil)]')" >> $GITHUB_OUTPUT
46+
47+
echo "EOF" >> $GITHUB_OUTPUT
48+
49+
test-boards:
50+
needs: setup-chunks
51+
runs-on: ubuntu-latest
52+
53+
env:
54+
REPOSITORY: |
55+
- source-path: '.'
56+
name: "espressif:esp32"
57+
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
chunk: ${{ fromJSON(needs.setup-chunks.outputs['test-chunks']) }}
62+
63+
steps:
64+
- name: Checkout repository
65+
uses: actions/checkout@v3
66+
67+
- name: Echo FQBNS to file
68+
run:
69+
echo "$FQBN" > fqbns.json
70+
env:
71+
FQBN: ${{ toJSON(matrix.chunk) }}
72+
73+
- name: Compile sketch
74+
uses: P-R-O-C-H-Y/compile-sketches@main
75+
with:
76+
platforms: |
77+
${{ env.REPOSITORY }}
78+
multiple-fqbn: true
79+
multiple-fqbn-path: "fqbns.json"
80+
use-json-file: false
81+
enable-deltas-report: false
82+
enable-warnings-report: false
83+
cli-compile-flags: |
84+
- --warnings="all"
85+
sketch-paths:
86+
"- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"

Diff for: .github/workflows/boards.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Boards Test
2+
3+
# The workflow will run on schedule and labeled pull requests
4+
on:
5+
pull_request:
6+
7+
env:
8+
# It's convenient to set variables for values used multiple times in the workflow
9+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
10+
11+
jobs:
12+
find-boards:
13+
runs-on: ubuntu-latest
14+
15+
outputs:
16+
fqbns: ${{ env.FQBNS }}
17+
18+
steps:
19+
# This step makes the contents of the repository available to the workflow
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
23+
- name: Setup jq
24+
uses: dcarbone/[email protected]
25+
26+
- name: Get board name
27+
run:
28+
bash .github/scripts/find_new_boards.sh ${{ github.repository }} ${{github.event.number}}
29+
30+
test-boards:
31+
needs: find-boards
32+
runs-on: ubuntu-latest
33+
if: needs.find-boards.outputs.fqbns != ''
34+
35+
env:
36+
REPOSITORY: |
37+
- source-path: '.'
38+
name: "espressif:esp32"
39+
40+
strategy:
41+
matrix: ${{ fromJson(needs.find-boards.outputs.fqbns) }}
42+
43+
steps:
44+
# This step makes the contents of the repository available to the workflow
45+
- name: Checkout repository
46+
uses: actions/checkout@v3
47+
48+
- name: Compile sketch
49+
uses: P-R-O-C-H-Y/compile-sketches@main
50+
with:
51+
platforms: |
52+
${{ env.REPOSITORY }}
53+
fqbn: ${{ matrix.fqbn }}
54+
use-json-file: false
55+
enable-deltas-report: false
56+
enable-warnings-report: false
57+
cli-compile-flags: |
58+
- --warnings="all"
59+
exit-on-fail: true
60+
sketch-paths:
61+
"- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"

0 commit comments

Comments
 (0)