Skip to content

Commit 6823884

Browse files
committed
Merge branch 'ci/apply-idf-ci-1' into 'master'
ci: apply `idf-ci` Closes IDFCI-2719 See merge request espressif/esp-idf!38755
2 parents c5a7513 + 586d219 commit 6823884

File tree

77 files changed

+1037
-4293
lines changed

Some content is hidden

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

77 files changed

+1037
-4293
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ managed_components
100100
pytest-embedded/
101101
# legacy one
102102
pytest_embedded_log/
103-
list_job*.txt
103+
app_info_*.txt
104104
size_info*.txt
105105
XUNIT_RESULT*.xml
106106
.manifest_sha

.gitlab-ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ workflow:
88
- if: $CI_OPEN_MERGE_REQUESTS != null
99
variables:
1010
PIPELINE_COMMIT_SHA: $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
11-
IS_MR_PIPELINE: 1
1211
- if: $CI_OPEN_MERGE_REQUESTS == null
1312
variables:
1413
PIPELINE_COMMIT_SHA: $CI_COMMIT_SHA
15-
IS_MR_PIPELINE: 0
1614
- when: always
1715

1816
# Place the default settings in `.gitlab/ci/common.yml` instead

.gitlab/ci/README.md

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -250,76 +250,9 @@ We're using the latest version of [idf-build-apps][idf-build-apps]. Please refer
250250
In ESP-IDF CI, there's a few more special rules are additionally supported to disable the check app dependencies feature:
251251

252252
- Add MR labels `BUILD_AND_TEST_ALL_APPS`
253+
- Pipeline variable `IDF_CI_SELECT_ALL_PYTEST_CASES=1`
253254
- Run in protected branches
254255

255256
## Upload/Download Artifacts to Internal Minio Server
256257

