Skip to content
Snippets Groups Projects

Issue #3278176: Drupal.org Gitlab CI support

Merged dpi requested to merge issue/hux-3278176:3278176-drupal.org-gitlab-ci into 1.x
23 files
+ 589
5
Compare changes
  • Side-by-side
  • Inline
Files
23
+ 138
0
default:
image: skpr/php-cli:${PHP_VERSION}-dev-v2-latest
services:
- name: mysql:${MYSQL_VERSION}
alias: mysql
stages:
- pre
- build
- lint
- test
variables:
# Configure mysql environment variables (https://hub.docker.com/_/mysql/)
MYSQL_ROOT_PASSWORD: drupal
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
SIMPLETEST_DB: mysql://drupal:drupal@mysql/drupal
SIMPLETEST_BASE_URL: http://localhost:8080
BROWSERTEST_OUTPUT_DIRECTORY: app/sites/default/files
BROWSERTEST_OUTPUT_FILE: test-output.html
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"chromeOptions": { "args": [ "--disable-gpu", "--headless" ] } }, "http://chrome:4444/wd/hub" ]'
build app:
stage: build
cache:
key: ${CI_COMMIT_REF_SLUG}-composer
paths:
- app/vendor/
only:
- merge_requests
- branches
- tags
script:
- mkdir -p /tmp/project
- cp -r ${CI_PROJECT_DIR} /tmp/project/
- git clone --depth 1 --branch ${DRUPAL_CORE_CONSTRAINT}.x https://git.drupal.org/project/drupal.git app
- mv /tmp/project app/modules/
- cd app
- cp modules/project/hux/.drupalci/* .
- composer install
- composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
- composer config --no-plugins allow-plugins.cweagans/composer-patches true
- composer config --no-plugins extra.patches-file "composer.patches.json"
- composer config --no-plugins extra.enable-patching true
- composer config --unset platform.php
- composer require
--with-all-dependencies
dealerdirect/phpcodesniffer-composer-installer
dpi/drupal-phpunit-bootstrap
drupal/core-dev:^${DRUPAL_CORE_CONSTRAINT}
phpspec/prophecy-phpunit:^2
mglaman/phpstan-drupal:^1
phpstan/phpstan-deprecation-rules:*
micheh/phpcs-gitlab
- composer require -W cweagans/composer-patches
- composer require -W drupal/coder 8.3.x-dev#9fc079a2657f3780c8efb6f55baf995dea63b8c1
- composer require
drupal/dynamic_entity_reference:'^1@dev || ^3@dev'
drush/drush
- composer show
- mkdir -p ${BROWSERTEST_OUTPUT_DIRECTORY}
artifacts:
expire_in: 1 hour
paths:
- app/composer.lock
- app/
phpcs:
stage: lint
needs: ["build app"]
only:
- merge_requests
- branches
- tags
script:
- cd app
- vendor/bin/phpcs --standard=modules/project/hux/phpcs.xml --report=full --report-\\Micheh\\PhpCodeSniffer\\Report\\Gitlab=phpcs-quality-report.json modules/project/hux/
dependencies:
- build app
artifacts:
when: always
reports:
codequality: app/phpcs-quality-report.json
phpstan:
stage: lint
needs: ["build app"]
only:
- merge_requests
- branches
- tags
script:
- cd app
- vendor/bin/phpstan analyse --memory-limit=2G --no-progress -c phpstan.neon modules/project/hux --error-format gitlab > report.json
dependencies:
- build app
artifacts:
when: always
reports:
codequality: app/report.json
test unit:
needs: ["build app"]
stage: test
only:
- merge_requests
- branches
- tags
script:
- cd app
- vendor/bin/phpunit modules/project/hux/tests/src/Unit/ --log-junit report-unit.xml
dependencies:
- build app
artifacts:
when: always
reports:
junit: app/report-unit.xml
test kernel:
needs: ["build app"]
stage: test
before_script:
- cd app
- ./wait-for-it.sh -s -t 180 mysql:3306 -- echo "MySQL is Ready"
only:
- merge_requests
- branches
- tags
script:
- vendor/bin/phpunit modules/project/hux/tests/src/Kernel/ --log-junit report-kernel.xml
dependencies:
- build app
artifacts:
when: always
reports:
junit: app/report-kernel.xml
Loading