Skip to content

Commit

Permalink
Merge branch 'ci/build_only_label_for_maintainers' into 'master'
Browse files Browse the repository at this point in the history
ci: add label `only build tests` for maintainers to control the flow

See merge request espressif/esp-idf!12647
  • Loading branch information
antmak committed Mar 9, 2021
2 parents 8b75cbf + 04357aa commit 3480d31
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitlab/ci/dependencies/generate_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class RulesWriter:

RULE_PROTECTED = ' - <<: *if-protected'
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_PATTERN_TEMPLATE = ' - <<: *if-dev-push\n' \
' changes: *patterns-{0}'
Expand Down Expand Up @@ -211,6 +213,8 @@ def _format_rule(self, name, cfg): # type: (str, dict) -> str
else:
if not (name.endswith('-preview') or name.startswith('labels:')):
_rules.append(self.RULE_PROTECTED)
if name.startswith('test:'):
_rules.append(self.RULE_BUILD_ONLY)
for label in cfg['labels']:
_rules.append(self.RULE_LABEL_TEMPLATE.format(label))
for pattern in cfg['patterns']:
Expand Down
47 changes: 47 additions & 0 deletions .gitlab/ci/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@
.if-trigger: &if-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 #
#########
Expand Down Expand Up @@ -238,12 +241,14 @@
- <<: *if-dev-push
changes: *patterns-python-files

# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# DO NOT place comments or maintain any code from this line
#
# Use dependencies.yml and generate_rules.py under .gitlab/ci/dependencies dir
# to generate labels and rules
# Could also use pre-commit hook to finish this if detected changes on
# these two files
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

##################
# Auto Generated #
Expand Down Expand Up @@ -701,6 +706,8 @@
.rules:test:any_test:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32
- <<: *if-label-component_ut_esp32c3
Expand Down Expand Up @@ -741,6 +748,8 @@
.rules:test:component_ut-esp32:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32
- <<: *if-label-unit_test
Expand All @@ -751,6 +760,8 @@
.rules:test:component_ut-esp32c3:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32c3
- <<: *if-label-unit_test
Expand All @@ -761,6 +772,8 @@
.rules:test:component_ut-esp32s2:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32s2
- <<: *if-label-unit_test
Expand All @@ -771,6 +784,8 @@
.rules:test:component_ut-esp32s3:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32s3
- <<: *if-label-unit_test
Expand All @@ -781,6 +796,8 @@
.rules:test:custom_test-esp32:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32
- <<: *if-dev-push
Expand All @@ -789,6 +806,8 @@
.rules:test:custom_test-esp32c3:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32c3
- <<: *if-dev-push
Expand All @@ -797,6 +816,8 @@
.rules:test:custom_test-esp32s2:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32s2
- <<: *if-dev-push
Expand All @@ -805,6 +826,8 @@
.rules:test:custom_test-esp32s3:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-custom_test
- <<: *if-label-custom_test_esp32s3
- <<: *if-dev-push
Expand All @@ -813,6 +836,8 @@
.rules:test:example_test-esp32:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32
- <<: *if-dev-push
Expand All @@ -823,6 +848,8 @@
.rules:test:example_test-esp32c3:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32c3
- <<: *if-dev-push
Expand All @@ -833,6 +860,8 @@
.rules:test:example_test-esp32s2:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32s2
- <<: *if-dev-push
Expand All @@ -843,6 +872,8 @@
.rules:test:example_test-esp32s3:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32s3
- <<: *if-dev-push
Expand All @@ -853,27 +884,35 @@
.rules:test:host_test:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-host_test
- <<: *if-dev-push
changes: *patterns-host_test

.rules:test:integration_test:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-integration_test
- <<: *if-dev-push
changes: *patterns-integration_test

.rules:test:submodule:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-submodule
- <<: *if-dev-push
changes: *patterns-submodule

.rules:test:target_test:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-component_ut
- <<: *if-label-component_ut_esp32
- <<: *if-label-component_ut_esp32c3
Expand Down Expand Up @@ -911,6 +950,8 @@
.rules:test:unit_test-esp32:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32
- <<: *if-dev-push
Expand All @@ -919,11 +960,15 @@
.rules:test:unit_test-esp32c3:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-unit_test_esp32c3

.rules:test:unit_test-esp32s2:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32s2
- <<: *if-dev-push
Expand All @@ -932,6 +977,8 @@
.rules:test:unit_test-esp32s3:
rules:
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32s3
- <<: *if-dev-push
Expand Down

0 comments on commit 3480d31

Please sign in to comment.