Skip to content
Snippets Groups Projects
Commit a304b6aa authored by Alex Pott's avatar Alex Pott
Browse files

Merge branch '3425446-configurable-allow-failure' into 'main'

Use variables to decide whether to fail linting jobs

See merge request !143
parents 874c16b4 aceeb9b6
No related branches found
No related tags found
No related merge requests found
Pipeline #111443 passed
Pipeline: keycdn

#111453

    Pipeline: decoupled_pages

    #111444

      ......@@ -284,6 +284,8 @@ phpcs:
      stage: validate
      needs: ["composer"]
      rules:
      - if: '$PHPCS_ALLOW_FAILURE == "1"'
      allow_failure: true
      - *skip-phpcs-rule
      - when: on_success
      script:
      ......@@ -295,7 +297,6 @@ phpcs:
      - vendor/bin/phpcs --config-show installed_paths
      - vendor/bin/phpcs -i
      - vendor/bin/phpcs --basepath=$CI_PROJECT_DIR -s $_WEB_ROOT/sites/all/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source
      allow_failure: true
      artifacts:
      expose_as: junit
      expire_in: 6 mos
      ......
      ......@@ -372,6 +372,8 @@ composer-lint:
      phpcs:
      stage: validate
      rules:
      - if: '$PHPCS_ALLOW_FAILURE == "1"'
      allow_failure: true
      - *skip-phpcs-rule
      - when: on_success
      needs:
      ......@@ -385,7 +387,6 @@ phpcs:
      - vendor/bin/phpcs --config-show installed_paths
      - vendor/bin/phpcs -i
      - vendor/bin/phpcs -s $_WEB_ROOT/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source
      allow_failure: true
      artifacts:
      expose_as: junit
      expire_in: 6 mos
      ......@@ -399,6 +400,8 @@ phpcs:
      .phpstan-base:
      stage: validate
      rules:
      - if: '$PHPSTAN_ALLOW_FAILURE == "1"'
      allow_failure: true
      - *opt-in-current-rule
      - *skip-phpstan-rule
      - when: on_success
      ......@@ -424,7 +427,6 @@ phpcs:
      # Ensure paths in artifacts are git-relative.
      - sed -i "s#$_WEB_ROOT/modules/custom/$CI_PROJECT_NAME/##" junit.xml phpstan-baseline.neon phpstan-quality-report.json || true
      - exit $EXIT_CODE
      allow_failure: true
      artifacts:
      expose_as: phpstan
      when: always
      ......@@ -442,6 +444,8 @@ phpstan:
      extends: .phpstan-base
      phpstan (next minor):
      # Future so failure is allowed.
      allow_failure: true
      extends: phpstan
      rules:
      - *opt-in-next-minor-rule
      ......@@ -453,6 +457,8 @@ phpstan (next minor):
      _TARGET_CORE: $CORE_NEXT_MINOR
      phpstan (next major):
      # Future so failure is allowed.
      allow_failure: true
      extends: phpstan
      rules:
      - *opt-in-next-major-rule
      ......@@ -468,8 +474,9 @@ phpstan (next major):
      stylelint:
      stage: validate
      allow_failure: true
      rules:
      - if: '$STYLELINT_ALLOW_FAILURE == "1"'
      allow_failure: true
      - *skip-stylelint-rule
      - exists:
      - "**/*.css"
      ......@@ -499,6 +506,8 @@ stylelint:
      eslint:
      stage: validate
      rules:
      - if: '$ESLINT_ALLOW_FAILURE == "1"'
      allow_failure: true
      - *skip-eslint-rule
      - exists:
      - "**/*.js"
      ......@@ -546,7 +555,6 @@ eslint:
      fi
      - printf "Exiting with EXIT_CODE=$EXIT_CODE_FILE\n"
      - exit $EXIT_CODE_FILE
      allow_failure: true
      artifacts:
      expose_as: junit
      expire_in: 6 mos
      ......@@ -561,9 +569,10 @@ eslint:
      cspell:
      stage: validate
      rules:
      - if: '$CSPELL_ALLOW_FAILURE == "1"'
      allow_failure: true
      - *skip-cspell-rule
      - when: on_success
      allow_failure: true
      needs:
      - composer
      artifacts:
      ......@@ -715,6 +724,7 @@ nightwatch (previous major):
      _TARGET_CORE: $CORE_PREVIOUS_STABLE
      nightwatch (next minor):
      # Future so failure is allowed.
      allow_failure: true
      extends: nightwatch
      rules:
      ......@@ -727,6 +737,7 @@ nightwatch (next minor):
      _TARGET_CORE: $CORE_NEXT_MINOR
      nightwatch (next major):
      # Future so failure is allowed.
      allow_failure: true
      extends: nightwatch
      rules:
      ......@@ -847,8 +858,8 @@ phpunit (previous major):
      _TARGET_PHP: $CORE_PREVIOUS_PHP_MIN
      _TARGET_CORE: $CORE_PREVIOUS_STABLE
      # Future versions, hence breaks may arrive at any time: failure is allowed.
      phpunit (next minor):
      # Future so failure is allowed.
      allow_failure: true
      extends: phpunit
      rules:
      ......@@ -861,6 +872,7 @@ phpunit (next minor):
      _TARGET_CORE: $CORE_NEXT_MINOR
      phpunit (next major):
      # Future so failure is allowed.
      allow_failure: true
      extends: phpunit
      rules:
      ......
      ......@@ -182,6 +182,28 @@ variables:
      value: "0"
      description: "Set to 1 to opt in testing against the maximum/latest supported version of PHP for the current stable version of Drupal."
      ################
      # Linting failure variables
      #
      # These variables allow you to fail pipelines if lint jobs fail
      #
      ################
      CSPELL_ALLOW_FAILURE:
      value: "1"
      description: "Set to 1 to allow the cspell job to fail, set to 0 to not."
      ESLINT_ALLOW_FAILURE:
      value: "1"
      description: "Set to 1 to allow the eslint job to fail, set to 0 to not."
      PHPCS_ALLOW_FAILURE:
      value: "1"
      description: "Set to 1 to allow the phpcs job to fail, set to 0 to not."
      PHPSTAN_ALLOW_FAILURE:
      value: "1"
      description: "Set to 1 to allow the phpstan job to fail, set to 0 to not."
      STYLELINT_ALLOW_FAILURE:
      value: "1"
      description: "Set to 1 to allow the stylelint job to fail, set to 0 to not."
      ################
      # Lenient Variables
      #
      ......
      0% Loading or .
      You are about to add 0 people to the discussion. Proceed with caution.
      Please register or to comment