ci: export INCLUDE_NIGHTLY_RUN when mr got label

This commit is contained in:
Fu Hanxi 2022-07-19 16:45:21 +08:00
parent 0f08d4050d
commit a8f6cfb97d
3 changed files with 13 additions and 14 deletions

View File

@ -142,9 +142,16 @@ cache:
rm -rf ${CI_PYTHON_TOOL_REPO}
fi
.set_include_nightly_run: &set_include_nightly_run |
# in bash regex, (?:..) -> (..)
if [[ "$CI_MERGE_REQUEST_LABELS" =~ ^([^,\n\r]+,)*include_nightly_run(,[^,\n\r]+)*$ ]]; then
export INCLUDE_NIGHTLY_RUN="1"
fi
before_script:
- source tools/ci/utils.sh
- is_based_on_commits $REQUIRED_ANCESTOR_COMMITS
- *set_include_nightly_run
- source tools/ci/setup_python.sh
- add_gitlab_ssh_keys
- source tools/ci/configure_ci_environment.sh
@ -162,6 +169,7 @@ before_script:
- echo "Not setting up GitLab key, not fetching submodules"
- source tools/ci/utils.sh
- is_based_on_commits $REQUIRED_ANCESTOR_COMMITS
- *set_include_nightly_run
- source tools/ci/setup_python.sh
- source tools/ci/configure_ci_environment.sh
- *download_test_python_contraint_file
@ -172,12 +180,14 @@ before_script:
- echo "Only load utils.sh"
- source tools/ci/utils.sh
- is_based_on_commits $REQUIRED_ANCESTOR_COMMITS
- *set_include_nightly_run
.before_script_integration_test:
before_script:
# need to install esptool, needn't install idf python env
- source tools/ci/utils.sh
- is_based_on_commits $REQUIRED_ANCESTOR_COMMITS
- *set_include_nightly_run
- source tools/ci/setup_python.sh
- add_gitlab_ssh_keys
- fetch_submodules
@ -193,6 +203,7 @@ before_script:
before_script:
- source tools/ci/utils.sh
- is_based_on_commits $REQUIRED_ANCESTOR_COMMITS
- *set_include_nightly_run
- export IDF_TOOLS_PATH="${HOME}/.espressif_runner_${CI_RUNNER_ID}_${CI_CONCURRENT_ID}"
- *download_test_python_contraint_file
- $IDF_PATH/tools/idf_tools.py install-python-env
@ -211,6 +222,7 @@ before_script:
before_script:
- source tools/ci/utils.sh
- is_based_on_commits $REQUIRED_ANCESTOR_COMMITS
- *set_include_nightly_run
- source tools/ci/setup_python.sh
- add_gitlab_ssh_keys
- source tools/ci/configure_ci_environment.sh
@ -226,6 +238,7 @@ before_script:
before_script:
- source tools/ci/utils.sh
- is_based_on_commits $REQUIRED_ANCESTOR_COMMITS
- *set_include_nightly_run
- source tools/ci/setup_python.sh
- add_gitlab_ssh_keys
- source tools/ci/configure_ci_environment.sh

View File

@ -187,7 +187,6 @@ build:integration_test:
- - esp32
- esp32c3
specific_rules:
- "if-include_nightly_run-rule"
- "if-example_test-ota-include_nightly_run-rule"
included_in:
- "build:example_test-{0}"

View File

@ -254,13 +254,6 @@
#####################
# Specific if rules #
#####################
# Inlcude nightly run cases by labels `include_nightly_run` or `target_test`
.if-include_nightly_run-rule: &if-include_nightly_run-rule
if: '$INCLUDE_NIGHTLY_RUN || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*include_nightly_run(?:,[^,\n\r]+)*$/i || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*target_test(?:,[^,\n\r]+)*$/i'
variables:
INCLUDE_NIGHTLY_RUN: "1"
.if-example_test-ota-include_nightly_run-rule: &if-example_test-ota-include_nightly_run-rule
<<: *if-dev-push
changes: *patterns-example_test-ota-nightly_run
@ -749,7 +742,6 @@
when: never
- <<: *if-protected
- <<: *if-example_test-ota-include_nightly_run-rule
- <<: *if-include_nightly_run-rule
- <<: *if-label-build
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32
@ -781,7 +773,6 @@
when: never
- <<: *if-protected
- <<: *if-example_test-ota-include_nightly_run-rule
- <<: *if-include_nightly_run-rule
- <<: *if-label-build
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32
@ -828,7 +819,6 @@
when: never
- <<: *if-protected
- <<: *if-example_test-ota-include_nightly_run-rule
- <<: *if-include_nightly_run-rule
- <<: *if-label-build
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32c3
@ -952,7 +942,6 @@
when: never
- <<: *if-protected
- <<: *if-example_test-ota-include_nightly_run-rule
- <<: *if-include_nightly_run-rule
- <<: *if-label-build
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32
@ -1914,7 +1903,6 @@
- <<: *if-label-build-only
when: never
- <<: *if-example_test-ota-include_nightly_run-rule
- <<: *if-include_nightly_run-rule
.rules:test:example_test-esp32-sdio:
rules:
@ -2048,7 +2036,6 @@
- <<: *if-label-build-only
when: never
- <<: *if-example_test-ota-include_nightly_run-rule
- <<: *if-include_nightly_run-rule
.rules:test:example_test-esp32c3-sdio:
rules: