Skip to content

Commit 14d41f3

Browse files
CI: Add pytest in CI test
1 parent db1e14d commit 14d41f3

File tree

9 files changed

+949
-72
lines changed

9 files changed

+949
-72
lines changed

.gitlab-ci.yml

Lines changed: 167 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
stages:
22
- build
3+
- target_test
34
- docs
45

56
variables:
67
ESP_MATTER_PATH: "$CI_PROJECT_DIR"
78
IDF_PATH: "$CI_PROJECT_DIR/esp-idf"
9+
BR_PATH: "$CI_PROJECT_DIR/esp-thread-br"
810
IDF_GITHUB_ASSETS: "dl.espressif.com/github_assets"
911
GIT_STRATEGY: fetch
1012
GIT_SUBMODULE_STRATEGY: none
@@ -65,12 +67,38 @@ variables:
6567
- pip install python-gitlab
6668
- python tools/ci/ci_fetch_submodule.py
6769

70+
.setup_ot_br: &setup_ot_br
71+
- cd ${CI_PROJECT_DIR}
72+
- git clone ssh://[email protected]:27227/espressif/esp-thread-br.git
73+
- cd ${BR_PATH}/examples/basic_thread_border_router
74+
- idf.py set-target esp32s3
75+
- idf.py build
76+
77+
.setup_ot_rcp: &setup_ot_rcp
78+
- cd ${IDF_PATH}
79+
- ./install.sh
80+
- . ./export.sh
81+
# fetch submodules
82+
- export PYTHONPATH=${IDF_PATH}/tools/ci/python_packages/:${PYTHONPATH}
83+
- pip install python-gitlab
84+
- python tools/ci/ci_fetch_submodule.py
85+
- cd examples/openthread/ot_rcp
86+
- idf.py set-target esp32h2
87+
- idf.py build
88+
6889
.setup_matter: &setup_matter
6990
- cd ${CI_PROJECT_DIR}
7091
# Setting up Python environment still spend a pretty long time (15mins -> 5mins).
7192
- ./install.sh
7293
- . ./export.sh
7394

95+
.build_chip_tool: &build_chip_tool
96+
- cd ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip
97+
- source scripts/activate.sh
98+
- cd ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/examples/chip-tool
99+
- gn gen out
100+
- ninja -C out
101+
74102
.build_matter_examples: &build_matter_examples
75103
- export MATTER_EXAMPLES_PATH=$ESP_MATTER_PATH/connectedhomeip/connectedhomeip/examples
76104
- cd $MATTER_EXAMPLES_PATH/all-clusters-app/esp32
@@ -84,32 +112,6 @@ variables:
84112
- cd $MATTER_EXAMPLES_PATH/persistent-storage/esp32
85113
- idf.py build
86114

87-
.build_examples: &build_examples
88-
- cd $ESP_MATTER_PATH/examples/blemesh_bridge
89-
- idf.py set-target esp32
90-
- idf.py build
91-
- idf.py set-target esp32c3
92-
- idf.py build
93-
- cd $ESP_MATTER_PATH/examples/zap_light
94-
- idf.py set-target esp32
95-
- idf.py build
96-
- cd $ESP_MATTER_PATH/examples/light_switch
97-
- idf.py set-target esp32
98-
- idf.py build
99-
- cd $ESP_MATTER_PATH/examples/light
100-
- idf.py set-target esp32
101-
- idf.py build
102-
- idf.py set-target esp32c3
103-
- idf.py build
104-
- cd $ESP_MATTER_PATH/examples/controller
105-
- idf.py set-target esp32
106-
- idf.py build
107-
- cd $ESP_MATTER_PATH/examples/esp-now_bridge_light
108-
- idf.py set-target esp32
109-
- idf.py build
110-
- idf.py set-target esp32c3
111-
- idf.py build
112-
113115
.build_external_platform_example: &build_external_platform_example
114116
- rm -rf $ESP_MATTER_PATH/../platform
115117
- mkdir $ESP_MATTER_PATH/../platform
@@ -122,32 +124,6 @@ variables:
122124
- idf.py build
123125
- cp sdkconfig.defaults.backup sdkconfig.defaults
124126

