Skip to content

Commit

Permalink
feat: use feature branch regex
Browse files Browse the repository at this point in the history
  • Loading branch information
jackd248 committed Dec 4, 2024
1 parent 0fdaead commit f2314a9
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 12 deletions.
14 changes: 10 additions & 4 deletions .base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ variables:
PATH_APP_DIR: "${PATH_CI_DIR}"
# misc
BASE_BRANCH: "main"
FEATURE_BRANCHES_REGEX: "/^(release-(.*)|feature-(.*)|$BASE_BRANCH)$/"

#-----------------------------------------------------------------------------------------------------------------------
# DEFAULT-DOCKER-IMAGE
Expand Down Expand Up @@ -52,6 +53,7 @@ stages:
when: never
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
when: never
- if: '$CI_COMMIT_REF_NAME =~ $FEATURE_BRANCHES_REGEX'
artifacts:
when: on_success
expire_in: 36 hour
Expand All @@ -77,14 +79,18 @@ stages:
environment:
name: $CI_COMMIT_REF_NAME
url: $ENVIRONMENT_URL
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- if: '$CI_PIPELINE_SOURCE == "pipeline"'
when: never
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
when: never
- if: '$CI_COMMIT_REF_NAME =~ $FEATURE_BRANCHES_REGEX'

.feature-branches:
variables:
FEATURE_STOP_DOWNSTREAM_BRANCH: $BASE_BRANCH
rules:
- if: '$CI_COMMIT_REF_NAME =~ /^release-(.*)$/'
- if: '$CI_COMMIT_REF_NAME =~ /^feature-.*$/'
- if: '$CI_COMMIT_REF_NAME == $BASE_BRANCH'

#-----------------------------------------------------------------------------------------------------------------------
# SCHEDULE
Expand Down
3 changes: 2 additions & 1 deletion analyse/analyse-composer-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ analyse:composer:lint:
when: never
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
when: never
- changes:
- if: '$CI_COMMIT_REF_NAME =~ $FEATURE_BRANCHES_REGEX'
changes:
- "**/composer.json"
- "**/composer.lock"
script:
Expand Down
2 changes: 2 additions & 0 deletions analyse/analyse-editorconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
analyse:editorconfig:
needs: [ "build:php" ]
extends: .base-analyse
rules:
- if: '$CI_COMMIT_REF_NAME =~ $FEATURE_BRANCHES_REGEX'
script:
- composer run editorconfig:check -d ${PATH_APP_DIR}
3 changes: 2 additions & 1 deletion analyse/analyse-php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ analyse:php:cs-fixer:
when: never
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
when: never
- changes:
- if: '$CI_COMMIT_REF_NAME =~ $FEATURE_BRANCHES_REGEX'
changes:
- "**/*.php"
script:
- composer run php:cs-fixer:check -d ${PATH_APP_DIR}
3 changes: 2 additions & 1 deletion analyse/analyse-php-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ analyse:php:lint:
when: never
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
when: never
- changes:
- if: '$CI_COMMIT_REF_NAME =~ $FEATURE_BRANCHES_REGEX'
changes:
- "**/*.php"
script:
- composer run php:lint -d ${PATH_APP_DIR}
3 changes: 2 additions & 1 deletion analyse/analyse-php-rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ analyse:php:rector:
when: never
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
when: never
- changes:
- if: '$CI_COMMIT_REF_NAME =~ $FEATURE_BRANCHES_REGEX'
changes:
- "**/*.php"
script:
- composer run php:rector:check -d ${PATH_APP_DIR}
3 changes: 2 additions & 1 deletion analyse/analyse-php-stan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ analyse:php:stan:
when: never
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
when: never
- changes:
- if: '$CI_COMMIT_REF_NAME =~ $FEATURE_BRANCHES_REGEX'
changes:
- "**/*.php"
script:
- composer run php:stan:check -d ${PATH_APP_DIR}
3 changes: 2 additions & 1 deletion analyse/analyse-typoscript-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ analyse:typoscript:lint:
when: never
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
when: never
- changes:
- if: '$CI_COMMIT_REF_NAME =~ $FEATURE_BRANCHES_REGEX'
changes:
- "**/*.typoscript"
- "**/*.tsconfig"
- "**/Configuration/**/*.ts"
Expand Down
3 changes: 2 additions & 1 deletion analyse/analyse-xml-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ analyse:xml:lint:
when: never
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
when: never
- changes:
- if: '$CI_COMMIT_REF_NAME =~ $FEATURE_BRANCHES_REGEX'
changes:
- "**/*.xlf"
script:
- apt-get update -qq && apt-get install libxml2-utils -qq
Expand Down
3 changes: 2 additions & 1 deletion analyse/analyse-yaml-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ analyse:yaml:lint:
when: never
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
when: never
- changes:
- if: '$CI_COMMIT_REF_NAME =~ $FEATURE_BRANCHES_REGEX'
changes:
- "**/*.yml"
- "**/*.yaml"
script:
Expand Down

0 comments on commit f2314a9

Please sign in to comment.