Skip to content

Commit 07f4bd0

Browse files
committed
feat(ci): optimize the logic for example build checks
1 parent bb95c4f commit 07f4bd0

11 files changed

+357
-409
lines changed

.gitlab-ci.yml

Lines changed: 15 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
stages:
22
- build
3-
- check_results
43
- docs
54

65
variables:
@@ -54,6 +53,9 @@ pre_commit:
5453
- git rev-parse HEAD
5554
- idf.py build
5655
- cd $ESP_THREAD_BR_PATH/examples/basic_thread_border_router
56+
- git fetch origin main
57+
- python3 $ESP_THREAD_BR_PATH/example_build_version_check.py basic_thread_border_router esp_ot_cli_extension
58+
- python3 $ESP_THREAD_BR_PATH/example_build_version_check.py basic_thread_border_router esp_rcp_update
5759
- rm -rf CMakeLists.txt
5860
- cp ${CI_TOOLS_PATH}/basic_thread_border_router.cmake CMakeLists.txt
5961
- idf.py build
@@ -72,10 +74,10 @@ pre_commit:
7274
- idf.py build
7375

7476
.build_idf_example_ot_br: &build_idf_example_ot_br
75-
- cd $IDF_PATH/examples/openthread/ot_br/main
76-
- rm -rf idf_component.yml
77-
- cp ${CI_TOOLS_PATH}/idf_component_otbr.yml idf_component.yml
78-
- cd ..
77+
- cd $ESP_THREAD_BR_PATH
78+
- git fetch origin main
79+
- python3 example_build_version_check.py ot_br esp_ot_cli_extension
80+
- cd $IDF_PATH/examples/openthread/ot_br
7981
- rm -rf CMakeLists.txt
8082
- cp ${CI_TOOLS_PATH}/ot_br.cmake CMakeLists.txt
8183
- idf.py set-target esp32s3
@@ -84,10 +86,10 @@ pre_commit:
8486
- idf.py build
8587

8688
.build_idf_example_ot_br_autostart: &build_idf_example_ot_br_autostart
87-
- cd $IDF_PATH/examples/openthread/ot_br/main
88-
- rm -rf idf_component.yml
89-
- cp ${CI_TOOLS_PATH}/idf_component_otbr.yml idf_component.yml
90-
- cd ..
89+
- cd $ESP_THREAD_BR_PATH
90+
- git fetch origin main
91+
- python3 example_build_version_check.py ot_br esp_ot_cli_extension
92+
- cd $IDF_PATH/examples/openthread/ot_br
9193
- rm -rf CMakeLists.txt
9294
- cp ${CI_TOOLS_PATH}/ot_br.cmake CMakeLists.txt
9395
- rm -rf sdkconfig.defaults
@@ -98,10 +100,10 @@ pre_commit:
98100
- idf.py build
99101

100102
.build_idf_example_ot_cli: &build_idf_example_ot_cli
101-
- cd $IDF_PATH/examples/openthread/ot_cli/main
102-
- rm -rf idf_component.yml
103-
- cp ${CI_TOOLS_PATH}/idf_component_otcli.yml idf_component.yml
104-
- cd ..
103+
- cd $ESP_THREAD_BR_PATH
104+
- git fetch origin main
105+
- python3 example_build_version_check.py ot_cli esp_ot_cli_extension
106+
- cd $IDF_PATH/examples/openthread/ot_cli
105107
- rm -rf CMakeLists.txt
106108
- cp ${CI_TOOLS_PATH}/ot_cli.cmake CMakeLists.txt
107109
- idf.py set-target esp32c6
@@ -114,21 +116,9 @@ build_examples:
114116
image: espressif/idf:latest
115117
script:
116118
- *submodule_update
117-
- cd $ESP_THREAD_BR_PATH
118-
- python3 ${CI_TOOLS_PATH}/get_component_version.py $ESP_THREAD_BR_PATH/examples/basic_thread_border_router/main/idf_component.yml build_examples_result.txt esp_ot_cli_extension
119-
- python3 ${CI_TOOLS_PATH}/get_component_version.py $ESP_THREAD_BR_PATH/examples/basic_thread_border_router/main/idf_component.yml build_examples_result.txt esp_rcp_update
120119
- *build_basic_thread_border_router
121-
- cd $ESP_THREAD_BR_PATH
122-
- echo "Success" > build_examples_result.txt
123-
artifacts:
124-
when: always
125-
paths:
126-
- build_examples_result.txt
127-
expire_in: 1 days
128120
tags:
129121
- build
130-
# allow failure if esp_ot_cli_extension version updated but haven't publish to component registry yet
131-
allow_failure: true
132122

