Skip to content

Commit 5cb991f

Browse files
authored
Merge branch 'master' into feat/zigbee-sleep-battery
2 parents 6906b0e + b170e87 commit 5cb991f

File tree

14 files changed

+863
-73
lines changed

14 files changed

+863
-73
lines changed

.github/scripts/set_push_chunks.sh

+58-58
Original file line numberDiff line numberDiff line change
@@ -4,73 +4,73 @@ build_all=false
44
chunks_count=0
55

66
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
7+
echo "Core files changed or not a PR. Building all."
8+
build_all=true
9+
chunks_count=$MAX_CHUNKS
1010
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
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+
lib=$(echo $file | awk -F "/" '{print $1"/"$2}')
31+
if [[ "$file" == *.ino ]]; then
32+
# If file ends with .ino, add it to the list of sketches
33+
echo "Sketch found: $file"
34+
sketches+="$file "
35+
elif [[ "$file" == "$lib/src/"* ]]; then
36+
# If file is inside the src directory, find all sketches in the lib/examples directory
37+
echo "Library src file found: $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
5252
fi
5353

5454
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"
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"
6464

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
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
6969
fi
7070

7171
chunks='["0"'
7272
for i in $(seq 1 $(( $chunks_count - 1 )) ); do
73-
chunks+=",\"$i\""
73+
chunks+=",\"$i\""
7474
done
7575
chunks+="]"
7676

.github/scripts/tests_run.sh

+2
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ function run_test() {
125125
extra_args="--embedded-services esp,arduino"
126126
fi
127127

128+
rm $sketchdir/diagram.json 2>/dev/null || true
129+
128130
result=0
129131
printf "\033[95mpytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args\033[0m\n"
130132
bash -c "set +e; pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args; exit \$?" || result=$?

.github/workflows/pre-commit.yml

+11-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
branches:
77
- master
88
pull_request:
9-
types: [opened, reopened, synchronize, labeled, unlabeled]
9+
types: [opened, reopened, synchronize, labeled]
1010

1111
concurrency:
1212
group: pre-commit-${{github.event.pull_request.number || github.ref}}
@@ -15,8 +15,10 @@ concurrency:
1515
jobs:
1616
lint:
1717
if: |
18+
github.event_name != 'pull_request' ||
1819
contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') ||
19-
github.event_name != 'pull_request'
20+
contains(github.event.pull_request.labels.*.name, 'Re-trigger Pre-commit Hooks')
21+
2022
name: Check if fixes are needed
2123
runs-on: ubuntu-latest
2224
steps:
@@ -25,6 +27,12 @@ jobs:
2527
with:
2628
fetch-depth: 2
2729

30+
- name: Remove Label
31+
if: contains(github.event.pull_request.labels.*.name, 'Re-trigger Pre-commit Hooks')
32+
run: gh pr edit ${{ github.event.number }} --remove-label 'Re-trigger Pre-commit Hooks'
33+
env:
34+
GH_TOKEN: ${{ github.token }}
35+
2836
- name: Set up Python 3
2937
uses: actions/setup-python@v5
3038
with:
@@ -65,7 +73,7 @@ jobs:
6573
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
6674

6775
- name: Push changes using pre-commit-ci-lite
68-
uses: pre-commit-ci/lite-action@v1.0.2
76+
uses: pre-commit-ci/lite-action@v1.1.0
6977
# Only push changes in PRs
7078
if: ${{ always() && github.event_name == 'pull_request' }}
7179
with:

.github/workflows/push.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
push:
66
branches:
77
- master
8-
- release/v2.x
8+
- release/*
99
pull_request:
1010
paths:
1111
- 'cores/**'
@@ -47,13 +47,15 @@ jobs:
4747
cmake-check:
4848
name: Check cmake file
4949
runs-on: ubuntu-latest
50+
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }}
5051
steps:
5152
- uses: actions/checkout@v4
5253
- run: bash ./.github/scripts/check-cmakelists.sh
5354

5455
gen-chunks:
5556
name: Generate chunks
5657
runs-on: ubuntu-latest
58+
if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/')) }}
5759
outputs:
5860
build_all: ${{ steps.set-chunks.outputs.build_all }}
5961
build_libraries: ${{ steps.set-chunks.outputs.build_libraries }}
@@ -307,7 +309,7 @@ jobs:
307309
#Upload PR number as artifact
308310
upload-pr-number:
309311
name: Upload PR number
310-
if: github.event_name == 'pull_request'
312+
if: ${{ github.event_name == 'pull_request' && !startsWith(github.head_ref, 'release/') }}
311313
runs-on: ubuntu-latest
312314
steps:
313315
- name: Save the PR number in an artifact

.github/workflows/tests.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ on:
2626
- '!.github/scripts/upload_py_tools.sh'
2727
- 'tests/**'
2828
- 'cores/**'
29-
- 'libraries/**'
30-
- '!libraries/**.md'
31-
- '!libraries/**.txt'
32-
- '!libraries/**.properties'
29+
- 'libraries/*/src/**.cpp'
30+
- 'libraries/*/src/**.h'
31+
- 'libraries/*/src/**.c'
3332
- 'package/**'
3433
schedule:
3534
- cron: '0 2 * * *'

0 commit comments

Comments
 (0)