257-
### Users Without Access to Minio
258-
259-
If you don't have access to the internal Minio server, you can still download the artifacts from the shared link in the job log.
260-
261-
The log will look like this:
262-
263-
```shell
264-
Pipeline ID : 587355
265-
Job name : build_clang_test_apps_esp32
266-
Job ID : 40272275
267-
Created archive file: 40272275.zip, uploading as 587355/build_dir_without_map_and_elf_files/build_clang_test_apps_esp32/40272275.zip
268-
Please download the archive file includes build_dir_without_map_and_elf_files from [INTERNAL_URL]
269-
```
270-
271-
### Users With Access to Minio
272-
273-
#### Env Vars for Minio
274-
275-
Minio takes these env vars to connect to the server:
276-
277-
- `IDF_S3_SERVER`
278-
- `IDF_S3_ACCESS_KEY`
279-
- `IDF_S3_SECRET_KEY`
280-
- `IDF_S3_BUCKET`
281-
282-
#### Artifacts Types and File Patterns
283-
284-
The artifacts types and corresponding file patterns are defined in tools/ci/artifacts_handler.py, inside `ArtifactType` and `TYPE_PATTERNS_DICT`.
285-
286-
#### Upload
287-
288-
```shell
289-
python tools/ci/artifacts_handler.py upload
290-
```
291-
292-
will upload the files that match the file patterns to minio object storage with name:
293-
294-
`<pipeline_id>/<artifact_type>/<job_name>/<job_id>.zip`
295-
296-
For example, job 39043328 will upload these four files:
297-
298-
- `575500/map_and_elf_files/build_pytest_examples_esp32/39043328.zip`
299-
- `575500/build_dir_without_map_and_elf_files/build_pytest_examples_esp32/39043328.zip`
300-
- `575500/logs/build_pytest_examples_esp32/39043328.zip`
301-
- `575500/size_reports/build_pytest_examples_esp32/39043328.zip`
302-
303-
#### Download
304-
305-
You may run
306-
307-
```shell
308-
python tools/ci/artifacts_handler.py download --pipeline_id <pipeline_id>
309-
```
310-
311-
to download all files of the pipeline, or
312-
313-
```shell
314-
python tools/ci/artifacts_handler.py download --pipeline_id <pipeline_id> --job_name <job_name_or_pattern>
315-
```
316-
317-
to download all files with the specified job name or pattern, or
318-
319-
```shell
320-
python tools/ci/artifacts_handler.py download --pipeline_id <pipeline_id> --job_name <job_name_or_pattern> --type <artifact_type> <artifact_type> ...
321-
```
322-
323-
to download all files with the specified job name or pattern and artifact type(s).
324-
325-
You may check all detailed documentation with `python tools/ci/artifacts_handler.py download -h`
258+
Please refer to the documentation [here](https://docs.espressif.com/projects/idf-ci/en/latest/guides/cli.html)

.gitlab/ci/build.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
- pipeline_variables
2222
artifacts:
2323
paths:
24-
# The other artifacts patterns are defined under tools/ci/artifacts_handler.py
24+
# The other artifacts patterns are defined under .idf_ci.toml
2525
# Now we're uploading/downloading the binary files from our internal storage server
2626
#
2727
# keep the log file to help debug
@@ -34,19 +34,16 @@
3434
variables:
3535
IDF_TOOLCHAIN: clang
3636
TEST_BUILD_OPTS_EXTRA: ""
37-
TEST_DIR: tools/test_apps/system/clang_build_test
38-
PYTEST_IGNORE_COLLECT_IMPORT_ERROR: "1"
3937
script:
4038
# CI specific options start from "--parallel-count xxx". could ignore when running locally
41-
- run_cmd python tools/ci/ci_build_apps.py $TEST_DIR -v
39+
- run_cmd idf-build-apps build
40+
-p tools/test_apps/system/clang_build_test
4241
-t $IDF_TARGET
43-
--copy-sdkconfig
4442
--parallel-count ${CI_NODE_TOTAL:-1}
4543
--parallel-index ${CI_NODE_INDEX:-1}
4644
--modified-components ${MR_MODIFIED_COMPONENTS}
4745
--modified-files ${MR_MODIFIED_FILES}
4846
$TEST_BUILD_OPTS_EXTRA
49-
- python tools/ci/artifacts_handler.py upload
5047

5148
######################
5249
# build_template_app #
@@ -105,7 +102,7 @@ gcc_static_analyzer:
105102
ANALYZING_APP: "examples/get-started/hello_world"
106103
script:
107104
- echo "CONFIG_COMPILER_STATIC_ANALYZER=y" >> ${ANALYZING_APP}/sdkconfig.defaults
108-
- python -m idf_build_apps build -v -p ${ANALYZING_APP} -t all
105+
- idf-build-apps build -p ${ANALYZING_APP}
109106

110107
########################################
111108
# Clang Build Apps Without Tests Cases #
@@ -208,7 +205,7 @@ build_clang_test_apps_esp32p4:
208205
script:
209206
- ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
210207
- cd ${IDF_PATH}/tools/test_build_system
211-
- python ${IDF_PATH}/tools/ci/get_known_failure_cases_file.py
208+
- run_cmd idf-ci gitlab download-known-failure-cases-file ${KNOWN_FAILURE_CASES_FILE_NAME}
212209
- pytest
213210
--cleanup-idf-copy
214211
--parallel-count ${CI_NODE_TOTAL:-1}
@@ -293,11 +290,7 @@ generate_build_child_pipeline:
293290
- non_test_related_apps.txt
294291
expire_in: 1 week
295292
when: always
296-
variables:
297-
PYTEST_IGNORE_COLLECT_IMPORT_ERROR: "1"
298293
script:
299-
# requires basic pytest dependencies
300-
- run_cmd bash install.sh --enable-pytest
301294
- run_cmd python tools/ci/dynamic_pipelines/scripts/generate_build_child_pipeline.py
302295

303296
build_child_pipeline:
@@ -309,12 +302,9 @@ build_child_pipeline:
309302
- pipeline_variables
310303
- generate_build_child_pipeline
311304
variables:
312-
IS_MR_PIPELINE: $IS_MR_PIPELINE
313305
MR_MODIFIED_COMPONENTS: $MR_MODIFIED_COMPONENTS
314306
MR_MODIFIED_FILES: $MR_MODIFIED_FILES
315307
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
316-
BUILD_AND_TEST_ALL_APPS: $BUILD_AND_TEST_ALL_APPS
317-
REPORT_EXIT_CODE: $REPORT_EXIT_CODE
318308
# https://gitlab.com/gitlab-org/gitlab/-/issues/214340
319309
inherit:
320310
variables: false

.gitlab/ci/common.yml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ variables:
120120
source tools/ci/configure_ci_environment.sh
121121

122122
# add extra python packages
123-
export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/esp_app_trace:$IDF_PATH/components/partition_table:$IDF_PATH/tools/ci/python_packages:$PYTHONPATH"
123+
export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci:$IDF_PATH/tools/esp_app_trace:$IDF_PATH/components/partition_table:$IDF_PATH/tools/ci/python_packages:$PYTHONPATH"
124124

125125
.setup_tools_and_idf_python_venv: &setup_tools_and_idf_python_venv |
126126
# must use after setup_tools_except_target_test
@@ -145,23 +145,19 @@ variables:
145145
export IDF_PIP_WHEELS_URL=""
146146
fi
147147

148+
# install.sh
148149
if [[ "${CI_JOB_STAGE}" != "target_test" ]]; then
149150
section_start "running_install_sh" "Running install.sh"
150151
if [[ "${CI_JOB_STAGE}" == "build_doc" ]]; then
151152
run_cmd bash install.sh --enable-ci --enable-docs
152-
elif [[ "${CI_JOB_STAGE}" == "build" ]]; then
153-
run_cmd bash install.sh --enable-ci
154153
else
155-
if ! echo "${CI_JOB_NAME}" | egrep ".*pytest.*"; then
156-
run_cmd bash install.sh --enable-ci
157-
else
158-
run_cmd bash install.sh --enable-ci --enable-pytest --enable-test-specific
159-
fi
154+
run_cmd bash install.sh --enable-ci
160155
fi
161156
section_end "running_install_sh"
162157
else
163-
section_start "install_python_env" "Install Python environment"
164-
run_cmd python tools/idf_tools.py install-python-env --features ci,pytest,test-specific
158+
section_start "install_python_env" "Install Python environment, skip required tools check"
159+
run_cmd python tools/idf_tools.py install-python-env --features ci,test-specific
160+
export IDF_SKIP_TOOLS_CHECK=1
165161
section_end "install_python_env"
166162
fi
167163

@@ -176,11 +172,6 @@ variables:
176172
$IDF_PATH/tools/idf_tools.py --non-interactive install esp-clang
177173
fi
178174

179-
if [[ "${CI_JOB_STAGE}" == "target_test" ]]; then
180-
section_start "IDF_SKIP_TOOLS_CHECK" "Skip required tools check"
181-
export IDF_SKIP_TOOLS_CHECK=1
182-
section_end "IDF_SKIP_TOOLS_CHECK"
183-
fi
184175
section_start "source_export" "Source export.sh"
185176
source ./export.sh
186177
section_end "source_export"
@@ -226,7 +217,7 @@ variables:
226217

227218
.upload_failed_job_log_artifacts: &upload_failed_job_log_artifacts |
228219
if [ $CI_JOB_STATUS = "failed" ]; then
229-
python tools/ci/artifacts_handler.py upload --type logs
220+
run_cmd idf-ci gitlab upload-artifacts --type log
230221
fi
231222

232223
.before_script:minimal:
@@ -268,11 +259,17 @@ variables:
268259

269260
.after_script:build:ccache-show-stats:
270261
after_script:
262+
- source tools/ci/utils.sh
263+
- section_start "ccache_show_stats" "Show ccache statistics"
271264
- *show_ccache_statistics
265+
- section_end "ccache_show_stats"
272266

273267
.after_script:build:ccache-show-stats:upload-failed-job-logs:
274268
after_script:
269+
- source tools/ci/utils.sh
270+
- section_start "ccache_show_stats" "Show ccache statistics"
275271
- *show_ccache_statistics
272+
- section_end "ccache_show_stats"
276273
- *upload_failed_job_log_artifacts
277274

278275
##############################

.gitlab/ci/dependencies/dependencies.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
.all_targets: &all_targets
2-
- esp32
3-
- esp32s2
4-
- esp32s3
5-
- esp32c3
6-
- esp32c2
7-
- esp32c6
8-
- esp32c5
9-
- esp32h2
10-
- esp32p4
11-
12-
.target_test: &target_test
13-
- example_test
14-
- custom_test
15-
- component_ut
16-
171
##############
182
# Build Jobs #
193
##############

.gitlab/ci/host-test.yml

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -297,22 +297,20 @@ test_pytest_qemu:
297297
INSTALL_EXTRA_TOOLS: "qemu-riscv32"
298298
IDF_TOOLCHAIN: [gcc, clang]
299299
script:
300-
- run_cmd python tools/ci/ci_build_apps.py . -v
300+
- run_cmd idf-ci build run
301+
--build-system cmake
301302
--target $IDF_TARGET
302-
--pytest-apps
303+
--only-test-related
303304
-m qemu
304-
--collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt"
305-
--modified-components ${MR_MODIFIED_COMPONENTS}
306305
--modified-files ${MR_MODIFIED_FILES}
307-
- python tools/ci/get_known_failure_cases_file.py
306+
- run_cmd idf-ci gitlab download-known-failure-cases-file ${KNOWN_FAILURE_CASES_FILE_NAME}
308307
- run_cmd pytest
309308
--target $IDF_TARGET
310309
--log-cli-level DEBUG
311310
-m qemu
312311
--embedded-services idf,qemu
313312
--junitxml=XUNIT_RESULT.xml
314313
--ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME}
315-
--app-info-filepattern \"list_job_*.txt\"
316314
--qemu-extra-args \"-global driver=timer.$IDF_TARGET.timg,property=wdt_disable,value=true\"
317315

