Merge branch 'ci/build_only_label_for_maintainers' into 'master'

ci: add label `only build tests` for maintainers to control the flow

See merge request espressif/esp-idf!12647
This commit is contained in:
Anton Maklakov
2021-03-09 10:29:14 +00:00
2 changed files with 51 additions and 0 deletions

View File

@@ -86,6 +86,8 @@ class RulesWriter:
RULE_PROTECTED = ' - <<: *if-protected' RULE_PROTECTED = ' - <<: *if-protected'
RULE_PROTECTED_NO_LABEL = ' - <<: *if-protected-no_label' RULE_PROTECTED_NO_LABEL = ' - <<: *if-protected-no_label'
RULE_BUILD_ONLY = ' - <<: *if-label-build-only\n' \
' when: never'
RULE_LABEL_TEMPLATE = ' - <<: *if-label-{0}' RULE_LABEL_TEMPLATE = ' - <<: *if-label-{0}'
RULE_PATTERN_TEMPLATE = ' - <<: *if-dev-push\n' \ RULE_PATTERN_TEMPLATE = ' - <<: *if-dev-push\n' \
' changes: *patterns-{0}' ' changes: *patterns-{0}'
@@ -211,6 +213,8 @@ class RulesWriter:
else: else:
if not (name.endswith('-preview') or name.startswith('labels:')): if not (name.endswith('-preview') or name.startswith('labels:')):
_rules.append(self.RULE_PROTECTED) _rules.append(self.RULE_PROTECTED)
if name.startswith('test:'):
_rules.append(self.RULE_BUILD_ONLY)
for label in cfg['labels']: for label in cfg['labels']:
_rules.append(self.RULE_LABEL_TEMPLATE.format(label)) _rules.append(self.RULE_LABEL_TEMPLATE.format(label))
for pattern in cfg['patterns']: for pattern in cfg['patterns']:

View File

