Skip to content

Commit 205db45

Browse files
authored
Merge branch 'master' into power-management
2 parents 80bcb52 + c43187a commit 205db45

Some content is hidden

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

60 files changed

+1500
-245
lines changed

.github/scripts/on-push.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ if [ "$BUILD_PIO" -eq 0 ]; then
108108

109109
if [ "$BUILD_LOG" -eq 1 ]; then
110110
#remove last comma from the last JSON object
111-
sed -i '$ s/.$//' "$sizes_file"
111+
sed -i '$ s/,$//' "$sizes_file"
112112
#echo end of JSON array
113113
echo "]}" >> $sizes_file
114114
fi

.github/scripts/set_push_chunks.sh

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/bin/bash
2+
3+
build_all=false
4+
chunks_count=0
5+
6+
if [[ $CORE_CHANGED == 'true' ]] || [[ $IS_PR != 'true' ]]; then
7+
echo "Core files changed or not a PR. Building all."
8+
build_all=true
9+
chunks_count=$MAX_CHUNKS
10+
elif [[ $LIB_CHANGED == 'true' ]]; then
11+
echo "Libraries changed. Building only affected sketches."
12+
if [[ $NETWORKING_CHANGED == 'true' ]]; then
13+
echo "Networking libraries changed. Building networking related sketches."
14+
networking_sketches="$(find libraries/WiFi -name *.ino) "
15+
networking_sketches+="$(find libraries/Ethernet -name *.ino) "
16+
networking_sketches+="$(find libraries/PPP -name *.ino) "
17+
networking_sketches+="$(find libraries/NetworkClientSecure -name *.ino) "
18+
networking_sketches+="$(find libraries/WebServer -name *.ino) "
19+
fi
20+
if [[ $FS_CHANGED == 'true' ]]; then
21+
echo "FS libraries changed. Building FS related sketches."
22+
fs_sketches="$(find libraries/SD -name *.ino) "
23+
fs_sketches+="$(find libraries/SD_MMC -name *.ino) "
24+
fs_sketches+="$(find libraries/SPIFFS -name *.ino) "
25+
fs_sketches+="$(find libraries/LittleFS -name *.ino) "
26+
fs_sketches+="$(find libraries/FFat -name *.ino) "
27+
fi
28+
sketches="$networking_sketches $fs_sketches"
29+
for file in $LIB_FILES; do
30+
if [[ $file == *.ino ]]; then
31+
# If file ends with .ino, add it to the list of sketches
32+
echo "Sketch found: $file"
33+
sketches+="$file "
34+
elif [[ $(basename $(dirname $file)) == "src" ]]; then
35+
# If file is in a src directory, find all sketches in the parent/examples directory
36+
echo "Library src file found: $file"
37+
lib=$(dirname $(dirname $file))
38+
if [[ -d $lib/examples ]]; then
39+
lib_sketches=$(find $lib/examples -name *.ino)
40+
sketches+="$lib_sketches "
41+
echo "Library sketches: $lib_sketches"
42+
fi
43+
else
44+
# If file is in a example folder but it is not a sketch, find all sketches in the current directory
45+
echo "File in example folder found: $file"
46+
sketch=$(find $(dirname $file) -name *.ino)
47+
sketches+="$sketch "
48+
echo "Sketch in example folder: $sketch"
49+
fi
50+
echo ""
51+
done
52+
fi
53+
54+
if [[ -n $sketches ]]; then
55+
# Remove duplicates
56+
sketches=$(echo $sketches | tr ' ' '\n' | sort | uniq)
57+
for sketch in $sketches; do
58+
echo $sketch >> sketches_found.txt
59+
chunks_count=$((chunks_count+1))
60+
done
61+
echo "Number of sketches found: $chunks_count"
62+
echo "Sketches:"
63+
echo "$sketches"
64+
65+
if [[ $chunks_count -gt $MAX_CHUNKS ]]; then
66+
echo "More sketches than the allowed number of chunks found. Limiting to $MAX_CHUNKS chunks."
67+
chunks_count=$MAX_CHUNKS
68+
fi
69+
fi
70+
71+
chunks='["0"'
72+
for i in $(seq 1 $(( $chunks_count - 1 )) ); do
73+
chunks+=",\"$i\""
74+
done
75+
chunks+="]"
76+
77+
echo "build_all=$build_all" >> $GITHUB_OUTPUT
78+
echo "build_libraries=$BUILD_LIBRARIES" >> $GITHUB_OUTPUT
79+
echo "build_static_sketches=$BUILD_STATIC_SKETCHES" >> $GITHUB_OUTPUT
80+
echo "build_idf=$BUILD_IDF" >> $GITHUB_OUTPUT
81+
echo "build_platformio=$BUILD_PLATFORMIO" >> $GITHUB_OUTPUT
82+
echo "chunk_count=$chunks_count" >> $GITHUB_OUTPUT
83+
echo "chunks=$chunks" >> $GITHUB_OUTPUT

