diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 41c42dbac1a7032ebd8aa928ab0f49eed09f8ad2..630d4a7698b440857833c69f0532ab8eb25df2d3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,6 +51,29 @@ decoupled_pages: project: project/decoupled_pages branch: 8.x-1.x +# For testing the job selection logic. +gitlab_templates_jobs: + extends: .downstream-base + trigger: + strategy: depend + project: project/eca + branch: ci-test + variables: + _GITLAB_TEMPLATES_MANUAL: "1" + parallel: + matrix: + - _GITLAB_TEMPLATES_EXPECTED_JOBS: composer,composer-lint,phpcs,phpstan,phpunit + - _GITLAB_TEMPLATES_EXPECTED_JOBS: composer,composer (next major),composer-lint,phpcs,phpstan (next major),phpunit (next major) + OPT_IN_TEST_CURRENT: "0" + OPT_IN_TEST_NEXT_MAJOR: "1" + - _GITLAB_TEMPLATES_EXPECTED_JOBS: composer (next major),phpstan (next major),phpunit (next major) + OPT_IN_TEST_CURRENT: "0" + OPT_IN_TEST_NEXT_MAJOR: "1" + SKIP_COMPOSER_LINT: "1" + SKIP_PHPCS: "1" + SKIP_PHPESLINT: "1" + SKIP_PHPSTYLELINT: "1" + # For Drupal 7. d7-api: extends: .downstream-base diff --git a/includes/include.drupalci.main.yml b/includes/include.drupalci.main.yml index 91b88b3972a5992eda9e4ebb8c4d0bb5571ff8d1..64d4a420c509506f64f852fee5f4a046f9e23896 100644 --- a/includes/include.drupalci.main.yml +++ b/includes/include.drupalci.main.yml @@ -69,7 +69,7 @@ # If the module already supports Drupal 11, do nothing, otherwise, claim Drupal 11 support for testing purposes. - grep -q "\^11" *.info.yml || (grep -q "\^10" *.info.yml && sed -i "s/\^10/\^10 \|\| ^11/" *.info.yml) -# These reusable / chainable rules should be defined using conditions that end in "when: never". +# These reusable / chainable rules should be defined using conditions that end in "when: never". # This is the same as checking the conditions when not to run. This pattern allows for rules to be chained. .skip-composer-rule: &skip-composer-rule if: '$SKIP_COMPOSER == "1"' @@ -643,6 +643,29 @@ phpunit (next major): _TARGET_PHP: $CORE_PHP_MAX _TARGET_CORE: $CORE_MAJOR_DEVELOPMENT +############################################### +# HELPER JOBS FOR THE TEMPLATE TESTS DOWNSTREAM +############################################### + +On Hold: + stage: .pre + rules: + - if: '$_GITLAB_TEMPLATES_MANUAL == "1"' + when: manual + - when: never + script: + - printf "TBD" + +Verify Job Selection: + stage: .pre + rules: + - if: '$_GITLAB_TEMPLATES_MANUAL == "1"' + when: always + - when: never + script: + - PIPELINE=$(glab pipeline get -p $CI_PIPELINE_ID -o json) + # TODO: Compare the list of jobs with $_GITLAB_TEMPLATES_EXPECTED_JOBS + ############################### # BACKWARDS COMPATIBILITY LAYER ############################### diff --git a/includes/include.drupalci.variables.yml b/includes/include.drupalci.variables.yml index a3badbd1931c5ea245bd0c80cd8e62c97e6bf22c..5b2e3da726bcd13c9bb7abcbe265f542c9a75671 100644 --- a/includes/include.drupalci.variables.yml +++ b/includes/include.drupalci.variables.yml @@ -430,3 +430,6 @@ variables: _GITLAB_TEMPLATES_REF: value: "1.0.x" description: "The branch/ref to use during CI. The default is 1.0.x. For issue testing, the format is often nnnnnnn-some-text" + _GITLAB_TEMPLATES_MANUAL: + value: "0" + description: "Set to 1 to prepend a manual job in the .pre stage to create a pipeline without running it. Used by the gitlab_templates_jobs test internally."