Skip to content

Commit 9a60557

Browse files
committed
feat(idf): Add ci.json support for IDF examples
1 parent ee6a288 commit 9a60557

File tree

7 files changed

+42
-5
lines changed

7 files changed

+42
-5
lines changed

Diff for: .github/scripts/on-push-idf.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
CHECK_REQUIREMENTS="./components/arduino-esp32/.github/scripts/sketch_utils.sh check_requirements"
6+
7+
# Export IDF environment
8+
. ${IDF_PATH}/export.sh
9+
10+
# Find all sub-folders in ./components/arduino-esp32/idf_component_examples and save them in a variable
11+
idf_component_examples=$(find ./components/arduino-esp32/idf_component_examples -type d)
12+
13+
for example in $idf_component_examples; do
14+
idf.py -C "$example" set-target "$IDF_TARGET"
15+
16+
has_requirements=$(${CHECK_REQUIREMENTS} "$example" "$example/sdkconfig")
17+
if [ "$has_requirements" -eq 1 ]; then
18+
echo "$example does not meet the requirements for $IDF_TARGET"
19+
continue
20+
fi
21+
22+
echo "Building $example"
23+
idf.py -C "$example" -DEXTRA_COMPONENT_DIRS="$PWD/components" build
24+
done

Diff for: .github/workflows/push.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ on:
3131
- "!libraries/**.properties"
3232
- "!libraries/**.py"
3333
- "package/**"
34+
- "idf_component_examples/**"
3435
- "tools/**.py"
3536
- "platform.txt"
3637
- "programmers.txt"
@@ -125,6 +126,7 @@ jobs:
125126
- 'Kconfig.projbuild'
126127
- 'CMakeLists.txt'
127128
- "variants/esp32c2/**/*"
129+
- "idf_component_examples/**"
128130
129131
- name: Set chunks
130132
id: set-chunks
@@ -271,11 +273,7 @@ jobs:
271273
env:
272274
IDF_TARGET: ${{ matrix.idf_target }}
273275
shell: bash
274-
run: |
275-
. ${IDF_PATH}/export.sh
276-
idf.py -C ./components/arduino-esp32/idf_component_examples/hello_world -DEXTRA_COMPONENT_DIRS=$PWD/components build
277-
idf.py -C ./components/arduino-esp32/idf_component_examples/hw_cdc_hello_world -DEXTRA_COMPONENT_DIRS=$PWD/components build
278-
idf.py -C ./components/arduino-esp32/idf_component_examples/esp_matter_light -DEXTRA_COMPONENT_DIRS=$PWD/components build
276+
run: ./components/arduino-esp32/.github/scripts/on-push-idf.sh
279277

280278
# Save artifacts to gh-pages
281279
save-master-artifacts:

Diff for: idf_component_examples/esp_matter_light/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ set(PROJECT_VER_NUMBER 1)
88
# This should be done before using the IDF_TARGET variable.
99
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
1010

11+
idf_build_set_property(MINIMAL_BUILD ON)
1112
project(arduino_managed_component_light)
1213

1314
# WARNING: This is just an example for using key for decrypting the encrypted OTA image

Diff for: idf_component_examples/esp_matter_light/ci.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"requires": [
3+
"CONFIG_SOC_WIFI_SUPPORTED=y",
4+
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
5+
]
6+
}

Diff for: idf_component_examples/hello_world/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
cmake_minimum_required(VERSION 3.16)
66

77
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
8+
9+
idf_build_set_property(MINIMAL_BUILD ON)
810
project(main)

Diff for: idf_component_examples/hw_cdc_hello_world/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake)
99
list(APPEND compile_definitions "ARDUINO_USB_CDC_ON_BOOT=1")
1010
list(APPEND compile_definitions "ARDUINO_USB_MODE=1")
1111

12+
idf_build_set_property(MINIMAL_BUILD ON)
1213
project(hw_cdc_hello_world)

Diff for: idf_component_examples/hw_cdc_hello_world/ci.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"requires": [
3+
"CONFIG_SOC_USB_SERIAL_JTAG_SUPPORTED=y"
4+
]
5+
}

0 commit comments

Comments
 (0)