318316
test_pytest_linux:
@@ -327,21 +325,18 @@ test_pytest_linux:
327325
reports:
328326
junit: XUNIT_RESULT.xml
329327
script:
330-
- run_cmd python tools/ci/ci_build_apps.py components examples tools/test_apps -v
328+
- run_cmd idf-ci build run
329+
--build-system cmake
330+
-p components -p examples -p tools/test_apps
331331
--target linux
332-
--pytest-apps
333-
-m host_test
334-
--collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt"
335-
--modified-components ${MR_MODIFIED_COMPONENTS}
332+
--only-test-related
336333
--modified-files ${MR_MODIFIED_FILES}
337-
- python tools/ci/get_known_failure_cases_file.py
334+
- run_cmd idf-ci gitlab download-known-failure-cases-file ${KNOWN_FAILURE_CASES_FILE_NAME}
338335
- run_cmd pytest
339336
--target linux
340-
-m host_test
341337
--embedded-services idf
342338
--junitxml=XUNIT_RESULT.xml
343339
--ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME}
344-
--app-info-filepattern \"list_job_*.txt\"
345340

346341
test_pytest_macos:
347342
extends:
@@ -358,41 +353,24 @@ test_pytest_macos:
358353
junit: XUNIT_RESULT.xml
359354
variables:
360355
PYENV_VERSION: "3.9"
361-
PYTEST_IGNORE_COLLECT_IMPORT_ERROR: "1"
362356
# Workaround for a bug in Parallels executor where CI_PROJECT_DIR is not an absolute path,
363357
# but a relative path to the build directory (builds/espressif/esp-idf instead of ~/builds/espressif/esp-idf.
364358
# GitLab sets the project dir to this template `<builds_dir>/<namespace>/<project_name>`
365359
IDF_PATH: "/Users/espressif/builds/espressif/esp-idf"
366360
script:
367-
- run_cmd python tools/ci/ci_build_apps.py components examples tools/test_apps -v
361+
- run_cmd idf-ci build run
362+
-p components -p examples -p tools/test_apps
363+
--build-system cmake
368364
--target linux
369-
--pytest-apps
370-
-m \"host_test and macos\"
371-
--collect-app-info "list_job_${CI_JOB_NAME_SLUG}.txt"
372-
--modified-components ${MR_MODIFIED_COMPONENTS}
365+
--only-test-related
366+
-m macos
373367
--modified-files ${MR_MODIFIED_FILES}
374-
- python tools/ci/get_known_failure_cases_file.py
368+
- run_cmd idf-ci gitlab download-known-failure-cases-file ${KNOWN_FAILURE_CASES_FILE_NAME}
375369
- run_cmd pytest
376370
--target linux
377-
-m \"host_test and macos\"
371+
-m macos
378372
--junitxml=XUNIT_RESULT.xml
379373
--ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME}
380-
--app-info-filepattern \"list_job_*.txt\"
381-
382-
test_idf_pytest_plugin:
383-
extends:
384-
- .host_test_template
385-
- .rules:patterns:idf-pytest-plugin
386-
variables:
387-
SUBMODULES_TO_FETCH: "none"
388-
artifacts:
389-
reports:
390-
junit: XUNIT_RESULT.xml
391-
script:
392-
- cd ${IDF_PATH}/tools/ci/dynamic_pipelines/tests/test_report_generator
393-
- python -m unittest test_report_generator.py
394-
- cd ${IDF_PATH}/tools/ci/idf_pytest
395-
- pytest --junitxml=${CI_PROJECT_DIR}/XUNIT_RESULT.xml
396374

397375
test_idf_build_apps_load_soc_caps:
398376
extends: .host_test_template

0 commit comments

Comments
 (0)