.github/scripts/sketch_utils.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
192192

193193
exit_status=$?
194194
if [ $exit_status -ne 0 ]; then
195-
echo ""ERROR: Compilation failed with error code $exit_status""
195+
echo "ERROR: Compilation failed with error code $exit_status"
196196
exit $exit_status
197197
fi
198198

@@ -236,7 +236,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
236236

237237
exit_status=$?
238238
if [ $exit_status -ne 0 ]; then
239-
echo ""ERROR: Compilation failed with error code $exit_status""
239+
echo "ERROR: Compilation failed with error code $exit_status"
240240
exit $exit_status
241241
fi
242242
# $ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \
@@ -398,6 +398,7 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
398398
else
399399
start_index=$(( $chunk_index * $chunk_size ))
400400
if [ "$sketchcount" -le "$start_index" ]; then
401+
echo "No sketches to build for $target in this chunk"
401402
return 0
402403
fi
403404

@@ -437,7 +438,7 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
437438
continue
438439
fi
439440
echo ""
440-
echo "Building Sketch Index $(($sketchnum - 1)) - $sketchdirname"
441+
echo "Building Sketch Index $sketchnum - $sketchdirname"
441442
build_sketch $args -s $sketchdir $xtra_opts
442443
local result=$?
443444
if [ $result -ne 0 ]; then

.github/scripts/tests_run.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,12 @@ function run_test() {
9595
printf "\033[95mpytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args\033[0m\n"
9696
bash -c "set +e; pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args; exit \$?" || result=$?
9797
printf "\n"
98-
result=$?
9998
if [ $result -ne 0 ]; then
99+
printf "\033[91mFailed test: $sketchname -- Config: $i\033[0m\n\n"
100100
error=$result
101101
fi
102102
fi
103103
done
104-
printf "\n"
105104
return $error
106105
}
107106

.github/workflows/boards.yml

+14
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,19 @@ jobs:
5959
exit 1;
6060
fi
6161
62+
- name: Get libs cache
63+
uses: actions/cache@v4
64+
with:
65+
key: libs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package/package_esp32_index.template.json', 'tools/get.py') }}
66+
path: |
67+
./tools/dist
68+
./tools/esp32-arduino-libs
69+
./tools/esptool
70+
./tools/mk*
71+
./tools/openocd-esp32
72+
./tools/riscv32-*
73+
./tools/xtensa-*
74+
6275
- name: Compile sketch
6376
uses: P-R-O-C-H-Y/compile-sketches@main
6477
with:
@@ -73,3 +86,4 @@ jobs:
7386
exit-on-fail: true
7487
sketch-paths:
7588
"- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"
89+
verbose: true

.github/workflows/build_tests.yml

+15-6
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ on:
1212
description: 'Chip to build tests for'
1313
required: true
1414

