Merge branch 'restructure_modbus_ci' into 'main'

Restructuring Modbus CI

See merge request idf/esp-modbus!166
This commit is contained in:
Alex Lisitsyn
2026-03-02 10:15:44 +00:00
6 changed files with 381 additions and 375 deletions
+36 -375
View File
@@ -37,384 +37,45 @@ variables:
# - "tcp_p4"
# - "serial_p4"
.setup_idf_tools: &setup_idf_tools |
tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
# Shared script helpers (referenced from included files via !reference)
.setup_idf_tools_script:
script:
- tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
.add_gh_key_remote: &add_gh_key_remote |
command -v ssh-agent >/dev/null || exit 1
eval $(ssh-agent -s)
printf '%s\n' "${GH_PUSH_KEY}" | tr -d '\r' | ssh-add - > /dev/null
mkdir -p ~/.ssh && chmod 700 ~/.ssh
[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config || ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
git remote remove github || true
git remote add github ${GH_PUSH_REPO}
.add_gh_key_remote_script:
script:
- |
command -v ssh-agent >/dev/null || exit 1
eval $(ssh-agent -s)
printf '%s\n' "${GH_PUSH_KEY}" | tr -d '\r' | ssh-add - > /dev/null
mkdir -p ~/.ssh && chmod 700 ~/.ssh
[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config || ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
git remote remove github || true
git remote add github ${GH_PUSH_REPO}
.check_idf_ver_script:
script:
- |
export IDF_PATH=$(find /opt -type d -name "*idf*" \
\( -exec test -f '{}/tools/idf.py' \; -and -exec test -f '{}/tools/idf_tools.py' \; \
\) -print -quit)
if [ -z "${IDF_PATH}" ];then
echo "IDF version is not found."
else
cd ${IDF_PATH}
export IDF_DESCRIBE=$(git describe)
export IDF_VERSION=${IDF_DESCRIBE%-*}
echo "$IDF_VERSION" >> $TEST_DIR/idf_version_info.txt
echo "ESP-IDF: $IDF_VERSION"
fi
after_script:
# Just for cleaning space, no other causes
- git clean -ffdx
.build_template:
stage: build
tags:
- build
variables:
SIZE_INFO_LOCATION: "${TEST_DIR}/size_info.txt"
IDF_CCACHE_ENABLE: "1"
after_script:
# Show ccache statistics if enabled globally
- test "$CI_CCACHE_STATS" == 1 && test -n "$(which ccache)" && ccache --show-stats || true
dependencies: []
.check_idf_ver: &check_idf_ver |
export IDF_PATH=$(find /opt -type d -name "*idf*" \
\( -exec test -f '{}/tools/idf.py' \; -and -exec test -f '{}/tools/idf_tools.py' \; \
\) -print -quit)
if [ -z "${IDF_PATH}" ];then
echo "IDF version is not found."
else
cd ${IDF_PATH}
export IDF_DESCRIBE=$(git describe)
export IDF_VERSION=${IDF_DESCRIBE%-*}
echo "$IDF_VERSION" >> $TEST_DIR/idf_version_info.txt
echo "ESP-IDF: $IDF_VERSION"
fi
.before_script_build_jobs:
before_script:
- *check_idf_ver
- *setup_idf_tools
#- COMPOTE_VER_START=$(compote version)
#- pip install idf-component-manager --upgrade # to avoid the issue with component manager v2.4.3
- pip install "idf_build_apps" --upgrade
- COMPOTE_VER=$(compote version)
- echo "Component manager version ${COMPOTE_VER}"
- PIP_VERS=$(python -m pip freeze)
- echo "PIP component versions ${PIP_VERS}"
# Allows to debug jobs overriding the ESP_MODBUS_CONFIG_KEY to ESP_MODBUS_CONFIG_VALUE
# in all registered application configs that match the pattern ESP_MODBUS_CONFIG_PATTERN
- echo "Setup job with parameters ${ESP_MODBUS_CONFIG_KEY}, ${ESP_MODBUS_CONFIG_VALUE}, ${ESP_MODBUS_CONFIG_PATTERN}"
- ${TEST_DIR}/tools/setup_config_key.sh "${ESP_MODBUS_CONFIG_KEY}" "${ESP_MODBUS_CONFIG_VALUE}" "${ESP_MODBUS_CONFIG_PATTERN}"
# Note: this script builds the folder against all targets and then deletes
# all other artifacts except the esp32 to decrease the size of artifacs (may cause failures)
.build_cur_folder: &build_cur_folder |
echo "Build job ${CI_JOB_NAME}, folder: ${PWD##*/}, targets: ${TEST_TARGETS}"
python -m idf_build_apps build -v -p . \
--recursive \
--target all \
--default-build-targets ${TEST_TARGETS} \
--config "sdkconfig.ci.*=" \
--build-dir "build_@t_@w" \
--build-log build_log.txt \
--check-warnings \
--ignore-warning-file ${TEST_DIR}/tools/ignore_build_warnings.txt \
--collect-size-info $SIZE_INFO_LOCATION \
--manifest-rootpath . \
--manifest-file .build-test-rules.yml \
--parallel-count ${CI_NODE_TOTAL:-1} \
--parallel-index ${CI_NODE_INDEX:-1}
echo "delete build folders:" $(find . -type d -regex '^\./.*build_esp32[a-or-z]+[0-9]+[_a-z]*' -print -exec rm -rf {} +)
ls -lh > test_dir_${PWD##*/}.txt
# This template gets expanded multiple times, once for every IDF version.
# IDF version is specified by setting the espressif/idf image tag.
#
# TEST_TARGETS sets the list of IDF_TARGET values to build the test for.
# It should contain only the targets with optimized assembly implementations.
#
.build_pytest_template:
stage: build
extends:
- .build_template
- .before_script_build_jobs
needs:
- job: check_pre_commit
artifacts: false
optional: true
script:
# The script below will build all test applications defined in environment variable $TEST_TARGETS
- cd ${TEST_DIR}/test_apps
- *build_cur_folder
- cd ${TEST_DIR}/examples
- export TEST_TARGETS="esp32" # override to build only on esp32 target to decrease build time
- *build_cur_folder
variables:
TEST_TARGETS: "esp32"
dependencies: []
artifacts:
name: artifacts_${CI_JOB_NAME}
paths:
- "**/build*/size.json"
- "**/build*/build.log"
- "**/build*/build_log.txt"
- "**/build*/*.bin"
- "**/build*/*.elf"
- "**/build*/*.map"
- "**/build*/flasher_args.json"
- "**/build*/flash_project_args"
- "**/build*/config/sdkconfig.json"
- "**/build*/bootloader/*.bin"
- "**/build*/partition_table/*.bin"
- "**/idf_version_info.txt"
- "**/test_dir*.txt"
- "**/warnings.txt"
- $SIZE_INFO_LOCATION
when: always
expire_in: 3 weeks
.before_static_analyzer_build:
before_script:
- pip install --upgrade pyclang
- ${IDF_PATH}/tools/idf_tools.py --non-interactive install esp-clang
- . $IDF_PATH/export.sh
.check_pre_commit_template:
stage: pre_check
image: $ESP_DOCS_ENV_IMAGE
script:
- pip install pre-commit
- TARGET_BRANCH=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-main}
- git fetch origin $TARGET_BRANCH --depth=1 || true
- git fetch origin $CI_COMMIT_REF_NAME --depth=1 || true
- |
echo "Target branch: $TARGET_BRANCH"
echo "Source branch: $CI_COMMIT_REF_NAME"
RANGE="origin/$TARGET_BRANCH...origin/$CI_COMMIT_REF_NAME"
MODIFIED_FILES=$(git diff --name-only $RANGE | tr '\n' ' ')
echo "Modified files to check: $MODIFIED_FILES"
if [ -n "$MODIFIED_FILES" ]; then
CI=true pre-commit run --files $MODIFIED_FILES
else
echo "No modified files to check."
fi
check_pre_commit:
extends:
- .check_pre_commit_template
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == "main"
when: never # Skip pre-commit on main
- when: never # Skip excplicitly on other cases
needs: []
after_script: []
build_static_analyzer_idf_latest:
tags:
- build
stage: pre_check
extends:
- .before_static_analyzer_build
image: espressif/idf:latest
needs:
- job: check_pre_commit
optional: true
artifacts:
name: artifacts_${CI_JOB_NAME}
paths:
- "${TEST_DIR}/**/idf_version_info.txt"
- "${TEST_DIR}/**/warnings.txt"
- "${TEST_DIR}/**/sdkconfig"
when: always
expire_in: 3 weeks
parallel:
matrix:
- !reference [.options_list, analyzers]
script:
- *check_idf_ver
- cd ${TEST_DIR}/examples
- ${TEST_DIR}/tools/static_analyzer_check.sh ${ANALYZER_TYPE}
after_script: []
build_idf_latest:
extends: .build_pytest_template
image: espressif/idf:latest
variables:
TEST_TARGETS: "esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c5 esp32c6 esp32h2 esp32p4"
build_idf_v5.5:
extends: .build_pytest_template
image: espressif/idf:release-v5.5
variables:
TEST_TARGETS: "esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6 esp32h2 esp32p4"
build_idf_v5.3:
extends: .build_pytest_template
image: espressif/idf:release-v5.3
variables:
TEST_TARGETS: "esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6 esp32h2 esp32p4"
.target_test_template:
stage: target_test
timeout: 1 hour
variables:
GIT_DEPTH: 1
SUBMODULES_TO_FETCH: "none"
cache:
# Usually do not need submodule-cache in target_test
- key: pip-cache
paths:
- .cache/pip
policy: pull
.before_script_pytest_jobs:
before_script:
# Install or upgrade pytest-embedded to perform test cases
- pip install -r ${TEST_DIR}/tools/test_requirements.txt
.test_cur_folder: &test_cur_folder |
export IDF_VER=$(cat ${TEST_DIR}/idf_version_info.txt)
echo "Start test job: ${CI_JOB_NAME}, version: ${IDF_VER%-*}, folder: ${PWD##*/}"
echo "Check built artifacts:" $(find . -type d -regex '^\./.*build_esp32[a-z]*[0-9]*[_a-z]*' -print)
python -m pytest --junit-xml=${TEST_DIR}/${PWD##*/}/results_${IDF_VER%-*}_${PWD##*/}.xml -m multi_dut_modbus_${TEST_MARKER}
ls -lh > test_dir_${PWD##*/}.txt
.test_template:
image: "$CI_DOCKER_REGISTRY/target-test-env-v5.3:1"
stage: target_test
extends:
- .before_script_pytest_jobs
tags:
- multi_dut_modbus_${TEST_MARKER}
script:
- cd ${TEST_DIR}/test_apps/
- *test_cur_folder
- cd ${TEST_DIR}/examples/
- *test_cur_folder
artifacts:
name: artifacts_${CI_JOB_NAME}
paths:
- "${TEST_DIR}/**/*.log"
- "${TEST_DIR}/**/*.xml"
- "${TEST_DIR}/**/results_*.xml"
- "${TEST_DIR}/**/pytest_embedded_log/"
- "${TEST_DIR}/**/test_dir*.txt"
- "${TEST_DIR}/**/idf_version_info.txt"
- "${TEST_DIR}/**/log.html" # robot framework related files
- "${TEST_DIR}/**/report.html"
- "${TEST_DIR}/**/*.pcap"
- "${TEST_DIR}/**/*.png"
when: always
expire_in: 1 week
target_test_latest:
stage: target_test
image: "$CI_DOCKER_REGISTRY/target-test-env-v6.0:2"
extends: .test_template
parallel:
matrix:
- !reference [.options_list, markers]
needs:
- job: build_idf_latest
artifacts: true
after_script: []
target_test_v5.5:
stage: target_test
image: "$CI_DOCKER_REGISTRY/target-test-env-v5.5:2"
extends: .test_template
parallel:
matrix:
- !reference [.options_list, markers]
needs:
- job: build_idf_v5.5
artifacts: true
after_script: []
target_test_v5.3:
stage: target_test
image: "$CI_DOCKER_REGISTRY/target-test-env-v5.3:1"
extends: .test_template
parallel:
matrix:
- !reference [.options_list, markers]
needs:
- job: build_idf_v5.3
artifacts: true
after_script: []
build_docs:
stage: build
image: $ESP_DOCS_ENV_IMAGE
tags:
- build_docs
artifacts:
when: always
paths:
- docs/_build/*/*/*.txt
- docs/_build/*/*/html/*
expire_in: 4 days
# No cleaning when the artifacts
after_script: []
script:
- cd docs
- pip install -r requirements.txt
- ./generate_docs
.deploy_docs_template:
stage: deploy
image: $ESP_DOCS_ENV_IMAGE
tags:
- deploy_docs
needs:
- build_docs
script:
- source ${CI_PROJECT_DIR}/docs/utils.sh
- add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER
- export GIT_VER=$(git describe --always)
- export GIT_TAGS=$(git fetch --tags; git tag -l;)
- echo "Deploy ${PWD##*/}, ${DOCS_BUILD_DIR}, Ref name; ${CI_COMMIT_REF_NAME}"
- echo "Version; ${GIT_VER}, tags; ${GIT_TAGS}"
- pip install -r ${CI_PROJECT_DIR}/docs/requirements.txt
- deploy-docs
deploy_docs_preview:
extends:
- .deploy_docs_template
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- "docs/**/*"
variables:
TYPE: "preview"
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PREVIEW_PRIVATEKEY"
DOCS_DEPLOY_SERVER: "$DOCS_PREVIEW_SERVER"
DOCS_DEPLOY_SERVER_USER: "$DOCS_PREVIEW_SERVER_USER"
DOCS_DEPLOY_PATH: "$DOCS_PREVIEW_PATH"
DOCS_DEPLOY_URL_BASE: "$DOCS_PREVIEW_URL_BASE"
deploy_docs_production:
extends:
- .deploy_docs_template
rules:
- if: $CI_COMMIT_BRANCH == "main"
changes:
- "docs/**/*"
- when: never # Do not run on any other branch or without changes
variables:
TYPE: "production"
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PROD_DEPLOY_KEY"
DOCS_DEPLOY_SERVER: "$DOCS_PROD_SERVER"
DOCS_DEPLOY_SERVER_USER: "$DOCS_PROD_SERVER_USER"
DOCS_DEPLOY_PATH: "$DOCS_PROD_PATH"
DOCS_DEPLOY_URL_BASE: "https://docs.espressif.com/projects/esp-modbus"
upload_to_component_manager:
stage: deploy
image: python:3.10-alpine
tags:
- deploy
rules:
- if: '$CI_COMMIT_BRANCH == "main"' # the main branch is a component release branch for v2
- if: '$FORCE_PUSH_COMPONENT == "1"'
when: manual
allow_failure: true
script:
- pip install idf-component-manager
- export IDF_COMPONENT_API_TOKEN=${ESP_MODBUS_API_KEY}
- export COMP_VERSION=$(grep 'version:' idf_component.yml | head -n 1 | awk '{print $2}' | tr -d '"')
- compote component upload --namespace=espressif --name=esp-modbus --allow-existing --version=${COMP_VERSION}
include:
- local: ".gitlab/ci/pre-check.yml"
- local: ".gitlab/ci/ci-build.yml"
- local: ".gitlab/ci/docs.yml"
- local: ".gitlab/ci/test.yml"
- local: ".gitlab/ci/deploy.yml"
+110
View File
@@ -0,0 +1,110 @@
.build_template:
stage: build
tags:
- build
variables:
SIZE_INFO_LOCATION: "${TEST_DIR}/size_info.txt"
IDF_CCACHE_ENABLE: "1"
after_script:
- test "$CI_CCACHE_STATS" == 1 && test -n "$(which ccache)" && ccache --show-stats || true
dependencies: []
.build_cur_folder_script:
script:
- |
echo "Build job ${CI_JOB_NAME}, folder: ${PWD##*/}, targets: ${TEST_TARGETS}"
python -m idf_build_apps build -v -p . \
--recursive \
--target all \
--default-build-targets ${TEST_TARGETS} \
--config "sdkconfig.ci.*=" \
--build-dir "build_@t_@w" \
--build-log build_log.txt \
--check-warnings \
--ignore-warning-file ${TEST_DIR}/tools/ignore_build_warnings.txt \
--collect-size-info $SIZE_INFO_LOCATION \
--manifest-rootpath . \
--manifest-file .build-test-rules.yml \
--parallel-count ${CI_NODE_TOTAL:-1} \
--parallel-index ${CI_NODE_INDEX:-1}
echo "delete build folders:" $(find . -type d -regex '^\./.*build_esp32[a-or-z]+[0-9]+[_a-z]*' -print -exec rm -rf {} +)
ls -lh > test_dir_${PWD##*/}.txt
.before_script_build_jobs:
before_script:
- !reference [.check_idf_ver_script, script]
- !reference [.setup_idf_tools_script, script]
#- COMPOTE_VER_START=$(compote version)
#- pip install idf-component-manager --upgrade # to avoid the issue with component manager v2.4.3
- pip install "idf_build_apps" --upgrade
- COMPOTE_VER=$(compote version)
- echo "Component manager version ${COMPOTE_VER}"
- PIP_VERS=$(python -m pip freeze)
- echo "PIP component versions ${PIP_VERS}"
# Allows to debug jobs overriding the ESP_MODBUS_CONFIG_KEY to ESP_MODBUS_CONFIG_VALUE
# in all registered application configs that match the pattern ESP_MODBUS_CONFIG_PATTERN
- echo "Setup job with parameters ${ESP_MODBUS_CONFIG_KEY}, ${ESP_MODBUS_CONFIG_VALUE}, ${ESP_MODBUS_CONFIG_PATTERN}"
- ${TEST_DIR}/tools/setup_config_key.sh "${ESP_MODBUS_CONFIG_KEY}" "${ESP_MODBUS_CONFIG_VALUE}" "${ESP_MODBUS_CONFIG_PATTERN}"
# This template gets expanded multiple times, once for every IDF version.
# IDF version is specified by setting the espressif/idf image tag.
#
# TEST_TARGETS sets the list of IDF_TARGET values to build the test for.
# It should contain only the targets with optimized assembly implementations.
#
.build_pytest_template:
stage: build
extends:
- .build_template
- .before_script_build_jobs
needs:
- job: check_pre_commit
artifacts: false
optional: true
script:
- cd ${TEST_DIR}/test_apps
- !reference [.build_cur_folder_script, script]
- cd ${TEST_DIR}/examples
- export TEST_TARGETS="esp32" # override to build only on esp32 target to decrease build time
- !reference [.build_cur_folder_script, script]
variables:
TEST_TARGETS: "esp32"
dependencies: []
artifacts:
name: artifacts_${CI_JOB_NAME}
paths:
- "**/build*/size.json"
- "**/build*/build.log"
- "**/build*/build_log.txt"
- "**/build*/*.bin"
- "**/build*/*.elf"
- "**/build*/*.map"
- "**/build*/flasher_args.json"
- "**/build*/flash_project_args"
- "**/build*/config/sdkconfig.json"
- "**/build*/bootloader/*.bin"
- "**/build*/partition_table/*.bin"
- "**/idf_version_info.txt"
- "**/test_dir*.txt"
- "**/warnings.txt"
- $SIZE_INFO_LOCATION
when: always
expire_in: 3 weeks
build_idf_latest:
extends: .build_pytest_template
image: espressif/idf:latest
variables:
TEST_TARGETS: "esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c5 esp32c6 esp32h2 esp32p4"
build_idf_v5.5:
extends: .build_pytest_template
image: espressif/idf:release-v5.5
variables:
TEST_TARGETS: "esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6 esp32h2 esp32p4"
build_idf_v5.3:
extends: .build_pytest_template
image: espressif/idf:release-v5.3
variables:
TEST_TARGETS: "esp32 esp32s2 esp32s3 esp32c2 esp32c3 esp32c6 esp32h2 esp32p4"
+65
View File
@@ -0,0 +1,65 @@
.deploy_docs_template:
stage: deploy
image: $ESP_DOCS_ENV_IMAGE
tags:
- deploy_docs
needs:
- build_docs
script:
- source ${CI_PROJECT_DIR}/docs/utils.sh
- add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER
- export GIT_VER=$(git describe --always)
- export GIT_TAGS=$(git fetch --tags; git tag -l;)
- echo "Deploy ${PWD##*/}, ${DOCS_BUILD_DIR}, Ref name; ${CI_COMMIT_REF_NAME}"
- echo "Version; ${GIT_VER}, tags; ${GIT_TAGS}"
- pip install -r ${CI_PROJECT_DIR}/docs/requirements.txt
- deploy-docs
deploy_docs_preview:
extends:
- .deploy_docs_template
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- "docs/**/*"
variables:
TYPE: "preview"
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PREVIEW_PRIVATEKEY"
DOCS_DEPLOY_SERVER: "$DOCS_PREVIEW_SERVER"
DOCS_DEPLOY_SERVER_USER: "$DOCS_PREVIEW_SERVER_USER"
DOCS_DEPLOY_PATH: "$DOCS_PREVIEW_PATH"
DOCS_DEPLOY_URL_BASE: "$DOCS_PREVIEW_URL_BASE"
deploy_docs_production:
extends:
- .deploy_docs_template
rules:
- if: $CI_COMMIT_BRANCH == "main"
changes:
- "docs/**/*"
- when: never # Do not run on any other branch or without changes
variables:
TYPE: "production"
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PROD_DEPLOY_KEY"
DOCS_DEPLOY_SERVER: "$DOCS_PROD_SERVER"
DOCS_DEPLOY_SERVER_USER: "$DOCS_PROD_SERVER_USER"
DOCS_DEPLOY_PATH: "$DOCS_PROD_PATH"
DOCS_DEPLOY_URL_BASE: "https://docs.espressif.com/projects/esp-modbus"
upload_to_component_manager:
stage: deploy
image: python:3.10-alpine
tags:
- deploy
rules:
- if: '$CI_COMMIT_BRANCH == "main"' # the main branch is a component release branch for v2
- if: '$FORCE_PUSH_COMPONENT == "1"'
when: manual
allow_failure: true
script:
- pip install idf-component-manager
- export IDF_COMPONENT_API_TOKEN=${ESP_MODBUS_API_KEY}
- export COMP_VERSION=$(grep 'version:' idf_component.yml | head -n 1 | awk '{print $2}' | tr -d '"')
- compote component upload --namespace=espressif --name=esp-modbus --allow-existing --version=${COMP_VERSION}
+16
View File
@@ -0,0 +1,16 @@
build_docs:
stage: build
image: $ESP_DOCS_ENV_IMAGE
tags:
- build_docs
artifacts:
when: always
paths:
- docs/_build/*/*/*.txt
- docs/_build/*/*/html/*
expire_in: 4 days
after_script: []
script:
- cd docs
- pip install -r requirements.txt
- ./generate_docs
+65
View File
@@ -0,0 +1,65 @@
.check_pre_commit_template:
stage: pre_check
image: $ESP_DOCS_ENV_IMAGE
script:
- pip install pre-commit
- TARGET_BRANCH=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-main}
- git fetch origin $TARGET_BRANCH --depth=1 || true
- git fetch origin $CI_COMMIT_REF_NAME --depth=1 || true
- |
echo "Target branch: $TARGET_BRANCH"
echo "Source branch: $CI_COMMIT_REF_NAME"
RANGE="origin/$TARGET_BRANCH...origin/$CI_COMMIT_REF_NAME"
MODIFIED_FILES=$(git diff --name-only $RANGE | tr '\n' ' ')
echo "Modified files to check: $MODIFIED_FILES"
if [ -n "$MODIFIED_FILES" ]; then
CI=true pre-commit run --files $MODIFIED_FILES
else
echo "No modified files to check."
fi
check_pre_commit:
extends:
- .check_pre_commit_template
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == "main"
when: never # Skip pre-commit on main
- when: never # Skip explicitly on other cases
needs: []
after_script: []
.before_static_analyzer_build:
before_script:
- pip install --upgrade pyclang
- ${IDF_PATH}/tools/idf_tools.py --non-interactive install esp-clang
- . $IDF_PATH/export.sh
build_static_analyzer_idf_latest:
tags:
- build
stage: pre_check
extends:
- .before_static_analyzer_build
image: espressif/idf:latest
needs:
- job: check_pre_commit
optional: true
artifacts:
name: artifacts_${CI_JOB_NAME}
paths:
- "${TEST_DIR}/**/idf_version_info.txt"
- "${TEST_DIR}/**/warnings.txt"
- "${TEST_DIR}/**/sdkconfig"
when: always
expire_in: 3 weeks
parallel:
matrix:
- !reference [.options_list, analyzers]
script:
- !reference [.check_idf_ver_script, script]
- cd ${TEST_DIR}/examples
- ${TEST_DIR}/tools/static_analyzer_check.sh ${ANALYZER_TYPE}
after_script: []
+89
View File
@@ -0,0 +1,89 @@
.target_test_template:
stage: target_test
timeout: 1 hour
variables:
GIT_DEPTH: 1
SUBMODULES_TO_FETCH: "none"
cache:
# Usually do not need submodule-cache in target_test
- key: pip-cache
paths:
- .cache/pip
policy: pull
.before_script_pytest_jobs:
before_script:
- pip install -r ${TEST_DIR}/tools/test_requirements.txt
.test_cur_folder_script:
script:
- |
export IDF_VER=$(cat ${TEST_DIR}/idf_version_info.txt)
echo "Start test job: ${CI_JOB_NAME}, version: ${IDF_VER%-*}, folder: ${PWD##*/}"
echo "Check built artifacts:" $(find . -type d -regex '^\./.*build_esp32[a-z]*[0-9]*[_a-z]*' -print)
python -m pytest --junit-xml=${TEST_DIR}/${PWD##*/}/results_${IDF_VER%-*}_${PWD##*/}.xml -m multi_dut_modbus_${TEST_MARKER}
ls -lh > test_dir_${PWD##*/}.txt
.test_template:
image: "$CI_DOCKER_REGISTRY/target-test-env-v5.3:1"
stage: target_test
extends:
- .before_script_pytest_jobs
tags:
- multi_dut_modbus_${TEST_MARKER}
script:
- cd ${TEST_DIR}/test_apps/
- !reference [.test_cur_folder_script, script]
- cd ${TEST_DIR}/examples/
- !reference [.test_cur_folder_script, script]
artifacts:
name: artifacts_${CI_JOB_NAME}
paths:
- "${TEST_DIR}/**/*.log"
- "${TEST_DIR}/**/*.xml"
- "${TEST_DIR}/**/results_*.xml"
- "${TEST_DIR}/**/pytest_embedded_log/"
- "${TEST_DIR}/**/test_dir*.txt"
- "${TEST_DIR}/**/idf_version_info.txt"
- "${TEST_DIR}/**/log.html" # robot framework related files
- "${TEST_DIR}/**/report.html"
- "${TEST_DIR}/**/*.pcap"
- "${TEST_DIR}/**/*.png"
when: always
expire_in: 1 week
target_test_latest:
stage: target_test
image: "$CI_DOCKER_REGISTRY/target-test-env-v6.0:2"
extends: .test_template
parallel:
matrix:
- !reference [.options_list, markers]
needs:
- job: build_idf_latest
artifacts: true
after_script: []
target_test_v5.5:
stage: target_test
image: "$CI_DOCKER_REGISTRY/target-test-env-v5.5:2"
extends: .test_template
parallel:
matrix:
- !reference [.options_list, markers]
needs:
- job: build_idf_v5.5
artifacts: true
after_script: []
target_test_v5.3:
stage: target_test
image: "$CI_DOCKER_REGISTRY/target-test-env-v5.3:1"
extends: .test_template
parallel:
matrix:
- !reference [.options_list, markers]
needs:
- job: build_idf_v5.3
artifacts: true
after_script: []