125-
.build_examples_idf_v5_1: &build_examples_idf_v5_1
126-
- cd $ESP_MATTER_PATH/examples/zap_light
127-
- idf.py --preview set-target esp32h2
128-
- idf.py build
129-
- idf.py set-target esp32c2
130-
- idf.py build
131-
- cd $ESP_MATTER_PATH/examples/light_switch
132-
- idf.py --preview set-target esp32h2
133-
- idf.py build
134-
- idf.py --preview set-target esp32c6
135-
- idf.py build
136-
- idf.py set-target esp32c2
137-
- idf.py build
138-
- cd $ESP_MATTER_PATH/examples/light
139-
- idf.py --preview set-target esp32h2
140-
- idf.py build
141-
- idf.py --preview set-target esp32c6
142-
- idf.py build
143-
- idf.py set-target esp32c2
144-
- idf.py build
145-
- idf.py set-target esp32c3
146-
- idf.py build
147-
- cd $ESP_MATTER_PATH/examples/zigbee_bridge
148-
- idf.py set-target esp32
149-
- idf.py build
150-
151127
.build_examples_template:
152128
stage: build
153129
image: gitlab.espressif.cn:5050/app-frameworks/esp-matter/build-env:latest
@@ -171,28 +147,149 @@ variables:
171147
REPOS_PATH: "$CI_PROJECT_DIR/repos"
172148
IDF_CCACHE_ENABLE: 1
173149

174-
build_esp_matter_examples:
175-
extends:
150+
build_esp_matter_examples_pytest_C6_idf_v5_1:
151+
extends:
176152
- .build_examples_template
177-
script:
178-
- *build_examples
179-
- *build_external_platform_example
153+
artifacts:
154+
paths:
155+
- "examples/**/build*/size.json"
156+
- "examples/**/build*/build_log.txt"
157+
- "examples/**/build*/*.bin"
158+
- "examples/**/build*/flasher_args.json"
159+
- "examples/**/build*/config/sdkconfig.json"
160+
- "examples/**/build*/bootloader/*.bin"
161+
- "examples/**/build*/partition_table/*.bin"
162+
- "connectedhomeip/connectedhomeip/examples/chip-tool/out/chip-tool"
163+
when: always
164+
expire_in: 4 days
165+
variables:
166+
IDF_VERSION: "ea5e0ff298e6257b31d8e0c81435e6d3937f04c7"
167+
script:
168+
- cd ${ESP_MATTER_PATH}
169+
- pip install -r tools/ci/requirements-build.txt
170+
- python tools/ci/build_apps.py ./examples --pytest_c6
171+
- *build_chip_tool
172+
after_script:
173+
- find . -name "*.bin"
180174

181-
build_esp_matter_examples_idf_v4_4:
182-
extends:
175+
build_esp_matter_examples_pytest_H2_idf_v5_1:
176+
extends:
183177
- .build_examples_template
184-
variables:
185-
IDF_VERSION: "v4.4.3"
186-
script:
187-
- *build_examples
178+
artifacts:
179+
paths:
180+
- "examples/**/build*/size.json"
181+
- "examples/**/build*/build_log.txt"
182+
- "examples/**/build*/*.bin"
183+
- "examples/**/build*/flasher_args.json"
184+
- "examples/**/build*/config/sdkconfig.json"
185+
- "examples/**/build*/bootloader/*.bin"
186+
- "examples/**/build*/partition_table/*.bin"
187+
- "${IDF_PATH}/examples/openthread/ot_rcp/build/*.bin"
188+
- "${IDF_PATH}/examples/openthread/ot_rcp/build/partition_table/*.bin"
189+
- "${IDF_PATH}/examples/openthread/ot_rcp/build/bootloader/*.bin"
190+
- "${IDF_PATH}/examples/openthread/ot_rcp/build/config/sdkconfig.json"
191+
- "${IDF_PATH}/examples/openthread/ot_rcp/build/flasher_args.json"
192+
- "${BR_PATH}/examples/basic_thread_border_router/build/*.bin"
193+
- "${BR_PATH}/examples/basic_thread_border_router/build/partition_table/*.bin"
194+
- "${BR_PATH}/examples/basic_thread_border_router/build/bootloader/*.bin"
195+
- "${BR_PATH}/examples/basic_thread_border_router/build/config/sdkconfig.json"
196+
- "${BR_PATH}/examples/basic_thread_border_router/build/flasher_args.json"
197+
- "connectedhomeip/connectedhomeip/examples/chip-tool/out/chip-tool"
198+
when: always
199+
expire_in: 4 days
200+
variables:
201+
IDF_VERSION: "ea5e0ff298e6257b31d8e0c81435e6d3937f04c7"
202+
script:
203+
- *setup_ot_rcp
204+
- *setup_ot_br
205+
- cd ${ESP_MATTER_PATH}
206+
- pip install -r tools/ci/requirements-build.txt
207+
- python tools/ci/build_apps.py ./examples --pytest_h2
208+
- *build_chip_tool
209+
after_script:
210+
- find . -name "*.bin"
188211

