Skip to content

Commit 585ac00

Browse files
authored
Merge branch 'master' into ADD-Boards
2 parents 98ff77a + e509d33 commit 585ac00

21 files changed

+167
-102
lines changed

.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+
- v3.0.6
45+
- v3.0.5
4446
- v3.0.4
4547
- v3.0.3
4648
- v3.0.2

.github/scripts/find_new_boards.sh

+16-38
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,32 @@ url="https://api.github.com/repos/$owner_repository/pulls/$pr_number/files"
88
echo $url
99

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

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

16-
params_array=()
17+
# Download the modified boards.txt file
18+
curl -L -o boards_pr.txt $Boards_modified_url
1719

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

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

2626
boards_array=()
2727
previous_board=""
2828
file="boards.txt"
2929

30-
# Loop through boards.txt file and extract all boards that were added
31-
for (( c=0; c<${#params_array[@]}; c+=2 ))
30+
# Extract board names from the modified lines, and add them to the boards_array
31+
while read -r line
3232
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
5633
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1)
57-
if [ "$board_name" != "" ] && [ "$board_name" != "esp32_family" ]
34+
# remove + or - from the board name at the beginning
35+
board_name=$(echo "$board_name" | sed 's/^[+-]//')
36+
if [ "$board_name" != "" ] && [ "$board_name" != "+" ] && [ "$board_name" != "-" ] && [ "$board_name" != "esp32_family" ]
5837
then
5938
if [ "$board_name" != "$previous_board" ]
6039
then
@@ -63,8 +42,7 @@ do
6342
echo "Added 'espressif:esp32:$board_name' to array"
6443
fi
6544
fi
66-
done < "$file"
67-
done
45+
done <<< "$modified_lines"
6846

6947
# Create JSON like string with all boards found and pass it to env variable
7048
board_count=${#boards_array[@]}

.github/scripts/tests_matrix.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
build_types="'validation'"
4+
hw_types="'validation'"
5+
wokwi_types="'validation'"
6+
qemu_types="'validation'"
7+
8+
if [[ $IS_PR != 'true' ]] || [[ $PERFORMANCE_ENABLED == 'true' ]]; then
9+
build_types+=",'performance'"
10+
hw_types+=",'performance'"
11+
#wokwi_types+=",'performance'"
12+
#qemu_types+=",'performance'"
13+
fi
14+
15+
targets="'esp32','esp32s2','esp32s3','esp32c3','esp32c6','esp32h2'"
16+
17+
mkdir -p info
18+
19+
echo "[$wokwi_types]" > info/wokwi_types.txt
20+
echo "[$targets]" > info/targets.txt
21+
22+
echo "build-types=[$build_types]" >> $GITHUB_OUTPUT
23+
echo "hw-types=[$hw_types]" >> $GITHUB_OUTPUT
24+
echo "wokwi-types=[$wokwi_types]" >> $GITHUB_OUTPUT
25+
echo "qemu-types=[$qemu_types]" >> $GITHUB_OUTPUT
26+
echo "targets=[$targets]" >> $GITHUB_OUTPUT

.github/workflows/dangerjs.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ jobs:
1919
- name: DangerJS pull request linter
2020
uses: espressif/shared-github-dangerjs@v1
2121
env:
22-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
rule-max-commits: 'false'
24+
commit-messages-min-summary-length: '10'

.github/workflows/tests.yml

+17-21
Original file line numberDiff line numberDiff line change
@@ -57,29 +57,25 @@ jobs:
5757
hw-types: ${{ steps.set-matrix.outputs.hw-types }}
5858
wokwi-types: ${{ steps.set-matrix.outputs.wokwi-types }}
5959
qemu-types: ${{ steps.set-matrix.outputs.qemu-types }}
60+
targets: ${{ steps.set-matrix.outputs.targets }}
61+
env:
62+
IS_PR: ${{ github.event.pull_request.number != null }}
63+
PERFORMANCE_ENABLED: ${{ contains(github.event.pull_request.labels.*.name, 'perf_test') }}
6064
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v4
67+
with:
68+
sparse-checkout: .github/scripts/tests_matrix.sh
69+
6170
- name: Set matrix
6271
id: set-matrix
63-
run: |
64-
build_types='["validation"'
65-
hw_types='["validation"'
66-
wokwi_types='["validation"'
67-
qemu_types='["validation"'
68-
69-
is_pr=${{ github.event.pull_request.number != null }}
70-
is_performance_enabled=${{ contains(github.event.pull_request.labels.*.name, 'perf_test') }}
71-
72-
if [[ $is_pr != 'true' ]] || [[ $is_performance_enabled == 'true' ]]; then
73-
build_types+=',"performance"'
74-
hw_types+=',"performance"'
75-
#wokwi_types+=',"performance"'
76-
#qemu_types+=',"performance"'
77-
fi
72+
run: bash .github/scripts/tests_matrix.sh
7873

79-
echo "build-types=$build_types]" >> $GITHUB_OUTPUT
80-
echo "hw-types=$hw_types]" >> $GITHUB_OUTPUT
81-
echo "wokwi-types=$wokwi_types]" >> $GITHUB_OUTPUT
82-
echo "qemu-types=$qemu_types]" >> $GITHUB_OUTPUT
74+
- name: Upload
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: matrix_info
78+
path: info/*
8379

8480
call-build-tests:
8581
name: Build
@@ -88,7 +84,7 @@ jobs:
8884
strategy:
8985
matrix:
9086
type: ${{ fromJson(needs.gen-matrix.outputs.build-types) }}
91-
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
87+
chip: ${{ fromJson(needs.gen-matrix.outputs.targets) }}
9288
with:
9389
type: ${{ matrix.type }}
9490
chip: ${{ matrix.chip }}
@@ -105,7 +101,7 @@ jobs:
105101
fail-fast: false
106102
matrix:
107103
type: ${{ fromJson(needs.gen-matrix.outputs.hw-types) }}
108-
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
104+
chip: ${{ fromJson(needs.gen-matrix.outputs.targets) }}
109105
with:
110106
type: ${{ matrix.type }}
111107
chip: ${{ matrix.chip }}

.github/workflows/tests_results.yml

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
event_name: ${{ env.original_event }}
8080
files: ./artifacts/**/*.xml
8181
action_fail: true
82+
compare_to_earlier_commit: false
8283

8384
- name: Fail if tests failed
8485
if: ${{ env.original_conclusion == 'failure' || env.original_conclusion == 'timed_out' || github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out' }}

.github/workflows/tests_wokwi.yml

+32-4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
outputs:
2323
pr_num: ${{ steps.set-ref.outputs.pr_num }}
2424
ref: ${{ steps.set-ref.outputs.ref }}
25+
base: ${{ steps.set-ref.outputs.base }}
26+
targets: ${{ steps.set-ref.outputs.targets }}
27+
types: ${{ steps.set-ref.outputs.types }}
2528
steps:
2629
- name: Report pending
2730
uses: actions/github-script@v7
@@ -51,10 +54,18 @@ jobs:
5154
name: event_file
5255
path: artifacts/event_file
5356

57+
- name: Download and extract matrix info
58+
uses: actions/download-artifact@v4
59+
with:
60+
github-token: ${{ secrets.GITHUB_TOKEN }}
61+
run-id: ${{ github.event.workflow_run.id }}
62+
name: matrix_info
63+
path: artifacts/matrix_info
64+
5465
- name: Try to read PR number
5566
id: set-ref
5667
run: |
57-
pr_num=$(jq -r '.pull_request.number' artifacts/event_file/event.json)
68+
pr_num=$(jq -r '.pull_request.number' artifacts/event_file/event.json | tr -cd "[:digit:]")
5869
if [ -z "$pr_num" ] || [ "$pr_num" == "null" ]; then
5970
pr_num=""
6071
fi
@@ -64,11 +75,22 @@ jobs:
6475
ref=${{ github.ref }}
6576
fi
6677
67-
action=$(jq -r '.action' artifacts/event_file/event.json)
78+
action=$(jq -r '.action' artifacts/event_file/event.json | tr -cd "[:alpha:]_")
6879
if [ "$action" == "null" ]; then
6980
action=""
7081
fi
7182
83+
base=$(jq -r '.pull_request.base.ref' artifacts/event_file/event.json | tr -cd "[:alnum:]/_.-")
84+
if [ -z "$base" ] || [ "$base" == "null" ]; then
85+
base=${{ github.ref }}
86+
fi
87+
88+
types=$(cat artifacts/matrix_info/wokwi_types.txt | tr -cd "[:alpha:],[]'")
89+
targets=$(cat artifacts/matrix_info/targets.txt | tr -cd "[:alnum:],[]'")
90+
91+
echo "base = $base"
92+
echo "targets = $targets"
93+
echo "types = $types"
7294
echo "pr_num = $pr_num"
7395
7496
printf "$ref" >> artifacts/ref.txt
@@ -98,6 +120,9 @@ jobs:
98120
cat artifacts/conclusion.txt
99121
100122
echo "pr_num=$pr_num" >> $GITHUB_OUTPUT
123+
echo "base=$base" >> $GITHUB_OUTPUT
124+
echo "targets=$targets" >> $GITHUB_OUTPUT
125+
echo "types=$types" >> $GITHUB_OUTPUT
101126
echo "ref=$ref" >> $GITHUB_OUTPUT
102127
103128
- name: Download and extract parent hardware results
@@ -164,8 +189,8 @@ jobs:
164189
strategy:
165190
fail-fast: false
166191
matrix:
167-
type: ['validation']
168-
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6', 'esp32h2']
192+
type: ${{ fromJson(needs.get-artifacts.outputs.types) }}
193+
chip: ${{ fromJson(needs.get-artifacts.outputs.targets) }}
169194
steps:
170195
- name: Report pending
171196
uses: actions/github-script@v7
@@ -211,9 +236,12 @@ jobs:
211236
echo "enabled=$enabled" >> $GITHUB_OUTPUT
212237
213238
# Note that changes to the workflows and tests will only be picked up after the PR is merged
239+
# DO NOT CHECKOUT THE USER'S REPOSITORY IN THIS WORKFLOW. IT HAS HIGH SECURITY RISKS.
214240
- name: Checkout repository
215241
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
216242
uses: actions/checkout@v4
243+
with:
244+
ref: ${{ needs.get-artifacts.outputs.base || github.ref }}
217245

218246
- uses: actions/setup-python@v5
219247
if: ${{ steps.check-tests.outputs.enabled == 'true' }}

.pre-commit-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ repos:
2626
- id: trailing-whitespace
2727
args: [--markdown-linebreak-ext=md]
2828
- id: pretty-format-json
29+
stages: [manual]
2930
args: [--autofix]
3031
types_or: [json]
3132
exclude: |

tests/performance/coremark/coremark.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void setup() {
4040
Serial.printf("Cores: %d\n", CONFIG_SOC_CPU_CORES_NUM);
4141
Serial.flush();
4242
for (int i = 0; i < N_RUNS; i++) {
43-
Serial.printf("Run %d", i);
43+
Serial.printf("Run %d\n", i);
4444
coremark_main();
4545
Serial.flush();
4646
}

tests/performance/fibonacci/fibonacci.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void setup() {
3131
Serial.printf("N: %d\n", FIB_N);
3232
Serial.flush();
3333
for (int i = 0; i < N_RUNS; i++) {
34-
Serial.printf("Run %d", i);
34+
Serial.printf("Run %d\n", i);
3535
unsigned long start = millis();
3636
fibonacci = fib(FIB_N);
3737
unsigned long elapsed = millis() - start;

tests/performance/fibonacci/test_fibonacci.py

+18-16
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,22 @@
22
import logging
33
import os
44

5+
fib_results = {}
6+
7+
8+
def fib(n):
9+
if n < 2:
10+
return n
11+
elif str(n) in fib_results:
12+
return fib_results[str(n)]
13+
else:
14+
fib_results[str(n)] = fib(n - 1) + fib(n - 2)
15+
return fib_results[str(n)]
16+
517

618
def test_fibonacci(dut, request):
719
LOGGER = logging.getLogger(__name__)
820

9-
# Fibonacci results starting from fib(35) to fib(45)
10-
fib_results = [
11-
9227465,
12-
14930352,
13-
24157817,
14-
39088169,
15-
63245986,
16-
102334155,
17-
165580141,
18-
267914296,
19-
433494437,
20-
701408733,
21-
]
22-
2321
# Match "Runs: %d"
2422
res = dut.expect(r"Runs: (\d+)", timeout=60)
2523
runs = int(res.group(0).decode("utf-8").split(" ")[1])
@@ -30,7 +28,11 @@ def test_fibonacci(dut, request):
3028
res = dut.expect(r"N: (\d+)", timeout=300)
3129
fib_n = int(res.group(0).decode("utf-8").split(" ")[1])
3230
LOGGER.info("Calculating Fibonacci({})".format(fib_n))
33-
assert fib_n > 30 and fib_n < 50, "Invalid Fibonacci number"
31+
assert fib_n > 0, "Invalid Fibonacci number"
32+
33+
# Calculate Fibonacci results
34+
expected_result = fib(fib_n)
35+
LOGGER.info("Expected Fibonacci result: {}".format(expected_result))
3436

3537
list_time = []
3638

@@ -48,7 +50,7 @@ def test_fibonacci(dut, request):
4850
assert fib_result > 0, "Invalid Fibonacci result"
4951

5052
# Check if the result is correct
51-
assert fib_result == fib_results[fib_n - 35]
53+
assert fib_result == expected_result
5254

5355
# Match "Time: %lu.%03lu s"
5456
res = dut.expect(r"Time: (\d+)\.(\d+) s", timeout=300)

tests/performance/psramspeed/ci.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
"qemu": false,
44
"wokwi": false
55
},
6-
"targets": {
7-
"esp32c3": false,
8-
"esp32c6": false,
9-
"esp32h2": false
10-
}
6+
"requires": [
7+
"CONFIG_SPIRAM=y"
8+
]
119
}

tests/performance/psramspeed/psramspeed.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void setup() {
252252
Serial.printf("Max test size: %d\n", MAX_TEST_SIZE);
253253
Serial.flush();
254254
for (int i = 0; i < N_RUNS; i++) {
255-
Serial.printf("Run %d", i);
255+
Serial.printf("Run %d\n", i);
256256
memcpy_speed_test(dest, src, MAX_TEST_SIZE, N_COPIES);
257257
Serial.flush();
258258
memset_speed_test(dest, FILL_VALUE, MAX_TEST_SIZE, N_COPIES);

tests/performance/ramspeed/ramspeed.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ void setup() {
248248
Serial.printf("Max test size: %d\n", MAX_TEST_SIZE);
249249
Serial.flush();
250250
for (int i = 0; i < N_RUNS; i++) {
251-
Serial.printf("Run %d", i);
251+
Serial.printf("Run %d\n", i);
252252
memcpy_speed_test(dest, src, MAX_TEST_SIZE, N_COPIES);
253253
Serial.flush();
254254
memset_speed_test(dest, FILL_VALUE, MAX_TEST_SIZE, N_COPIES);

0 commit comments

Comments
 (0)