133123
build_examples_local_components:
134124
stage: build
@@ -143,57 +133,27 @@ build_examples_local_components:
143133
build_idf_otbr_examples:
144134
stage: build
145135
image: $ESP_ENV_IMAGE
146-
allow_failure: true
147136
script:
148137
- *setup_idf_master
149-
- cd $ESP_THREAD_BR_PATH
150-
- python3 ${CI_TOOLS_PATH}/get_component_version.py $IDF_PATH/examples/openthread/ot_br/main/idf_component.yml build_idf_otbr_example_result.txt esp_ot_cli_extension
151138
- *build_idf_example_ot_br
152-
- cd $ESP_THREAD_BR_PATH
153-
- echo "Success" > build_idf_otbr_example_result.txt
154-
artifacts:
155-
when: always
156-
paths:
157-
- build_idf_otbr_example_result.txt
158-
expire_in: 1 days
159139
tags:
160140
- build
161141

162142
build_idf_otbr_autostart_examples:
163143
stage: build
164144
image: $ESP_ENV_IMAGE
165-
allow_failure: true
166145
script:
167146
- *setup_idf_master
168-
- cd $ESP_THREAD_BR_PATH
169-
- python3 ${CI_TOOLS_PATH}/get_component_version.py $IDF_PATH/examples/openthread/ot_br/main/idf_component.yml build_idf_otbr_autostart_example_result.txt esp_ot_cli_extension
170147
- *build_idf_example_ot_br_autostart
171-
- cd $ESP_THREAD_BR_PATH
172-
- echo "Success" > build_idf_otbr_autostart_example_result.txt
173-
artifacts:
174-
when: always
175-
paths:
176-
- build_idf_otbr_autostart_example_result.txt
177-
expire_in: 1 days
178148
tags:
179149
- build
180150

181151
build_idf_otcli_examples:
182152
stage: build
183153
image: $ESP_ENV_IMAGE
184-
allow_failure: true
185154
script:
186155
- *setup_idf_master
187-
- cd $ESP_THREAD_BR_PATH
188-
- python3 ${CI_TOOLS_PATH}/get_component_version.py $IDF_PATH/examples/openthread/ot_cli/main/idf_component.yml build_idf_otcli_example_result.txt esp_ot_cli_extension
189156
- *build_idf_example_ot_cli
190-
- cd $ESP_THREAD_BR_PATH
191-
- echo "Success" > build_idf_otcli_example_result.txt
192-
artifacts:
193-
when: always
194-
paths:
195-
- build_idf_otcli_example_result.txt
196-
expire_in: 1 days
197157
tags:
198158
- build
199159

@@ -215,21 +175,6 @@ build_docs:
215175
tags:
216176
- build_docs
217177

218-
check_build_result:
219-
stage: check_results
220-
image: $ESP_ENV_IMAGE
221-
needs:
222-
- build_examples
223-
- build_idf_otbr_examples
224-
- build_idf_otbr_autostart_examples
225-
- build_idf_otcli_examples
226-
script:
227-
- *submodule_update
228-
- chmod 700 ./check_build_results.sh
229-
- ./check_build_results.sh
230-
tags:
231-
- build
232-
233178
.deploy_docs_template:
234179
stage: docs
235180
image: $CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.1:1-1

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ repos:
1111
hooks:
1212
- id: check-version-increment
1313
name: Check Version Increment in Specific idf_component.yml
14-
entry: python3 check_components_version.py
14+
entry: bash -c "export ESP_THREAD_BR_PATH=$(pwd) && python3 precommit_version_check.py"
1515
language: python
16-
files: "(components/esp_rcp_update/idf_component.yml|components/esp_ot_cli_extension/idf_component.yml)"
16+
additional_dependencies: [pyyaml]

check_build_results.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

check_components_version.py

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)