189-
build_esp_matter_examples_idf_v5_1:
190-
extends:
212+
build_esp_matter_examples_non_pytest_idf_v5_1:
213+
extends:
191214
- .build_examples_template
192-
variables:
215+
artifacts:
216+
paths:
217+
- "examples/**/build*/size.json"
218+
- "examples/**/build*/build_log.txt"
219+
- "examples/**/build*/*.bin"
220+
- "examples/**/build*/flasher_args.json"
221+
- "examples/**/build*/config/sdkconfig.json"
222+
- "examples/**/build*/bootloader/*.bin"
223+
- "examples/**/build*/partition_table/*.bin"
224+
when: always
225+
expire_in: 4 days
226+
variables:
193227
IDF_VERSION: "ea5e0ff298e6257b31d8e0c81435e6d3937f04c7"
194-
script:
195-
- *build_examples_idf_v5_1
228+
script:
229+
- *build_external_platform_example
230+
- cd ${ESP_MATTER_PATH}
231+
- pip install -r tools/ci/requirements-build.txt
232+
- python tools/ci/build_apps.py ./examples --no_pytest
233+
after_script:
234+
- find . -name "*.bin"
235+
236+
build_esp_matter_examples_pytest_C3_idf_v4_4:
237+
extends:
238+
- .build_examples_template
239+
artifacts:
240+
paths:
241+
- "examples/**/build*/size.json"
242+
- "examples/**/build*/build_log.txt"
243+
- "examples/**/build*/*.bin"
244+
- "examples/**/build*/flasher_args.json"
245+
- "examples/**/build*/config/sdkconfig.json"
246+
- "examples/**/build*/bootloader/*.bin"
247+
- "examples/**/build*/partition_table/*.bin"
248+
- "connectedhomeip/connectedhomeip/examples/chip-tool/out/chip-tool"
249+
when: always
250+
expire_in: 4 days
251+
variables:
252+
IDF_VERSION: "v4.4.3"
253+
script:
254+
- cd ${ESP_MATTER_PATH}
255+
- pip install -r tools/ci/requirements-build.txt
256+
- python tools/ci/build_apps.py ./examples --pytest_c3
257+
- *build_chip_tool
258+
after_script:
259+
- find . -name "*.bin"
260+
261+
pytest_esp32c3_esp_matter_dut:
262+
stage: target_test
263+
image: ${TARGET_TEST_ENV}
264+
needs:
265+
- build_esp_matter_examples_pytest_C3_idf_v4_4
266+
script:
267+
- cd ${ESP_MATTER_PATH}
268+
- pip install -r tools/ci/requirements-pytest.txt
269+
- pytest examples/ --target esp32c3 -m esp_matter_dut --junitxml=XUNIT_RESULT.xml
270+
tags: ["esp32c3", "esp_matter_dut"]
271+
272+
pytest_esp32c6_esp_matter_dut:
273+
stage: target_test
274+
image: ${TARGET_TEST_ENV}
275+
needs:
276+
- build_esp_matter_examples_pytest_C6_idf_v5_1
277+
script:
278+
- cd ${ESP_MATTER_PATH}
279+
- pip install -r tools/ci/requirements-pytest.txt
280+
- pytest examples/ --target esp32c6 -m esp_matter_dut --junitxml=XUNIT_RESULT.xml
281+
tags: ["esp32c6", "esp_matter_dut"]
282+
283+
pytest_esp32h2_esp_matter_dut:
284+
stage: target_test
285+
image: ${TARGET_TEST_ENV}
286+
needs:
287+
- build_esp_matter_examples_pytest_H2_idf_v5_1
288+
script:
289+
- cd ${ESP_MATTER_PATH}
290+
- pip install -r tools/ci/requirements-pytest.txt
291+
- pytest examples/ --target esp32h2 -m esp_matter_dut --junitxml=XUNIT_RESULT.xml
292+
tags: ["esp32h2", "esp_matter_dut"]
196293

197294
build_upstream_examples:
198295
extends:
@@ -203,7 +300,7 @@ build_upstream_examples:
203300

204301
build_docs:
205302
stage: build
206-
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.0:2-3
303+
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.1:1-1
207304
tags:
208305
- build
209306
variables:
@@ -221,7 +318,7 @@ build_docs:
221318

222319
.deploy_docs_template:
223320
stage: docs
224-
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.0:2-3
321+
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.1:1-1
225322
tags:
226323
- docs
227324
needs:

0 commit comments

Comments
 (0)