Skip to content
Snippets Groups Projects
Commit c7835ec8 authored by Lee Rowlands's avatar Lee Rowlands Committed by Fran Garcia-Linares
Browse files

Issue #3325225 by larowlan, xurizaemon, RoSk0, el7cosmos, fjgarlin: Proof of concept

parent fd7f9fd9
Branches
No related tags found
1 merge request!1Proof of concept
################
# DrupalCI GitLabCI template
#
# Gitlab-ci.yml to replicate DrupalCI testing for Contrib
#
# This is hestenet's test template
# Source: https://gitlab.com/drupal-infrastructure/gitlab-acceleration/gitlabci/file-templates/-/blob/main/gitlab-ci/template.gitlab-ci.yml
# Gitlab-ci.yml to replicate DrupalCI testing for Core
#
# With thanks to:
# 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
################
......@@ -14,55 +14,67 @@
################
# Guidelines
#
# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification. It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained.
#
# However, you can modify this template if you have additional needs for your project.
# * Fail fast
# * Provide helpful user feedback
################
################
# 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.
# One advantage of include files is that if they are updated upstream, the changes affect all pipelines using that include.
#
# Includes can be overriden 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:
################
# DrupalCI includes:
# include.drupalci.main.yml - This parent include contains nested includes for all DrupalCI test features. As long as you include this, any future includes added by the Drupal Association will be accessible to your pipelies automatically.
# View this file to see what nested includes are provided.
################
remote: 'https://gitlab.com/drupal-infrastructure/gitlab-acceleration/gitlabci/file-templates/-/raw/main/includes/include.drupalci.main.yml'
include:
- project: $_GITLAB_TEMPLATES_REPO
ref: $_GITLAB_TEMPLATES_REF
file:
# The stages for core are different than those of contrib.
# - '/includes/include.drupalci.main.yml'
- '/includes/include.drupalci.variables.yml'
- '/includes/include.drupalci.workflows.yml'
################
# Variables
#
# The include file include.drupalci.main.yml in this template includes a include.drupalci.variables.yml
# - These variables provide 'Semantic Labels' to help you automatically track the current supported and development versions of Drupal, as well as the current min/max system requirements for PHP, database, etc.
# - If this file is updated, your testing configuration will automatically follow these changes.
# - These variables provide 'Semantic Labels' to help you automatically track the current supported and development versions of Drupal, as well as the current min/max system requirements for PHP, database, etc.
# - If this file is updated, your testing configuration will automatically follow these changes.
#
# 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.
# - 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
#
# - Predefined variables: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
#
################
variables:
_TARGET_PHP:
value: "8.1"
COMPOSER:
# We don't want to use spoons here, just our default composer.json.
value: composer.json
COMPOSER_ROOT_VERSION:
# Let composer know what self.version means.
value: "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}-dev"
DEFAULT_CONCURRENCY: 32
################
# Workflow
#
# The include file include.drupalci.main.yml in this template includes a include.drupalci.worfklows.yml
# - This will test on commit, on merge request, and on any scheduled defined in the GitLab UI for your project.
# - If this file is updated, your testing configuration will automatically follow these changes.
# - This will test on commit, on merge request, and on any scheduled defined in the GitLab UI for your project.
# - If this file is updated, your testing configuration will automatically follow these changes.
#
# Overriding workflows
# - To override these workflows, simply declare your own workflow keyword.
# - Keywords declared directly in .gitlab-ci.yml take precedence over include files.
# - Documentation: https://docs.gitlab.com/ee/ci/yaml/workflow.html
# - To override these workflows, simply declare your own workflow keyword.
# - Keywords declared directly in .gitlab-ci.yml take precedence over include files.
# - Documentation: https://docs.gitlab.com/ee/ci/yaml/workflow.html
#
################
......@@ -70,206 +82,67 @@ include:
# 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.
# 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.
################
stages:
################
# Build
#
# In the Build stage we are assembling our test environment:
# * Selecting the core version to test against
# * Selecting php version
# * Selectig the database, and configuring it
# * Plus any additional build steps, like composer runs, etc
# Wherever possible, we use variables defined in: include.druaplci.variables.yml so that the configuration can stay up to date with current Drupal Core development.
#
# Documentation: https://docs.gitlab.com/ee/ci/yaml/#stages
################
- build-validate # This phase checks that the configuration being used for the build is valid.
- build
################
# Validate
#
# The validate stage includes any codebase validation that we want to perform before running functional tests. These are items we may want to fail-fast on, before doing a full test-run.
################
- validate
################
# Test
#
# The test phase actually executes the functional tests, as well as gathering results and artifacts.
################
- test
################
# Jobs
#
# Jobs define what scripts are actually executed in each stage.
#
# The 'rules' keyword can also be used to define conditions for each job.
# # @TODO: Use rules to define core version to test against, allow overriding default on manual run with variables. (Perhaps with 'variables in variables')
#
# Documentation: https://docs.gitlab.com/ee/ci/jobs/
################
################
# Build Jobs
# If any job in the stage fails, the pipeline will exit early.
################
composer-lint:
stage: build-validate
script:
- composer validate
- composer lint
variable-checks: # This job runs in the build stage, which runs first.
stage: build
script:
- echo "Checking variables"
- echo $_TARGET_CORE
- echo $_TARGET_PHP
- echo $_TARGET_DB_TYPE
- echo $_TARGET_DB_VERSION
- echo $_WEB_ROOT
- echo $_COMPOSER_JSON
# @TODO - work in progress to adapt the composer build step from DrupalSpoons examples
composer:
stage: build
'PHP 8.1 MySQL 5.7':
stage: test
variables:
# Used the bin/setup script.
NONINTERACTIVE: 1
# Use artifacts to copy codebase to subsequent jobs.
# See https://lorisleiva.com/laravel-deployment-using-gitlab-pipelines/.
artifacts:
expire_in: 1 week
expose_as: 'web-vendor'
paths: # @todo - where we want to store artifacts?
- vendor/
- $_WEB_ROOT
- .composer-plugin.env
- composer.spoons.json
- composer.spoons.lock\
script: #this script is configuring composer, including options for local Dev - can we simplify?
- export
- bash <(curl -s https://gitlab.com/drupal-infrastructure/gitlab-acceleration/gitlabci/file-templates/-/raw/main/scripts/composer-setup)
################
# Validate Jobs
################
phpcs:
stage: validate
script:
# Do we need: vendor/drupalspoons/composer-plugin/templates/phpcs.xml.dist ?
#- cp -u vendor/drupalspoons/composer-plugin/templates/phpcs.xml.dist $_WEB_ROOT/modules/custom
- composer phpcs -- --report-junit=junit.xml --report-full --report-summary
allow_failure: true
artifacts:
expose_as: junit
expire_in: 6 mos
paths:
- junit.xml
reports:
junit: junit.xml
stylelint:
stage: validate
script:
# Installs all core javascript dependencies.
- yarn --cwd $_WEB_ROOT/core add stylelint-junit-formatter
- composer stylelint -- --color || true
- composer stylelint -- --color --custom-formatter node_modules/stylelint-junit-formatter > junit.xml || true
allow_failure: true
artifacts:
expose_as: junit
expire_in: 6 mos
paths:
- junit.xml
reports:
junit: junit.xml
eslint:
stage: validate
script:
# Installs all core javascript dependencies.
- yarn --cwd $_WEB_ROOT/core add stylelint-junit-formatter
- composer eslint -- --format junit --output-file junit.xml || true
allow_failure: true
artifacts:
expose_as: junit
expire_in: 6 mos
paths:
- junit.xml
reports:
junit: junit.xml
################
# Test Jobs
################
# @TODO: Multiple environment handling
# Do we want to offer a default example of matrix testing, perhaps commented out? Or linked to in documentation?
# Or do we want to stick to single environment for cost control, and rely on advanced maintainers to figure it out?
################
#Set default php image
default:
image:
name: $_CONFIG_DOCKERHUB_ROOT/php-$_TARGET_PHP-apache:production
phpunit:
_TARGET_PHP: "8.1"
_TARGET_DB_TYPE: "mysql"
_TARGET_DB_VERSION: "5.7"
trigger:
# Rely on the status of the child pipeline.
strategy: depend
include:
- local: .gitlab-ci/pipeline.yml
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
'PHP 8.1 MySQL 8':
stage: test
variables:
# https://docs.gitlab.com/runner/configuration/feature-flags.html#available-feature-flags
FF_NETWORK_PER_BUILD: 1
SIMPLETEST_BASE_URL: http://localhost:8888
DB_DRIVER: mysql
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mysql
MYSQL_USER: drupaltestbot
MYSQL_PASSWORD: drupaltestbotpw
MARIADB_TAG: $_TARGET_DB_VERSION
POSTGRES_TAG: $_TARGET_DB_VERSION
POSTGRES_DB: pgsql
POSTGRES_USER: drupaltestbot
POSTGRES_PASSWORD: drupaltestbotpw
services:
- name: $_CONFIG_DOCKERHUB_ROOT/$_TARGET_DB_TYPE-$_TARGET_DB_VERSION:production
alias: database
- name: $_CONFIG_DOCKERHUB_ROOT/chromedriver:production
alias: chrome
entrypoint:
- chromedriver
- "--no-sandbox"
- "--log-path=/tmp/chromedriver.log"
- "--verbose"
- "--whitelisted-ips="
script:
# Determine DB driver.
- |
[[ $_TARGET_DB_TYPE == "sqlite" ]] && export SIMPLETEST_DB=sqlite://localhost/sites/default/files/.sqlite
[[ $_TARGET_DB_TYPE == "mysql" ]] && export SIMPLETEST_DB=mysql://$MYSQL_USER:$MYSQL_PASSWORD@database/$MYSQL_DATABASE
[[ $_TARGET_DB_TYPE == "pgsql" ]] && export SIMPLETEST_DB=pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@database/$POSTGRES_DB
- export
- mkdir $_WEB_ROOT/sites/simpletest
- composer webserver >> webserver.log 2>&1 &
# Provide some context on the test run.
- vendor/bin/drush status
# Finally, execute tests.
- composer unit -- --log-junit junit.xml
artifacts:
expire_in: 6 mos
expose_as: 'junit-browser_output-webserver_log'
reports:
junit: junit.xml
paths:
- junit.xml
- webserver.log
- $_WEB_ROOT/sites/simpletest/browser_output
_TARGET_PHP: "8.1"
_TARGET_DB_TYPE: "mysql"
_TARGET_DB_VERSION: "8"
trigger:
# Rely on the status of the child pipeline.
strategy: depend
include:
- local: .gitlab-ci/pipeline.yml
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
'PHP 8.1 PostgreSQL 13.5':
stage: test
variables:
_TARGET_PHP: "8.1"
_TARGET_DB_TYPE: "pgsql"
_TARGET_DB_VERSION: "13.5"
trigger:
# Rely on the status of the child pipeline.
strategy: depend
include:
- local: .gitlab-ci/pipeline.yml
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
'PHP 8.1 PostgreSQL 14.1':
stage: test
variables:
_TARGET_PHP: "8.1"
_TARGET_DB_TYPE: "pgsql"
_TARGET_DB_VERSION: "14.1"
trigger:
# Rely on the status of the child pipeline.
strategy: depend
include:
- local: .gitlab-ci/pipeline.yml
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: manual
stages:
################
# Build
#
# In the Build stage we are assembling our test environment:
# * Selecting the core version to test against
# * Selecting php version
# * Selectig the database, and configuring it
# * Plus any additional build steps, like composer runs, etc
# Wherever possible, we use variables defined in: include.druaplci.variables.yml so that the configuration can stay up to date with current Drupal Core development.
#
# Documentation: https://docs.gitlab.com/ee/ci/yaml/#stages
################
- 🏗️ Build # Build third party dependencies etc
################
# Validate
#
# The validate stage includes any codebase validation that we want to perform before running functional tests. These are items we may want to fail-fast on, before doing a full test-run.
################
- 🪄 Lint # Code quality checks
################
# Test
#
# The test phase actually executes the tests, as well as gathering results and artifacts.
################
- 🗜️ Test
#############
# Templates #
#############
#Set default php image
.default_php_image: &default_php_image
image:
name: $_CONFIG_DOCKERHUB_ROOT/php-$_TARGET_PHP-apache:production
# Default rules.
.default_rules: &default_rules
rules:
- if: $CI_PIPELINE_SOURCE == "parent_pipeline"
.composer_code: &composer_code
paths:
- ./vendor
.composer-cache: &composer_cache
key:
files:
- ./composer.json
- ./composer.lock
<<: *composer_code
.yarn-code: &yarn_code
paths:
- ./core/node_modules
.yarn-cache: &yarn_cache
key:
files:
- ./core/package.json
- ./core/yarn.lock
<<: *yarn_code
.pull-composer-cache: &pull-composer-cache
cache:
policy: pull
<<: *composer_cache
dependencies:
- '📦️ Composer'
.with-composer-cache: &with-composer-cache
needs:
- '📦️ Composer'
<<: *pull-composer-cache
.interruptible: &interruptible
interruptible: true
allow_failure: false
.with-yarn-cache: &with-yarn-cache
dependencies:
- '📦️ Yarn'
needs:
- '📦️ 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
.with-linting: &with-linting
needs:
- '📦️ Composer'
- '🧹 PHP Static Analysis (phpstan)'
- '🧹 PHP Coding standards (PHPCS)'
- '🧹 Compilation check'
- '📦️ Yarn'
- '📔 Spell-checking'
- '🧹 JavaScript linting (eslint)'
- '🧹 CSS linting (stylelint)'
<<: *pull-composer-cache
.with-unit-tests: &with-unit-tests
needs:
- '⚡️ PHPUnit Unit'
- '📦️ Composer'
<<: *pull-composer-cache
.with-composer-and-yarn: &with-composer-and-yarn
needs:
- '📦️ Composer'
- '⚡️ PHPUnit Unit'
- '📦️ Yarn'
dependencies:
- '📦️ Yarn'
- '📦️ Composer'
.test-variables: &test-variables
FF_NETWORK_PER_BUILD: 1
SIMPLETEST_BASE_URL: http://localhost/subdirectory
DB_DRIVER: mysql
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mysql
MYSQL_USER: drupaltestbot
MYSQL_PASSWORD: drupaltestbotpw
MARIADB_TAG: $_TARGET_DB_VERSION
POSTGRES_TAG: $_TARGET_DB_VERSION
POSTGRES_DB: pgsql
POSTGRES_USER: drupaltestbot
POSTGRES_PASSWORD: drupaltestbotpw
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-dev-shm-usage","--disable-gpu","--headless"]}}, "http://localhost:9515"]'
.with-database: &with-database
name: $_CONFIG_DOCKERHUB_ROOT/$_TARGET_DB_TYPE-$_TARGET_DB_VERSION:production
alias: database
.with-chrome: &with-chrome
name: $_CONFIG_DOCKERHUB_ROOT/chromedriver:production
alias: chrome
entrypoint:
- chromedriver
- "--no-sandbox"
- "--log-path=/tmp/chromedriver.log"
- "--verbose"
- "--whitelisted-ips="
.phpunit-artifacts: &phpunit-artifacts
artifacts:
when: always
expire_in: 6 mos
reports:
junit: ./sites/default/files/simpletest/phpunit-*.xml
paths:
- ./sites/default/files/simpletest/phpunit-*.xml
- ./sites/simpletest/browser_output
.setup-webroot: &setup-webserver
before_script:
- ln -s `pwd` /var/www/html/subdirectory
- sudo service apache2 start
.run-tests: &run-tests
script:
# Determine DB driver.
- |
[[ $_TARGET_DB_TYPE == "sqlite" ]] && export SIMPLETEST_DB=sqlite://localhost/sites/default/files/.sqlite
[[ $_TARGET_DB_TYPE == "mysql" ]] && export SIMPLETEST_DB=mysql://$MYSQL_USER:$MYSQL_PASSWORD@database/$MYSQL_DATABASE
[[ $_TARGET_DB_TYPE == "pgsql" ]] && export SIMPLETEST_DB=pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@database/$POSTGRES_DB
- export
- mkdir -p ./sites/simpletest ./build/logs/junit /var/www/.composer
- chown -R www-data:www-data ./sites ./build/logs/junit ./vendor /var/www/
- sudo -u www-data git config --global --add safe.directory `pwd`
# We need to pass this along directly even though it's set in the environment parameters.
- sudo MINK_DRIVER_ARGS_WEBDRIVER="$MINK_DRIVER_ARGS_WEBDRIVER" -u www-data php ./core/scripts/run-tests.sh --color --keep-results --types "$TESTSUITE" --concurrency "$CONCURRENCY" --repeat "1" --sqlite "./sites/default/files/.sqlite" --dburl $SIMPLETEST_DB --url $SIMPLETEST_BASE_URL --all --verbose --non-html
################
# Jobs
#
# Jobs define what scripts are actually executed in each stage.
#
# The 'rules' keyword can also be used to define conditions for each job.
#
# Documentation: https://docs.gitlab.com/ee/ci/jobs/
################
################
# Build Jobs
################
'ℹ️ Output build parameters': # This job runs in the build stage, which runs first.
<<: *default_php_image
stage: 🏗️ Build
interruptible: true
script:
- echo "Checking variables"
- echo $_TARGET_PHP
- echo $_TARGET_DB_TYPE
- echo $_TARGET_DB_VERSION
'📦️ Composer':
<<: [ *default_php_image, *default_rules ]
stage: 🏗️ Build
<<: *interruptible
cache:
<<: *composer_cache
artifacts:
expire_in: 1 week
expose_as: 'web-vendor'
paths:
- vendor/
script:
- export
- composer validate
- composer install
'📦️ Yarn':
<<: [ *default_php_image, *default_rules ]
stage: 🏗️ Build
interruptible: true
cache:
<<: *yarn_cache
artifacts:
expire_in: 1 week
expose_as: 'yarn-vendor'
paths:
- core/node_modules/
script:
# Installs all core javascript dependencies and adds junit formatter.
- yarn --cwd ./core add stylelint-junit-formatter
################
# Lint Jobs
################
'🧹 PHP Coding standards (PHPCS)':
<<: [ *with-composer-cache, *interruptible, *junit-artifacts, *default_php_image, *default_rules ]
stage: 🪄 Lint
script:
- composer phpcs -- --report-junit=junit.xml --report-full --report-summary
'🧹 PHP Static Analysis (phpstan)':
<<: [ *with-composer-cache, *interruptible, *junit-artifacts, *default_php_image, *default_rules ]
stage: 🪄 Lint
script:
# Turn off apc to avoid corrupt composer cache.
- php -d apc.enabled=0 -d apc.enable_cli=0 vendor/bin/phpstan analyze --no-progress --configuration=./core/phpstan.neon.dist --error-format=junit > junit.xml
'🧹 CSS linting (stylelint)':
<<: [ *with-yarn-cache, *interruptible, *junit-artifacts, *default_php_image, *default_rules ]
stage: 🪄 Lint
script:
- yarn run --cwd=./core lint:css --color --custom-formatter node_modules/stylelint-junit-formatter > junit.xml
'🧹 Compilation check':
<<: [ *with-yarn-cache, *interruptible, *default_php_image, *default_rules ]
stage: 🪄 Lint
script:
- yarn run --cwd=./core build:css --check
- cd core && yarn run -s check:ckeditor5
'🧹 JavaScript linting (eslint)':
<<: [ *with-yarn-cache, *interruptible, *junit-artifacts, *default_php_image, *default_rules ]
stage: 🪄 Lint
script:
- yarn --cwd=./core run -s lint:core-js-passing --format junit > junit.xml
'📔 Spell-checking':
<<: [ *with-yarn-cache, *interruptible, *default_php_image, *default_rules ]
stage: 🪄 Lint
script:
- git fetch origin
- export MODIFIED=`git diff --name-only origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}|while read r;do echo "$PWD/$r";done|tr "\n" " "`
- yarn --cwd=./core run -s spellcheck --no-must-find-files -c ./.cspell.json check $MODIFIED
################
# Test Jobs
################
'⚡️ PHPUnit Unit':
<<: [ *with-linting, *interruptible, *phpunit-artifacts, *setup-webserver, *run-tests, *default_php_image, *default_rules ]
stage: 🗜️ Test
services:
# There are some unit tests that need a database.
- <<: *with-database
variables:
<<: *test-variables
TESTSUITE: PHPUnit-Unit
CONCURRENCY: "$DEFAULT_CONCURRENCY"
'⚙️️ PHPUnit Kernel':
<<: [ *with-unit-tests, *interruptible, *phpunit-artifacts, *setup-webserver, *run-tests, *default_php_image, *default_rules ]
stage: 🗜️ Test
variables:
<<: *test-variables
TESTSUITE: PHPUnit-Kernel
CONCURRENCY: "$DEFAULT_CONCURRENCY"
services:
- <<: *with-database
'🌐️️ PHPUnit Functional':
<<: [ *with-unit-tests, *interruptible, *phpunit-artifacts, *setup-webserver, *run-tests, *default_php_image, *default_rules ]
stage: 🗜️ Test
timeout: 2 hours
variables:
<<: *test-variables
TESTSUITE: PHPUnit-Functional
CONCURRENCY: "$DEFAULT_CONCURRENCY"
services:
- <<: *with-database
'👷️️️ PHPUnit Build':
<<: [ *with-unit-tests, *interruptible, *phpunit-artifacts, *setup-webserver, *run-tests, *default_php_image, *default_rules ]
stage: 🗜️ Test
variables:
<<: *test-variables
TESTSUITE: PHPUnit-Build
CONCURRENCY: "$DEFAULT_CONCURRENCY"
services:
- <<: *with-database
'🖱️️️ PHPUnit Functional Javascript':
<<: [ *with-unit-tests, *interruptible, *phpunit-artifacts, *setup-webserver, *run-tests, *default_php_image, *default_rules ]
stage: 🗜️ Test
variables:
<<: *test-variables
TESTSUITE: PHPUnit-FunctionalJavascript
CONCURRENCY: 15
services:
- <<: *with-database
- <<: *with-chrome
'🦉️️️ Nightwatch':
<<: [ *with-composer-and-yarn, *interruptible, *setup-webserver, *default_php_image, *default_rules ]
stage: 🗜️ Test
variables:
<<: *test-variables
services:
- <<: *with-database
- <<: *with-chrome
script:
# Determine DB driver.
- |
[[ $_TARGET_DB_TYPE == "sqlite" ]] && export DRUPAL_TEST_DB_URL=sqlite://localhost/sites/default/files/.sqlite
[[ $_TARGET_DB_TYPE == "mysql" ]] && export DRUPAL_TEST_DB_URL=mysql://$MYSQL_USER:$MYSQL_PASSWORD@database/$MYSQL_DATABASE
[[ $_TARGET_DB_TYPE == "pgsql" ]] && export DRUPAL_TEST_DB_URL=pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@database/$POSTGRES_DB
- export
- cp ./core/.env.example ./core/.env
# dotenv-safe/config does not support environment variables
# @see https://github.com/rolodato/dotenv-safe/issues/126
# @todo move this to `variables` when the above is resolved
- echo "DRUPAL_TEST_BASE_URL='http://localhost/subdirectory'" >> ./core/.env
- echo "DRUPAL_TEST_CHROMEDRIVER_AUTOSTART=false" >> ./core/.env
- echo "DRUPAL_TEST_DB_URL='${DRUPAL_TEST_DB_URL}'" >> ./core/.env
- echo "DRUPAL_TEST_WEBDRIVER_HOSTNAME='localhost'" >> ./core/.env
- echo "DRUPAL_TEST_WEBDRIVER_CHROME_ARGS='--disable-dev-shm-usage --disable-gpu --headless'" >> ./core/.env
- echo "DRUPAL_TEST_WEBDRIVER_PORT='9515'" >> ./core/.env
- echo "DRUPAL_NIGHTWATCH_OUTPUT='"nightwatch_output"'" >> ./core/.env
- cat ./core/.env
- mkdir -p ./sites/simpletest /var/www/.cache/yarn /var/www/.yarn ./nightwatch_output
- chown -R www-data:www-data ./sites/simpletest /var/www/.cache/yarn /var/www/.yarn ./nightwatch_output ./core/.env
- sudo BABEL_DISABLE_CACHE=1 -u www-data yarn --cwd ./core test:nightwatch
artifacts:
when: always
expire_in: 6 mos
reports:
junit: ./nightwatch_output/*.xml
paths:
- ./nightwatch_output
......@@ -52,14 +52,14 @@ protected function initMink() {
}
catch (DriverException $e) {
if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) {
$this->markTestSkipped("The test wasn't able to connect to your webdriver instance. For more information read core/tests/README.md.\n\nThe original message while starting Mink: {$e->getMessage()}");
$this->fail("The test wasn't able to connect to your webdriver instance. For more information read core/tests/README.md.\n\nThe original message while starting Mink: {$e->getMessage()}. Mink driver args are " . getenv('MINK_DRIVER_ARGS_WEBDRIVER'));
}
else {
throw $e;
}
}
catch (\Exception $e) {
$this->markTestSkipped('An unexpected error occurred while starting Mink: ' . $e->getMessage());
$this->fail('An unexpected error occurred while starting Mink: ' . $e->getMessage());
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment