Преглед изворни кода

add README.md to explain how to add/modify jobs/rules/ifs

- rename existing labels to fit the naming convention
Fu Hanxi пре 5 година
родитељ
комит
3026d562ec

+ 135 - 0
tools/ci/config/README.md

@@ -0,0 +1,135 @@
+# Rules for `rules.yml`
+
+- [Rules for `rules.yml`](#rules-for-rulesyml)
+  - [How to Develop With `rules.yml`?](#how-to-develop-with-rulesyml)
+    - [How to Add a New `Job`?](#how-to-add-a-new-job)
+    - [How to Add a New `Rules` Template?](#how-to-add-a-new-rules-template)
+    - [How to Add a New `if` Anchor?](#how-to-add-a-new-if-anchor)
+  - [Naming Rules](#naming-rules)
+    - [Common Naming Rules](#common-naming-rules)
+    - [`if` Anchors Naming Rules](#if-anchors-naming-rules)
+      - [Common Phrases/Abbreviations](#common-phrasesabbreviations)
+    - [`rules` Template Naming Rules](#rules-template-naming-rules)
+  - [Reusable Shell Script `tools/ci/utils.sh`](#reusable-shell-script-toolsciutilssh)
+    - [Functions](#functions)
+      - [CI Job Related](#ci-job-related)
+      - [Shell Script Related](#shell-script-related)
+
+## How to Develop With `rules.yml`?
+
+### How to Add a New `Job`?
+
+check if there's a suitable `.rules:<rules-you-need>` template
+
+1. if there is, put this in the job `extends`. All done, now you can close this window. (`extends` could be array or string)
+2. if there isn't
+   1. check [How to Add a New `Rules` Template?](#how-to-add-a-new-rules-template), create a suitable one
+   2. follow step 1
+
+### How to Add a New `Rules` Template?
+
+check if there's a suitable `.if-<if-anchor-you-need>` anchor
+
+ 1. if there is, create a rule following [`rules` Template Naming Rules](#rules-template-naming-rules).For detail information, please refer to [GitLab Documentation `rules-if`](https://docs.gitlab.com/ee/ci/yaml/README.html#rulesif). Here's an example.
+
+```yaml
+.rules:dev:
+rules:
+  - <<: *if-trigger
+  - <<: *if-dev-push
+```
+
+2. if there isn't
+
+   1. check [How to Add a New `if` Anchor?](#how-to-add-a-new-if-anchor), create a suitable one
+   2. follow step 1
+
+### How to Add a New `if` Anchor?
+
+Create an `if` anchor following [`if` Anchors Naming Rules](#if-anchors-naming-rules). For detail information about how to write the condition clause, please refer to [GitLab Documentation `only/except (advanced)](https://docs.gitlab.com/ee/ci/yaml/README.html#onlyexcept-advanced). Here's an example.
+
+```yaml
+.if-schedule: &if-schedule:
+  if: '$CI_PIPELINE_SOURCE == "schedule"'
+```
+
+## Naming Rules
+
+### Common Naming Rules
+
+if a phrase has multi words, use `_` to concat them.
+
+> e.g. `regular_test`
+
+if a name have multi phrase, use `-` to concat them.
+
+> e.g. `regular_test-example_test`
+
+### `if` Anchors Naming Rules
+
+- if it's a label: `.if-label-<label_name>`
+- if it's a ref: `.if-ref-<ref_name>`
+- if it's a branch: `.if-branch-<branch_name>`
+- if it's a tag: `.if-tag-<tag_name>`
+- if it's a operating system: `.if-os-mac`
+- if it's multi-type combination: `.if-ref-<release_name>-branch-<branch_name>`
+
+#### Common Phrases/Abbreviations
+
+- `no_label`
+
+   `$BOT_TRIGGER_WITH_LABEL == null`
+
+- `protected`
+
+  `($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/)`
+
+-  `target_test`
+
+   `example_test` or `custom_test` or `unit_test-all_targets`
+
+### `rules` Template Naming Rules
+
+- if it's os related: `.rules:os:<os_name>`
+- if it's tag related: `.rules:tag:<tag_1>-<tag_2>`
+- if it's label related: `.rules:labels:<label_1>-<label_2>`
+
+    By default, all `.rules:labels` should include both `if-label-regular_test` and `if-protected-no-label` implicitly, unless they have special postfixes:
+
+    - slim: `regular_test` not included
+    - only: only have the phrases listed
+
+- if it's target test related: `.rules:tests:<test_type_1>-<test_type_2>`
+
+    By default, all `.rules:tests` should include `if-protected-no_label` implicitly, unless they have special postfixes (same as above)
+
+- if it needs to build at first, then do some target test: `.rules:build_tests:<test_type_1>-<test_type_2>`
+
+    By default, all `.rules:build_tests` should include `if-protected-no-label`, `if-label-build`, `if-label-regular-test` implictly, unless they have special postfixes (same as above)
+
+- if a job supports all targets, use `-all_targets` as postfix
+
+## Reusable Shell Script `tools/ci/utils.sh`
+
+It is used to put all the reusable shell script as small functions. If you want to set `before_script: []` for you job, now you can set `extends: .before_script_slim` instead. it will only run `source tools/ci/utils.sh`
+
+If you're developing CI shell scripts, you can use these functions without source. They're already included in all `before_script`
+
+To run these commands in shell script locally, place `source tools/ci/utils.sh` at the very beginning.
+
+### Functions
+
+#### CI Job Related
+- `apply_bot_filter`
+- `add_gitlab_ssh_keys`
+- `add_github_ssh_keys`
+- `add_doc_server_ssh_keys`
+- `fetch_submodules`
+- `get_all_submodules`
+
+#### Shell Script Related
+- `error`: log in red color
+- `warning`: log in orange color
+- `info`: log in green color
+- `run_cmd`: run the command with duration seconds info
+- `retry_failed`: run the command with duration seconds info, retry when failed

+ 2 - 2
tools/ci/config/assign-test.yml

@@ -1,6 +1,6 @@
 assign_test:
   extends:
-    - .rules:test:target_test-weekend_test
+    - .rules:tests:target_test-integration_test-weekend_test
   tags:
     - assign_test
   image: $CI_DOCKER_REGISTRY/ubuntu-test-env$BOT_DOCKER_IMAGE_TAG
@@ -49,7 +49,7 @@ assign_test:
     - python ${ASSIGN_TEST_CASE_SCRIPT} -t ${INTEGRATION_TEST_CASE_PATH} -c $CI_TARGET_TEST_CONFIG_FILE -b $IDF_PATH/SSC/ssc_bin -o $INTEGRATION_CONFIG_OUTPUT_PATH
 
 update_test_cases:
-  extends: .rules:master-schedule
+  extends: .rules:ref:master-schedule
   stage: assign_test
   image: $CI_DOCKER_REGISTRY/ubuntu-test-env
   tags:

+ 10 - 10
tools/ci/config/build.yml

@@ -62,7 +62,7 @@ check_docs_gh_links:
 .build_ssc_template:
   extends:
     - .build_template
-    - .rules:labels:build-integration_test
+    - .rules:build_tests:integration_test
   artifacts:
     paths:
       - SSC/ssc_bin
@@ -88,7 +88,7 @@ build_ssc_esp32s2:
 .build_esp_idf_tests_cmake:
   extends:
     - .build_template
-    - .rules:labels:build-unit_test
+    - .rules:build_tests:unit_test
   artifacts:
     paths:
       - tools/unit-test-app/output/${IDF_TARGET}
@@ -131,7 +131,7 @@ build_esp_idf_tests_cmake_esp32s3:
 .build_examples_template:
   extends:
     - .build_template
-    - .rules:labels:build-example_test-weekend_test
+    - .rules:build_tests:example_test-weekend_test
   variables:
     TEST_PREFIX: examples
     TEST_RELATIVE_DIR: examples
@@ -202,7 +202,7 @@ build_examples_cmake_esp32s2:
 .build_test_apps:
   extends:
     - .build_examples_cmake
-    - .rules:labels:build-custom_test-weekend_test
+    - .rules:build_tests:custom_test-weekend_test
   variables:
     TEST_PREFIX: test_apps
     TEST_RELATIVE_DIR: tools/test_apps
@@ -225,7 +225,7 @@ build_test_apps_esp32s2:
 .build_component_ut:
   extends:
     - .build_test_apps
-    - .rules:labels:build-unit_test
+    - .rules:build_tests:unit_test
   variables:
     TEST_PREFIX: component_ut
     TEST_RELATIVE_DIR: component_ut
@@ -282,7 +282,7 @@ build_docs_pdf:
 .test_build_system_template:
   extends:
     - .build_template
-    - .rules:labels:build-weekend_test
+    - .rules:build_tests:weekend_test
   script:
     - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
     - rm -rf test_build_system
@@ -311,7 +311,7 @@ test_build_system_cmake_macos:
 build_docker:
   extends:
     - .before_script_slim
-    - .rules:master-release-schedule
+    - .rules:protected-schedule
   stage: build
   image: espressif/docker-builder:1
   tags:
@@ -333,7 +333,7 @@ build_docker:
 .test-on-windows:
   extends:
     - .before_script_slim
-    - .rules:master-release-schedule
+    - .rules:protected-schedule
   stage: build
   image: $CI_DOCKER_REGISTRY/esp32-toolchain-win-cross
   tags:
@@ -366,7 +366,7 @@ build_cmdlinerunner:
 build_installer:
   extends:
     - .before_script_slim
-    - .rules:master-release-schedule
+    - .rules:protected-schedule
   # using a different stage here to be able to use artifacts from build_cmdlinerunner job
   stage: host_test
   image: $CI_DOCKER_REGISTRY/wine-innosetup:1
@@ -449,7 +449,7 @@ code_quality_check:
 code_quality_report:
   extends:
     - .sonar_scan_template
-    - .rules:master-release-schedule
+    - .rules:protected-schedule
   script:
     - sonar-scanner
       -Dsonar.host.url=$SONAR_HOST_URL

+ 4 - 4
tools/ci/config/deploy.yml

@@ -36,7 +36,7 @@ clang_tidy_deploy:
 clang_tidy_deploy_regular:
   extends:
     - .clang_tidy_deploy_template
-    - .rules:labels:static_analysis
+    - .rules:labels:static_analysis-only
   needs:
     - clang_tidy_check_regular
 
@@ -44,7 +44,7 @@ push_to_github:
   extends:
     - .deploy_job_template
     - .before_script_lesser
-    - .rules:deploy
+    - .rules:protected-no_label
   script:
     - add_github_ssh_keys
     - git remote remove github &>/dev/null || true
@@ -91,7 +91,7 @@ deploy_docs_production:
   # The DOCS_PROD_* variables used by this job are "Protected" so these branches must all be marked "Protected" in Gitlab settings
   extends:
     - .deploy_docs_template
-    - .rules:deploy
+    - .rules:protected-no_label
   variables:
     TYPE: "preview"
     DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PROD_DEPLOY_KEY"
@@ -104,7 +104,7 @@ deploy_test_result:
   extends:
     - .deploy_job_template
     - .before_script_slim
-    - .rules:master-schedule-always
+    - .rules:ref:master-schedule-always
   image: $CI_DOCKER_REGISTRY/bot-env
   tags:
     - deploy_test

+ 2 - 2
tools/ci/config/host-test.yml

@@ -9,7 +9,7 @@
 .host_fuzzer_test_template:
   extends:
     - .host_test_template
-    - .rules:labels:fuzzer_test-weekend_test
+    - .rules:labels:fuzzer_test-weekend_test-only
   image: $CI_DOCKER_REGISTRY/afl-fuzzer-test
   artifacts:
     when: always
@@ -35,7 +35,7 @@ test_nvs_on_host:
 test_nvs_coverage:
   extends:
     - .host_test_template
-    - .rules:labels:nvs_coverage
+    - .rules:labels:nvs_coverage-only
   artifacts:
     paths:
       - components/nvs_flash/test_nvs_host/coverage_report

+ 2 - 2
tools/ci/config/post_check.yml

@@ -44,7 +44,7 @@ check_submodule_sync:
 check_ut_cmake_make:
   extends:
     - .post_check_job_template_with_filter
-    - .rules:dev_push-trigger
+    - .rules:dev
   tags:
     - build
   script:
@@ -59,7 +59,7 @@ check_artifacts_expire_time:
 check_pipeline_triggered_by_label:
   extends:
     - .post_check_job_template
-    - .rules:dev_push-trigger
+    - .rules:dev
   script:
     # If the pipeline is triggered with label, the pipeline will only succeeded if "regular_test" label is added.
     # We want to make sure some jobs are always executed to detect regression.

+ 1 - 1
tools/ci/config/post_deploy.yml

@@ -1,5 +1,5 @@
 .check_doc_links_template:
-  extends: .rules:master-release
+  extends: .rules:protected
   stage: post_deploy
   image: $ESP_IDF_DOC_ENV_IMAGE
   tags: [ "build", "amd64", "internet" ]

+ 4 - 4
tools/ci/config/pre_check.yml

@@ -38,7 +38,7 @@ check_version:
   # esp_idf_version.h in a branch before tagging the next version.
   extends:
     - .pre_check_job_template
-    - .rules:master-release
+    - .rules:protected
   script:
     - export IDF_PATH=$PWD
     - tools/ci/check_idf_version.sh
@@ -46,7 +46,7 @@ check_version:
 check_examples_cmake_make:
   extends:
     - .pre_check_job_template_with_filter
-    - .rules:dev_push-trigger
+    - .rules:dev
   script:
     - python ${IDF_PATH}/tools/ci/check_examples_cmake_make.py
 
@@ -123,7 +123,7 @@ check_public_headers:
 scan_tests:
   extends:
     - .scan_build_tests
-    - .rules:tests:build-ttfw_tests
+    - .rules:build_tests:target_test
   artifacts:
     paths:
       - $EXAMPLE_TEST_OUTPUT_DIR
@@ -193,6 +193,6 @@ check_codeowners:
 check_version_tag:
   extends:
     - .pre_check_job_template
-    - .rules:release-tag
+    - .rules:tag:release-no_label
   script:
     - (git cat-file -t $CI_COMMIT_REF_NAME | grep tag) || echo "ESP-IDF versions must be annotated tags." && exit 1

+ 125 - 125
tools/ci/config/rules.yml

@@ -1,13 +1,14 @@
-.if-master-refs: &if-master-refs
+# if anchors
+.if-ref-master: &if-ref-master
   if: '$CI_COMMIT_REF_NAME == "master"'
 
-.if-release-branch: &if-release-branch
-  if: '$CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/'
-
-.if-release-tag-regular: &if-release-tag-regular
+.if-tag-release-no_label: &if-tag-release-no_label
   if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/ && $BOT_TRIGGER_WITH_LABEL == null'
 
-.if-master-release-regular: &if-master-release-regular
+.if-protected: &if-protected
+  if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/)'
+
+.if-protected-no_label: &if-protected-no_label
   if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/) && $BOT_TRIGGER_WITH_LABEL == null'
 
 .if-dev-push: &if-dev-push
@@ -19,221 +20,220 @@
 .if-trigger: &if-trigger
   if: '$CI_PIPELINE_SOURCE == "trigger"'
 
-.if-label-regular-test: &if-label-regular-test
+.if-label-regular_test: &if-label-regular_test
   if: '$BOT_LABEL_REGULAR_TEST'
 
 .if-label-build: &if-label-build
   if: '$BOT_LABEL_BUILD'
 
-.if-label-build-docs: &if-label-build-docs
+.if-label-build_docs: &if-label-build_docs
   if: '$BOT_LABEL_BUILD_DOCS'
 
-.if-label-integration-test: &if-label-integration-test
+.if-label-integration_test: &if-label-integration_test
   if: '$BOT_LABEL_INTEGRATION_TEST'
 
-.if-label-unit-test: &if-label-unit-test
+.if-label-unit_test: &if-label-unit_test
   if: '$BOT_LABEL_UNIT_TEST'
 
-.if-label-unit-test-s2: &if-label-unit-test-s2
+.if-label-unit_test_s2: &if-label-unit_test_s2
   if: '$BOT_LABEL_UNIT_TEST_S2'
 
-.if-label-unit-test-all-target: &if-label-unit-test-all-target
+.if-label-unit_test-all_targets: &if-label-unit_test-all_targets
   if: '$BOT_LABEL_UNIT_TEST || $BOT_LABEL_UNIT_TEST_S2'
 
-.if-label-weekend-test: &if-label-weekend-test
+.if-label-weekend_test: &if-label-weekend_test
   if: '$BOT_LABEL_WEEKEND_TEST'
 
-.if-label-example-test: &if-label-example-test
+.if-label-example_test: &if-label-example_test
   if: '$BOT_LABEL_EXAMPLE_TEST'
 
-.if-label-custom-test: &if-label-custom-test
+.if-label-custom_test: &if-label-custom_test
   if: '$BOT_LABEL_CUSTOM_TEST'
 
-.if-label-host-test: &if-label-host-test
+.if-label-host_test: &if-label-host_test
   if: '$BOT_LABEL_HOST_TEST'
 
-.if-label-fuzzer-test: &if-label-fuzzer-test
+.if-label-fuzzer_test: &if-label-fuzzer_test
   if: '$BOT_LABEL_FUZZER_TEST'
 
-.if-label-nvs-coverage: &if-label-nvs-coverage
+.if-label-nvs_coverage: &if-label-nvs_coverage
   if: '$BOT_LABEL_NVS_COVERAGE'
 
-.if-label-static-analysis: &if-label-static-analysis
+.if-label-static_analysis: &if-label-static_analysis
   if: '$BOT_LABEL_STATIC_ANALYSIS || $BOT_LABEL_STATIC_ANALYSIS_ALL'
 
-.if-label-iperf-stress-test: &if-label-iperf-stress-test
+.if-label-iperf_stress_test: &if-label-iperf_stress_test
   if: '$BOT_LABEL_IPERF_STRESS_TEST'
 
 .if-os-mac: &if-os-mac
   if: '$BOT_LABEL_MACOS_TEST'
 
-.rules:master-release:
+# Rules templates
+.rules:protected:
   rules:
-    - <<: *if-master-refs
-    - <<: *if-release-branch
+    - <<: *if-protected
 
-.rules:release-tag:
+.rules:protected-no_label:
   rules:
-    - <<: *if-release-tag-regular
+    - <<: *if-protected-no_label
 
-.rules:deploy:
+.rules:protected-schedule:
   rules:
-    - <<: *if-master-release-regular
+    - <<: *if-protected
+    - <<: *if-schedule
 
-.rules:master-schedule:
+.rules:trigger:
   rules:
-    - <<: *if-master-refs
-    - <<: *if-schedule
+    - <<: *if-trigger
 
-.rules:master-schedule-always:
+.rules:dev:
   rules:
-    - <<: *if-master-refs
-      when: always
-    - <<: *if-schedule
-      when: always
+    - <<: *if-trigger
+    - <<: *if-dev-push
 
-.rules:master-release-schedule:
+.rules:os:mac_os:
   rules:
-    - <<: *if-master-refs
-    - <<: *if-release-branch
-    - <<: *if-schedule
+    - <<: *if-protected-no_label
+    - <<: *if-os-mac
 
-.rules:trigger:
+.rules:tag:release-no_label:
   rules:
-    - <<: *if-trigger
+    - <<: *if-tag-release-no_label
 
-.rules:dev_push-trigger:
+.rules:ref:master-schedule:
   rules:
-    - <<: *if-trigger
-    - <<: *if-dev-push
+    - <<: *if-ref-master
+    - <<: *if-schedule
+
+.rules:ref:master-schedule-always:
+  rules:
+    - <<: *if-ref-master
+      when: always
+    - <<: *if-schedule
+      when: always
 
-.rules:labels:static_analysis:
+.rules:labels:static_analysis-only:
   rules:
-    - <<: *if-label-static-analysis
+    - <<: *if-label-static_analysis
 
 .rules:labels:build:
   rules:
-    - <<: *if-master-release-regular
-    - <<: *if-label-regular-test
+    - <<: *if-protected-no_label
+    - <<: *if-label-regular_test
     - <<: *if-label-build
 
 .rules:labels:build_docs:
   rules:
-    - <<: *if-master-release-regular
+    - <<: *if-protected-no_label
     - <<: *if-label-build
-    - <<: *if-label-regular-test
-    - <<: *if-label-build-docs
+    - <<: *if-label-regular_test
+    - <<: *if-label-build_docs
 
 .rules:labels:build_docs-slim:
   rules:
-    - <<: *if-master-release-regular
-    - <<: *if-label-build-docs
+    - <<: *if-protected-no_label
+    - <<: *if-label-build_docs
 
-.rules:labels:host_test:
+.rules:labels:weekend_test-only:
   rules:
-    - <<: *if-master-release-regular
-    - <<: *if-label-regular-test
-    - <<: *if-label-host-test
+    - <<: *if-label-weekend_test
 
-.rules:labels:example_test:
+.rules:labels:iperf_stress_test-only:
   rules:
-    - <<: *if-master-release-regular
-    - <<: *if-schedule
-    - <<: *if-label-example-test
+    - <<: *if-label-iperf_stress_test
 
-.rules:labels:custom_test:
+.rules:labels:fuzzer_test-weekend_test-only:
   rules:
-    - <<: *if-master-release-regular
-    - <<: *if-schedule
-    - <<: *if-label-custom-test
+    - <<: *if-label-fuzzer_test
+    - <<: *if-label-weekend_test
 
-.rules:labels:unit_test:
+.rules:labels:nvs_coverage-only:
   rules:
-    - <<: *if-master-release-regular
-    - <<: *if-label-unit-test
+    - <<: *if-label-nvs_coverage
 
-.rules:labels:unit_test_s2-only:
+.rules:labels:host_test:
   rules:
-    - <<: *if-label-unit-test-s2
+    - <<: *if-protected-no_label
+    - <<: *if-label-regular_test
+    - <<: *if-label-host_test
 
-.rules:labels:integration_test:
+.rules:tests:example_test-schedule:
   rules:
-    - <<: *if-master-release-regular
-    - <<: *if-label-integration-test
+    - <<: *if-protected-no_label
+    - <<: *if-label-example_test
+    - <<: *if-schedule
 
-.rules:labels:weekend_test-only:
+.rules:tests:custom_test-schedule:
   rules:
-    - <<: *if-label-weekend-test
+    - <<: *if-protected-no_label
+    - <<: *if-label-custom_test
+    - <<: *if-schedule
 
-.rules:labels:iperf_stress_test-only:
+.rules:tests:unit_test:
   rules:
-    - <<: *if-label-iperf-stress-test
+    - <<: *if-protected-no_label
+    - <<: *if-label-unit_test
 
-.rules:labels:build-integration_test:
+.rules:tests:unit_test_s2-only:
   rules:
-    - <<: *if-master-release-regular
-    - <<: *if-label-build
-    - <<: *if-label-regular-test
-    - <<: *if-label-integration-test
+    - <<: *if-label-unit_test_s2
 
-.rules:labels:build-weekend_test:
+.rules:tests:integration_test:
   rules:
-    - <<: *if-master-release-regular
-    - <<: *if-label-build
-    - <<: *if-label-regular-test
-    - <<: *if-label-weekend-test
+    - <<: *if-protected-no_label
+    - <<: *if-label-integration_test
 
-.rules:labels:build-unit_test:
+.rules:tests:target_test-integration_test-weekend_test:
   rules:
-    - <<: *if-master-release-regular
-    - <<: *if-label-build
-    - <<: *if-label-regular-test
-    - <<: *if-label-unit-test-all-target
+    - <<: *if-protected-no_label
+    - <<: *if-label-example_test
+    - <<: *if-label-custom_test
+    - <<: *if-label-unit_test-all_targets
+    - <<: *if-label-integration_test
+    - <<: *if-label-weekend_test
 
-.rules:labels:build-example_test-weekend_test:
+.rules:build_tests:integration_test:
   rules:
-    - <<: *if-master-release-regular
+    - <<: *if-protected-no_label
     - <<: *if-label-build
-    - <<: *if-label-regular-test
-    - <<: *if-label-example-test
-    - <<: *if-label-weekend-test
+    - <<: *if-label-regular_test
+    - <<: *if-label-integration_test
 
-.rules:labels:build-custom_test-weekend_test:
+.rules:build_tests:weekend_test:
   rules:
-    - <<: *if-master-release-regular
+    - <<: *if-protected-no_label
     - <<: *if-label-build
-    - <<: *if-label-regular-test
-    - <<: *if-label-custom-test
-    - <<: *if-label-weekend-test
-
-.rules:labels:fuzzer_test-weekend_test:
-  rules:
-    - <<: *if-label-fuzzer-test
-    - <<: *if-label-weekend-test
+    - <<: *if-label-regular_test
+    - <<: *if-label-weekend_test
 
-.rules:labels:nvs_coverage:
+.rules:build_tests:unit_test:
   rules:
-    - <<: *if-label-nvs-coverage
+    - <<: *if-protected-no_label
+    - <<: *if-label-build
+    - <<: *if-label-regular_test
+    - <<: *if-label-unit_test-all_targets
 
-.rules:test:target_test-weekend_test:
+.rules:build_tests:example_test-weekend_test:
   rules:
-    - <<: *if-master-release-regular
-    - <<: *if-label-example-test
-    - <<: *if-label-custom-test
-    - <<: *if-label-unit-test-all-target
-    - <<: *if-label-integration-test
-    - <<: *if-label-weekend-test
+    - <<: *if-protected-no_label
+    - <<: *if-label-build
+    - <<: *if-label-regular_test
+    - <<: *if-label-example_test
+    - <<: *if-label-weekend_test
 
-.rules:tests:build-ttfw_tests:
+.rules:build_tests:custom_test-weekend_test:
   rules:
-    - <<: *if-master-release-regular
+    - <<: *if-protected-no_label
     - <<: *if-label-build
-    - <<: *if-label-regular-test
-    - <<: *if-label-example-test
-    - <<: *if-label-custom-test
-    - <<: *if-label-unit-test-all-target
+    - <<: *if-label-regular_test
+    - <<: *if-label-custom_test
+    - <<: *if-label-weekend_test
 
-.rules:os:mac_os:
+.rules:build_tests:target_test:
   rules:
-    - <<: *if-master-release-regular
-    - <<: *if-os-mac
+    - <<: *if-protected-no_label
+    - <<: *if-label-build
+    - <<: *if-label-regular_test
+    - <<: *if-label-example_test
+    - <<: *if-label-custom_test
+    - <<: *if-label-unit_test-all_targets

+ 6 - 6
tools/ci/config/target-test.yml

@@ -35,7 +35,7 @@
 .example_test_template:
   extends:
     - .target_test_job_template
-    - .rules:labels:example_test
+    - .rules:tests:example_test-schedule
   variables:
     TEST_CASE_PATH: "$CI_PROJECT_DIR/examples"
     CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/examples/test_configs"
@@ -48,7 +48,7 @@
 .test_app_template:
   extends:
     - .target_test_job_template
-    - .rules:labels:custom_test
+    - .rules:tests:custom_test-schedule
   variables:
     TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/test_apps"
     CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/tools/test_apps/test_configs"
@@ -56,7 +56,7 @@
 .component_ut_template:
   extends:
     - .target_test_job_template
-    - .rules:labels:unit_test
+    - .rules:tests:unit_test
   variables:
     TEST_CASE_PATH: "$COMPONENT_UT_DIRS"
     CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/component_ut/test_configs"
@@ -76,7 +76,7 @@
 .unit_test_template:
   extends:
     - .target_test_job_template
-    - .rules:labels:unit_test
+    - .rules:tests:unit_test
   variables:
     TEST_CASE_PATH: "$CI_PROJECT_DIR/tools/unit-test-app"
     CONFIG_FILE_PATH: "${CI_PROJECT_DIR}/components/idf_test/unit_test/CIConfigs"
@@ -85,7 +85,7 @@
 .integration_test_template:
   extends:
     - .target_test_job_template
-    - .rules:labels:integration_test
+    - .rules:tests:integration_test
   needs:
     - assign_test
     - build_ssc_esp32
@@ -475,7 +475,7 @@ UT_034:
 .unit_test_s2_template:
   extends:
     - .unit_test_template
-    - .rules:labels:unit_test_s2-only # due to the lack of runners, s2 tests will only be triggered by label
+    - .rules:tests:unit_test_s2-only # due to the lack of runners, s2 tests will only be triggered by label
 
 UT_035:
   extends: .unit_test_s2_template