15-
concurrency:
16-
group: tests-build-${{ github.event.pull_request.number || github.ref }}-${{ inputs.chip }}-${{ inputs.type }}
17-
cancel-in-progress: true
18-
1915
jobs:
2016
build-tests:
2117
name: Build ${{ inputs.type }} tests for ${{ inputs.chip }}
@@ -47,11 +43,24 @@ jobs:
4743
4844
echo "enabled=$enabled" >> $GITHUB_OUTPUT
4945
50-
- name: Checkout Repository
51-
uses: actions/checkout@v4
46+
- name: Checkout user repository
5247
if: ${{ steps.check-build.outputs.enabled == 'true' }}
48+
uses: actions/checkout@v4
5349
with:
5450
ref: ${{ github.event.pull_request.head.sha || github.sha }}
51+
persist-credentials: false
52+
sparse-checkout-cone-mode: false
53+
sparse-checkout: |
54+
/*
55+
!.github
56+
57+
# To avoid giving unknown scripts elevated permissions, download them from the master branch
58+
- name: Get CI scripts from master
59+
if: ${{ steps.check-build.outputs.enabled == 'true' }}
60+
run: |
61+
mkdir -p .github
62+
cd .github
63+
curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github
5564
5665
- name: Get libs cache
5766
uses: actions/cache@v4

.github/workflows/hw.yml

+26-18
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ on:
1212
description: 'Chip to run tests for'
1313
required: true
1414

15-
concurrency:
16-
group: tests-hw-${{ github.event.pull_request.number || github.ref }}-${{ inputs.chip }}-${{ inputs.type }}
17-
cancel-in-progress: true
18-
1915
jobs:
2016
hardware-test:
2117
name: Hardware ${{ inputs.chip }} ${{ inputs.type }} tests
@@ -49,36 +45,48 @@ jobs:
4945
5046
echo "enabled=$enabled" >> $GITHUB_OUTPUT
5147
52-
- name: Checkout repository
48+
- name: Checkout user repository
5349
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
5450
uses: actions/checkout@v4
5551
with:
5652
ref: ${{ github.event.pull_request.head.sha || github.sha }}
53+
persist-credentials: false
54+
sparse-checkout-cone-mode: false
55+
sparse-checkout: |
56+
/*
57+
!.github
5758
58-
- uses: actions/setup-python@v5
59-
if: steps.check-tests.outputs.enabled == 'true'
60-
with:
61-
cache-dependency-path: tests/requirements.txt
62-
cache: 'pip'
63-
python-version: '3.10.1'
59+
# To avoid giving unknown scripts elevated permissions, download them from the master branch
60+
- name: Get CI scripts from master
61+
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
62+
run: |
63+
mkdir -p .github
64+
cd .github
65+
curl https://codeload.github.com/${{ github.repository }}/tar.gz/master | tar -xz --strip=2 arduino-esp32-master/.github
66+
67+
# setup-python currently only works on ubuntu images
68+
# - uses: actions/setup-python@v5
69+
# if: ${{ steps.check-tests.outputs.enabled == 'true' }}
70+
# with:
71+
# cache-dependency-path: tests/requirements.txt
72+
# cache: 'pip'
73+
# python-version: '3.10.1'
6474

6575
- name: Install dependencies
6676
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
6777
run: |
6878
pip install -U pip
6979
pip install -r tests/requirements.txt --extra-index-url https://dl.espressif.com/pypi
80+
apt update
81+
apt install -y jq
7082
7183
- name: Get binaries
72-
id: cache-build-binaries
73-
uses: actions/cache/restore@v4
7484
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
85+
uses: actions/download-artifact@v4
7586
with:
76-
fail-on-cache-miss: true
77-
key: tests-${{ env.id }}-bin
87+
name: tests-bin-${{ inputs.chip }}-${{ inputs.type }}
7888
path: |
79-
~/.arduino/tests/**/build*.tmp/*.bin
80-
~/.arduino/tests/**/build*.tmp/*.elf
81-
~/.arduino/tests/**/build*.tmp/*.json
89+
~/.arduino/tests
8290
8391
- name: Run Tests
8492
if: ${{ steps.check-tests.outputs.enabled == 'true' }}

.github/workflows/lib.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ jobs:
120120

121121
- name: Push to github repo
122122
run: |
123-
git config user.name github-actions
124-
git config user.email github-actions@github.com
123+
git config user.name "github-actions[bot]"
124+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
125125
git add ${{ env.RESULT_LIBRARY_TEST_FILE }}
126126
git commit -m "Generated External Libraries Test Results"
127127
git push origin HEAD:gh-pages

.github/workflows/pre-commit.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
- name: Set up Python 3
2929
uses: actions/setup-python@v5
3030
with:
31+
cache-dependency-path: tools/pre-commit/requirements.txt
32+
cache: 'pip'
3133
python-version: "3.x"
3234

3335
- name: Get Python version hash
@@ -41,11 +43,10 @@ jobs:
4143
with:
4244
path: |
4345
~/.cache/pre-commit
44-
~/.cache/pip
45-
key: pre-commit|${{ env.PY_HASH }}|${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml') }}
46+
key: pre-commit-${{ env.PY_HASH }}-${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml', 'tools/pre-commit/requirements.txt') }}
4647

4748
- name: Install python dependencies
48-
run: python -m pip install pre-commit docutils
49+
run: python -m pip install -r tools/pre-commit/requirements.txt
4950

5051
- name: Get changed files
5152
id: changed-files
@@ -61,7 +62,6 @@ jobs:
6162
with:
6263
path: |
6364
~/.cache/pre-commit
64-
~/.cache/pip
6565
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
6666

6767
- name: Push changes using pre-commit-ci-lite

.github/workflows/publishsizes-2.x.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ jobs:
3232
run: |
3333
mv master_cli_compile/*.json artifacts/sizes-report/pr/
3434
mv v2.x_cli_compile/*.json artifacts/sizes-report/master/
35-
35+
3636
- name: Report results
3737
uses: P-R-O-C-H-Y/report-size-deltas@sizes_v2
3838
with:
3939
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
4040
github-token: ${{ env.GITHUB_TOKEN }}
4141
destination-file: ${{ env.RESULT_SIZES_TEST_FILE }}
42-
42+
4343
- name: Append file with action URL
4444
run:
4545
echo "/ [GitHub Action Link](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})" >> ${{ env.RESULT_SIZES_TEST_FILE }}
4646

4747
- name: Push to github repo
4848
run: |
49-
git config user.name github-actions
50-
git config user.email github-actions@github.com
49+
git config user.name "github-actions[bot]"
50+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
5151
git add ${{ env.RESULT_SIZES_TEST_FILE }}
5252
git commit -m "Generated Sizes Results (master-v2.x)"
5353
git push origin HEAD:gh-pages

0 commit comments

Comments
 (0)