include:
  # This remote project centralize our CI "golden path" https://docs.gitlab.com/ee/ci/yaml/#includefile
  - remote: 'https://gitlab.com/drupalspoons/composer-plugin/-/raw/$DCI_REF/templates/.gitlab-ci.yml'
    rules:
      - if: $DCI_REF != null
  # This is here just to satisfy local CI lint with `glab`.
  - remote: 'https://gitlab.com/drupalspoons/composer-plugin/-/raw/master/templates/.gitlab-ci.yml'
    rules:
      - if: $DCI_REF == null

#
# Projects may override anything in the template above.
# The code below is specific to devel project. Comment it out or delete it when
# copying this file to your new project.
#

variables:
  PHP_TAG: "8.2"
  # Disable default phpunit job in favor of the d9/10 variants below.
  DCI_SKIP_PHPUNIT: 1

# Set allow_failure to false so that the test fails for coding standards faults.
phpcs:
  allow_failure: false

composer:
  parallel:
    matrix:
      - PHP_TAG: [ "7.4" ]
        DRUPAL_CORE_CONSTRAINT: [ "^9" ]
      - PHP_TAG: [ "8.2" ]
        DRUPAL_CORE_CONSTRAINT: [ "^10" ]

.phpunit-local:
  variables:
    DCI_SKIP_PHPUNIT: 0
  parallel:
    matrix:
      # Run test groups in parallel for better dev velocity.
      - DCI_PHPUNIT_EXTRA: [ "--group devel", "--group devel_generate" ]

phpunit-d9:
  dependencies:
    # This syntax comes from https://gitlab.com/gitlab-org/gitlab/-/merge_requests/82734/diffs
    - "composer: [7.4, ^9]"
  variables:
    PHP_TAG: "7.4"
  extends:
    - .phpunit-base
    - .phpunit-local

phpunit-d10:
  dependencies:
    - "composer: [8.2, ^10]"
  variables:
    PHP_TAG: "8.2"
  extends:
    - .phpunit-base
    - .phpunit-local