@@ -187,6 +187,9 @@
.if-trigger: &if-trigger .if-trigger: &if-trigger
if: '$CI_PIPELINE_SOURCE == "trigger"' if: '$CI_PIPELINE_SOURCE == "trigger"'
.if-label-build-only: &if-label-build-only
if: '$CI_JOB_STAGE == "target_test" && $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*For Maintainers: Only Build Tests(?:,[^,\n\r]+)*$/i'
######### #########
# Rules # # Rules #
######### #########
@@ -238,12 +241,14 @@
- <<: *if-dev-push - <<: *if-dev-push
changes: *patterns-python-files changes: *patterns-python-files
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# DO NOT place comments or maintain any code from this line # DO NOT place comments or maintain any code from this line
# #
# Use dependencies.yml and generate_rules.py under .gitlab/ci/dependencies dir # Use dependencies.yml and generate_rules.py under .gitlab/ci/dependencies dir
# to generate labels and rules # to generate labels and rules
# Could also use pre-commit hook to finish this if detected changes on # Could also use pre-commit hook to finish this if detected changes on
# these two files # these two files
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
################## ##################
# Auto Generated # # Auto Generated #
@@ -701,6 +706,8 @@
.rules:test:any_test: .rules:test:any_test:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut - <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32 - <<: *if-label-component_ut_esp32
- <<: *if-label-component_ut_esp32c3 - <<: *if-label-component_ut_esp32c3
@@ -741,6 +748,8 @@
.rules:test:component_ut-esp32: .rules:test:component_ut-esp32:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut - <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32 - <<: *if-label-component_ut_esp32
- <<: *if-label-unit_test - <<: *if-label-unit_test
@@ -751,6 +760,8 @@
.rules:test:component_ut-esp32c3: .rules:test:component_ut-esp32c3:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut - <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32c3 - <<: *if-label-component_ut_esp32c3
- <<: *if-label-unit_test - <<: *if-label-unit_test
@@ -761,6 +772,8 @@
.rules:test:component_ut-esp32s2: .rules:test:component_ut-esp32s2:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut - <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32s2 - <<: *if-label-component_ut_esp32s2
- <<: *if-label-unit_test - <<: *if-label-unit_test
@@ -771,6 +784,8 @@
.rules:test:component_ut-esp32s3: .rules:test:component_ut-esp32s3:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut - <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32s3 - <<: *if-label-component_ut_esp32s3
- <<: *if-label-unit_test - <<: *if-label-unit_test
@@ -781,6 +796,8 @@
.rules:test:custom_test-esp32: .rules:test:custom_test-esp32:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-custom_test - <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32 - <<: *if-label-custom_test_esp32
- <<: *if-dev-push - <<: *if-dev-push
@@ -789,6 +806,8 @@
.rules:test:custom_test-esp32c3: .rules:test:custom_test-esp32c3:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-custom_test - <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32c3 - <<: *if-label-custom_test_esp32c3
- <<: *if-dev-push - <<: *if-dev-push
@@ -797,6 +816,8 @@
.rules:test:custom_test-esp32s2: .rules:test:custom_test-esp32s2:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-custom_test - <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32s2 - <<: *if-label-custom_test_esp32s2
- <<: *if-dev-push - <<: *if-dev-push
@@ -805,6 +826,8 @@
.rules:test:custom_test-esp32s3: .rules:test:custom_test-esp32s3:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-custom_test - <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32s3 - <<: *if-label-custom_test_esp32s3
- <<: *if-dev-push - <<: *if-dev-push
@@ -813,6 +836,8 @@
.rules:test:example_test-esp32: .rules:test:example_test-esp32:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-example_test - <<: *if-label-example_test
- <<: *if-label-example_test_esp32 - <<: *if-label-example_test_esp32
- <<: *if-dev-push - <<: *if-dev-push
@@ -823,6 +848,8 @@
.rules:test:example_test-esp32c3: .rules:test:example_test-esp32c3:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-example_test - <<: *if-label-example_test
- <<: *if-label-example_test_esp32c3 - <<: *if-label-example_test_esp32c3
- <<: *if-dev-push - <<: *if-dev-push
@@ -833,6 +860,8 @@
.rules:test:example_test-esp32s2: .rules:test:example_test-esp32s2:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-example_test - <<: *if-label-example_test
- <<: *if-label-example_test_esp32s2 - <<: *if-label-example_test_esp32s2
- <<: *if-dev-push - <<: *if-dev-push
@@ -843,6 +872,8 @@
.rules:test:example_test-esp32s3: .rules:test:example_test-esp32s3:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-example_test - <<: *if-label-example_test
- <<: *if-label-example_test_esp32s3 - <<: *if-label-example_test_esp32s3
- <<: *if-dev-push - <<: *if-dev-push
@@ -853,6 +884,8 @@
.rules:test:host_test: .rules:test:host_test:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-host_test - <<: *if-label-host_test
- <<: *if-dev-push - <<: *if-dev-push
changes: *patterns-host_test changes: *patterns-host_test
@@ -860,6 +893,8 @@
.rules:test:integration_test: .rules:test:integration_test:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-integration_test - <<: *if-label-integration_test
- <<: *if-dev-push - <<: *if-dev-push
changes: *patterns-integration_test changes: *patterns-integration_test
@@ -867,6 +902,8 @@
.rules:test:submodule: .rules:test:submodule:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-submodule - <<: *if-label-submodule
- <<: *if-dev-push - <<: *if-dev-push
changes: *patterns-submodule changes: *patterns-submodule
@@ -874,6 +911,8 @@
.rules:test:target_test: .rules:test:target_test:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut - <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32 - <<: *if-label-component_ut_esp32
- <<: *if-label-component_ut_esp32c3 - <<: *if-label-component_ut_esp32c3
@@ -911,6 +950,8 @@
.rules:test:unit_test-esp32: .rules:test:unit_test-esp32:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-unit_test - <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32 - <<: *if-label-unit_test_esp32
- <<: *if-dev-push - <<: *if-dev-push
@@ -919,11 +960,15 @@
.rules:test:unit_test-esp32c3: .rules:test:unit_test-esp32c3:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-unit_test_esp32c3 - <<: *if-label-unit_test_esp32c3
.rules:test:unit_test-esp32s2: .rules:test:unit_test-esp32s2:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-unit_test - <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32s2 - <<: *if-label-unit_test_esp32s2
- <<: *if-dev-push - <<: *if-dev-push
@@ -932,6 +977,8 @@
.rules:test:unit_test-esp32s3: .rules:test:unit_test-esp32s3:
rules: rules:
- <<: *if-protected - <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-unit_test - <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32s3 - <<: *if-label-unit_test_esp32s3
- <<: *if-dev-push - <<: *if-dev-push