2023-09-29 07:26:24 +00:00
|
|
|
# cspell:ignore codequality Micheh micheh
|
2023-09-16 09:08:36 +00:00
|
|
|
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
################
|
|
|
|
# Drupal GitLabCI template.
|
|
|
|
#
|
|
|
|
# Based off GitlabCI templates project: https://git.drupalcode.org/project/gitlab_templates
|
|
|
|
# Guide: https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-drupal/gitlab-ci
|
|
|
|
#
|
|
|
|
# With thanks to:
|
|
|
|
# - The GitLab Acceleration Initiative participants
|
|
|
|
# - DrupalSpoons
|
|
|
|
################
|
|
|
|
|
|
|
|
################
|
|
|
|
# Includes
|
|
|
|
#
|
|
|
|
# Additional configuration can be provided through includes.
|
|
|
|
# One advantage of include files is that if they are updated upstream, the
|
|
|
|
# changes affect all pipelines using that include.
|
|
|
|
#
|
|
|
|
# Includes can be overridden by re-declaring anything provided in an include,
|
|
|
|
# here in gitlab-ci.yml.
|
|
|
|
# https://docs.gitlab.com/ee/ci/yaml/includes.html#override-included-configuration-values
|
|
|
|
################
|
|
|
|
|
|
|
|
include:
|
|
|
|
- project: $_GITLAB_TEMPLATES_REPO
|
|
|
|
ref: $_GITLAB_TEMPLATES_REF
|
|
|
|
file:
|
|
|
|
- '/includes/include.drupalci.variables.yml'
|
|
|
|
- '/includes/include.drupalci.workflows.yml'
|
|
|
|
|
|
|
|
################
|
|
|
|
# Variables
|
|
|
|
#
|
|
|
|
# Overriding variables
|
|
|
|
# - To override one or more of these variables, simply declare your own variables keyword.
|
|
|
|
# - Keywords declared directly in .gitlab-ci.yml take precedence over include files.
|
|
|
|
# - Documentation: https://docs.gitlab.com/ee/ci/variables/
|
|
|
|
# - Predefined variables: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
|
|
|
|
#
|
|
|
|
################
|
|
|
|
|
|
|
|
variables:
|
|
|
|
COMPOSER: composer.json
|
|
|
|
# Let composer know what self.version means.
|
2023-09-13 11:56:02 +00:00
|
|
|
COMPOSER_ROOT_VERSION: "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}-dev"
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
CONCURRENCY: 32
|
2023-09-15 16:05:09 +00:00
|
|
|
GIT_DEPTH: "3"
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
|
2023-09-16 09:08:36 +00:00
|
|
|
|
|
|
|
#############
|
|
|
|
# Stages #
|
|
|
|
#############
|
|
|
|
stages:
|
|
|
|
- 🏗️ Build
|
|
|
|
- 🪄 Lint
|
|
|
|
- 🗜️ Test
|
|
|
|
|
|
|
|
#############
|
|
|
|
# Templates #
|
|
|
|
#############
|
|
|
|
|
|
|
|
.default-job-settings: &default-job-settings-lint
|
2023-09-18 15:10:24 +00:00
|
|
|
interruptible: true
|
2023-09-16 09:08:36 +00:00
|
|
|
allow_failure: false
|
|
|
|
variables:
|
|
|
|
_TARGET_PHP: "8.2"
|
2023-09-29 16:01:46 +00:00
|
|
|
_TARGET_DB: "sqlite-3"
|
2023-09-16 09:08:36 +00:00
|
|
|
image:
|
|
|
|
name: $_CONFIG_DOCKERHUB_ROOT/php-$_TARGET_PHP-apache:production
|
|
|
|
rules:
|
|
|
|
- if: $CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_ROOT_NAMESPACE == "project"
|
|
|
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
|
|
|
|
|
|
.composer-cache: &composer-cache
|
|
|
|
key:
|
|
|
|
files:
|
|
|
|
- ./composer.json
|
|
|
|
- ./composer.lock
|
|
|
|
paths:
|
|
|
|
- ./vendor
|
|
|
|
|
|
|
|
.yarn-cache: &yarn-cache
|
|
|
|
key:
|
|
|
|
files:
|
|
|
|
- ./core/package.json
|
|
|
|
- ./core/yarn.lock
|
|
|
|
paths:
|
|
|
|
- ./core/node_modules
|
|
|
|
|
2023-09-22 05:50:51 +00:00
|
|
|
.with-composer-cache: &with-composer-cache
|
2023-09-16 09:08:36 +00:00
|
|
|
cache:
|
|
|
|
policy: pull
|
|
|
|
<<: *composer-cache
|
2023-09-28 20:04:17 +00:00
|
|
|
needs:
|
2023-09-16 09:08:36 +00:00
|
|
|
- '📦️ Composer'
|
|
|
|
|
|
|
|
.with-yarn-cache: &with-yarn-cache
|
2023-09-28 20:04:17 +00:00
|
|
|
needs:
|
2023-09-16 09:08:36 +00:00
|
|
|
- '📦️ Yarn'
|
|
|
|
cache:
|
|
|
|
policy: pull
|
|
|
|
<<: *yarn-cache
|
|
|
|
|
|
|
|
.junit-artifacts: &junit-artifacts
|
|
|
|
artifacts:
|
|
|
|
expose_as: junit
|
|
|
|
expire_in: 6 mos
|
|
|
|
paths:
|
|
|
|
- junit.xml
|
|
|
|
reports:
|
|
|
|
junit: junit.xml
|
|
|
|
|
|
|
|
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
################
|
|
|
|
# Stages
|
|
|
|
#
|
|
|
|
# Each job is assigned to a stage, defining the order in which the jobs are executed.
|
|
|
|
# Jobs in the same stage run in parallel.
|
|
|
|
#
|
|
|
|
# If all jobs in a stage succeed, the pipeline will proceed to the next stage.
|
|
|
|
# If any job in the stage fails, the pipeline will exit early.
|
|
|
|
################
|
|
|
|
|
|
|
|
.default-stage: &default-stage
|
2023-09-16 09:08:36 +00:00
|
|
|
stage: 🗜️ Test
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
trigger:
|
|
|
|
# Rely on the status of the child pipeline.
|
|
|
|
strategy: depend
|
|
|
|
include:
|
|
|
|
- local: .gitlab-ci/pipeline.yml
|
2023-09-15 08:41:49 +00:00
|
|
|
|
|
|
|
.run-on-commit: &run-on-commit
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
rules:
|
2023-09-15 08:41:49 +00:00
|
|
|
- if: $CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_ROOT_NAMESPACE == "project"
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
2023-09-15 08:41:49 +00:00
|
|
|
when: manual
|
|
|
|
allow_failure: true
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
|
2023-09-15 08:41:49 +00:00
|
|
|
.run-daily: &run-daily
|
|
|
|
rules:
|
|
|
|
- if: $CI_PIPELINE_SOURCE == "schedule" && $CI_PROJECT_ROOT_NAMESPACE == "project"
|
|
|
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
|
|
when: manual
|
|
|
|
allow_failure: true
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
|
2023-09-15 08:41:49 +00:00
|
|
|
# Default configuration.
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
'PHP 8.2 MySQL 8':
|
|
|
|
<<: *default-stage
|
|
|
|
variables:
|
2023-09-15 08:41:49 +00:00
|
|
|
_TARGET_PHP: "8.2"
|
|
|
|
_TARGET_DB: "mysql-8"
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
rules:
|
2023-09-13 10:21:14 +00:00
|
|
|
- if: $CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_ROOT_NAMESPACE == "project"
|
2023-09-15 08:41:49 +00:00
|
|
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
|
2023-09-15 08:41:49 +00:00
|
|
|
# Run on commit, or manually.
|
|
|
|
'PHP 8.1 MySQL 5.7':
|
|
|
|
<<: [ *default-stage, *run-on-commit ]
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
variables:
|
2023-09-15 08:41:49 +00:00
|
|
|
_TARGET_PHP: "8.1"
|
|
|
|
_TARGET_DB: "mysql-5.7"
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
|
|
|
|
'PHP 8.2 PostgreSQL 14.1':
|
2023-09-19 15:00:27 +00:00
|
|
|
<<: [ *default-stage, *run-daily ]
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
variables:
|
2023-09-15 08:41:49 +00:00
|
|
|
_TARGET_PHP: "8.2"
|
|
|
|
_TARGET_DB: "pgsql-14.1"
|
|
|
|
|
2023-09-18 20:03:35 +00:00
|
|
|
'PHP 8.2 PostgreSQL 15':
|
2023-09-19 15:00:27 +00:00
|
|
|
<<: [ *default-stage, *run-daily ]
|
2023-09-18 20:03:35 +00:00
|
|
|
variables:
|
|
|
|
_TARGET_PHP: "8.2"
|
|
|
|
_TARGET_DB: "pgsql-15"
|
|
|
|
|
|
|
|
'PHP 8.2 PostgreSQL 16':
|
|
|
|
<<: [ *default-stage, *run-on-commit ]
|
|
|
|
variables:
|
|
|
|
_TARGET_PHP: "8.2"
|
|
|
|
_TARGET_DB: "pgsql-16"
|
|
|
|
|
2023-09-29 16:01:46 +00:00
|
|
|
'PHP 8.2 SQLite 3':
|
|
|
|
<<: [ *default-stage, *run-on-commit ]
|
|
|
|
variables:
|
|
|
|
_TARGET_PHP: "8.2"
|
|
|
|
_TARGET_DB: "sqlite-3"
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
|
2023-09-15 08:41:49 +00:00
|
|
|
# Run daily, or manually.
|
|
|
|
# 'PHP 8.1 MariaDB 10.3.22':
|
|
|
|
# <<: [ *default-stage, *run-daily ]
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
# variables:
|
2023-09-15 08:41:49 +00:00
|
|
|
# _TARGET_PHP: "8.1"
|
|
|
|
# _TARGET_DB: "mariadb-10.3.22"
|
|
|
|
|
|
|
|
# 'PHP 8.1 MySQL 5.7 with updated deps':
|
|
|
|
# <<: [ *default-stage, *run-daily ]
|
|
|
|
# variables:
|
|
|
|
# _TARGET_PHP: "8.1"
|
|
|
|
# _TARGET_DB: "mysql-5.7"
|
|
|
|
|
|
|
|
'PHP 8.1 PostgreSQL 14.1':
|
|
|
|
<<: [ *default-stage, *run-daily ]
|
|
|
|
variables:
|
|
|
|
_TARGET_PHP: "8.1"
|
|
|
|
_TARGET_DB: "pgsql-14.1"
|
Issue #3386076 by fjgarlin, catch, longwave, larowlan, mstrelan, el7cosmos, RoSk0, xurizaemon, poker10, alexpott, bbrala, nick_schuch: GitLab CI integration for core
2023-09-13 09:32:38 +00:00
|
|
|
|
2023-09-29 16:01:46 +00:00
|
|
|
'PHP 8.1 SQLite 3':
|
|
|
|
<<: [ *default-stage, *run-daily ]
|
|
|
|
variables:
|
|
|
|
_TARGET_PHP: "8.1"
|
|
|
|
_TARGET_DB: "sqlite-3"
|
2023-09-16 09:08:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
################
|
|
|
|
# Build Jobs for linting
|
|
|
|
################
|
|
|
|
|
|
|
|
'📦️ Composer':
|
|
|
|
<<: *default-job-settings-lint
|
|
|
|
stage: 🏗️ Build
|
|
|
|
cache:
|
|
|
|
<<: *composer-cache
|
|
|
|
artifacts:
|
|
|
|
expire_in: 1 week
|
|
|
|
expose_as: 'web-vendor'
|
|
|
|
paths:
|
|
|
|
- vendor/
|
|
|
|
script:
|
|
|
|
- composer validate
|
|
|
|
- composer install
|
|
|
|
|
|
|
|
'📦️ Yarn':
|
|
|
|
<<: *default-job-settings-lint
|
|
|
|
stage: 🏗️ Build
|
|
|
|
cache:
|
|
|
|
<<: *yarn-cache
|
|
|
|
artifacts:
|
|
|
|
expire_in: 1 week
|
|
|
|
expose_as: 'yarn-vendor'
|
|
|
|
paths:
|
|
|
|
- core/node_modules/
|
|
|
|
script:
|
2023-09-19 13:27:24 +00:00
|
|
|
- yarn --cwd ./core install
|
2023-09-16 09:08:36 +00:00
|
|
|
|
|
|
|
################
|
|
|
|
# Lint Jobs
|
|
|
|
################
|
|
|
|
|
2023-09-28 20:04:17 +00:00
|
|
|
'🧹 PHP Static Analysis (phpstan)':
|
2023-09-16 09:08:36 +00:00
|
|
|
<<: [ *with-composer-cache, *junit-artifacts, *default-job-settings-lint ]
|
|
|
|
stage: 🪄 Lint
|
|
|
|
script:
|
2023-09-28 20:04:17 +00:00
|
|
|
- php vendor/bin/phpstan analyze --configuration=./core/phpstan.neon.dist --error-format=gitlab > phpstan-quality-report.json
|
2023-09-19 13:27:24 +00:00
|
|
|
artifacts:
|
|
|
|
reports:
|
2023-09-28 20:04:17 +00:00
|
|
|
codequality: phpstan-quality-report.json
|
2023-09-16 09:08:36 +00:00
|
|
|
|
2023-09-28 20:04:17 +00:00
|
|
|
'🧹 PHP Coding standards (PHPCS)':
|
2023-09-16 09:08:36 +00:00
|
|
|
<<: [ *with-composer-cache, *junit-artifacts, *default-job-settings-lint ]
|
|
|
|
stage: 🪄 Lint
|
|
|
|
script:
|
2023-09-28 20:04:17 +00:00
|
|
|
- composer phpcs -- --report-full --report-summary --report-\\Micheh\\PhpCodeSniffer\\Report\\Gitlab=phpcs-quality-report.json
|
2023-09-19 13:27:24 +00:00
|
|
|
artifacts:
|
|
|
|
reports:
|
2023-09-28 20:04:17 +00:00
|
|
|
codequality: phpcs-quality-report.json
|
2023-09-16 09:08:36 +00:00
|
|
|
|
|
|
|
'🧹 CSS linting (stylelint)':
|
|
|
|
<<: [ *with-yarn-cache, *junit-artifacts, *default-job-settings-lint ]
|
|
|
|
stage: 🪄 Lint
|
|
|
|
script:
|
2023-09-19 13:27:24 +00:00
|
|
|
- yarn run --cwd=./core lint:css --color --custom-formatter=node_modules/stylelint-formatter-gitlab
|
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
codequality: stylelint-quality-report.json
|
2023-09-16 09:08:36 +00:00
|
|
|
|
|
|
|
'🧹 Compilation check':
|
|
|
|
<<: [ *with-yarn-cache, *default-job-settings-lint ]
|
|
|
|
stage: 🪄 Lint
|
|
|
|
script:
|
|
|
|
- yarn run --cwd=./core build:css --check
|
|
|
|
- cd core && yarn run -s check:ckeditor5
|
|
|
|
|
|
|
|
'🧹 JavaScript linting (eslint)':
|
|
|
|
<<: [ *with-yarn-cache, *junit-artifacts, *default-job-settings-lint ]
|
|
|
|
stage: 🪄 Lint
|
|
|
|
script:
|
2023-09-19 13:27:24 +00:00
|
|
|
- yarn --cwd=./core run -s lint:core-js-passing --format gitlab
|
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
codequality: eslint-quality-report.json
|
2023-09-16 09:08:36 +00:00
|
|
|
|
|
|
|
'📔 Spell-checking':
|
|
|
|
<<: [ *with-yarn-cache, *default-job-settings-lint ]
|
|
|
|
stage: 🪄 Lint
|
|
|
|
script:
|
|
|
|
- export TARGET_BRANCH=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}
|
|
|
|
- git fetch -vn --depth=$GIT_DEPTH "${CI_MERGE_REQUEST_PROJECT_URL:-origin}" "+refs/heads/$TARGET_BRANCH:refs/heads/$TARGET_BRANCH"
|
|
|
|
- export MODIFIED=`git diff --name-only refs/heads/$TARGET_BRANCH|while read r;do echo "$CI_PROJECT_DIR/$r";done|tr "\n" " "`
|
|
|
|
- echo $MODIFIED | tr ' ' '\n' | yarn --cwd=./core run -s spellcheck:core --no-must-find-files --file-list stdin
|