From f2314a9e737d2040a685bb1bd4abb24e8c48d700 Mon Sep 17 00:00:00 2001 From: Konrad Michalik Date: Wed, 4 Dec 2024 15:34:02 +0100 Subject: [PATCH] feat: use feature branch regex --- .base.yml | 14 ++++++++++---- analyse/analyse-composer-lint.yml | 3 ++- analyse/analyse-editorconfig.yml | 2 ++ analyse/analyse-php-cs-fixer.yml | 3 ++- analyse/analyse-php-lint.yml | 3 ++- analyse/analyse-php-rector.yml | 3 ++- analyse/analyse-php-stan.yml | 3 ++- analyse/analyse-typoscript-lint.yml | 3 ++- analyse/analyse-xml-lint.yml | 3 ++- analyse/analyse-yaml-lint.yml | 3 ++- 10 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.base.yml b/.base.yml index 0748a3e..221fb17 100644 --- a/.base.yml +++ b/.base.yml @@ -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 @@ -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 @@ -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 diff --git a/analyse/analyse-composer-lint.yml b/analyse/analyse-composer-lint.yml index 4941baf..a11042e 100644 --- a/analyse/analyse-composer-lint.yml +++ b/analyse/analyse-composer-lint.yml @@ -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: diff --git a/analyse/analyse-editorconfig.yml b/analyse/analyse-editorconfig.yml index 403e2ef..134cb61 100644 --- a/analyse/analyse-editorconfig.yml +++ b/analyse/analyse-editorconfig.yml @@ -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} diff --git a/analyse/analyse-php-cs-fixer.yml b/analyse/analyse-php-cs-fixer.yml index 29e8a22..01439a9 100644 --- a/analyse/analyse-php-cs-fixer.yml +++ b/analyse/analyse-php-cs-fixer.yml @@ -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} diff --git a/analyse/analyse-php-lint.yml b/analyse/analyse-php-lint.yml index 8e04853..4d322bb 100644 --- a/analyse/analyse-php-lint.yml +++ b/analyse/analyse-php-lint.yml @@ -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} diff --git a/analyse/analyse-php-rector.yml b/analyse/analyse-php-rector.yml index 6850050..d7e6d2b 100644 --- a/analyse/analyse-php-rector.yml +++ b/analyse/analyse-php-rector.yml @@ -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} diff --git a/analyse/analyse-php-stan.yml b/analyse/analyse-php-stan.yml index 1e53726..4e956ad 100644 --- a/analyse/analyse-php-stan.yml +++ b/analyse/analyse-php-stan.yml @@ -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} diff --git a/analyse/analyse-typoscript-lint.yml b/analyse/analyse-typoscript-lint.yml index 99c303c..dadd12f 100644 --- a/analyse/analyse-typoscript-lint.yml +++ b/analyse/analyse-typoscript-lint.yml @@ -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" diff --git a/analyse/analyse-xml-lint.yml b/analyse/analyse-xml-lint.yml index af3025e..a40dc67 100644 --- a/analyse/analyse-xml-lint.yml +++ b/analyse/analyse-xml-lint.yml @@ -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 diff --git a/analyse/analyse-yaml-lint.yml b/analyse/analyse-yaml-lint.yml index 3c8e524..0a1dd45 100644 --- a/analyse/analyse-yaml-lint.yml +++ b/analyse/analyse-yaml-lint.yml @@ -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: