Skip to content
Snippets Groups Projects
Commit 428520f2 authored by Steven Ayers's avatar Steven Ayers
Browse files

Issue #3396691: GitLab CI

parent 28b1cddb
No related branches found
Tags 8.x-1.0-alpha2
1 merge request!9Issue #3396691: GitLab CI
Pipeline #39205 passed with warnings
################
# DrupalCI GitLabCI template
#
# Gitlab-ci.yml to replicate DrupalCI testing for Contrib
#
# With thanks to:
# * The GitLab Acceleration Initiative participants
# * DrupalSpoons
################
################
# 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.
################
################
# 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:
################
# DrupalCI includes:
# As long as you include this, any future includes added by the Drupal Association will be accessible to your pipelines automatically.
# View these include files at https://git.drupalcode.org/project/gitlab_templates/
################
- project: $_GITLAB_TEMPLATES_REPO
ref: $_GITLAB_TEMPLATES_REF
file:
- '/includes/include.drupalci.main.yml'
- '/includes/include.drupalci.variables.yml'
- '/includes/include.drupalci.workflows.yml'
################
# Pipeline configuration variables
#
# These are the variables provided to the Run Pipeline form that a user may want to override.
#
# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/includes/include.drupalci.variables.yml
################
variables:
# Disable default phpunit job in favor of the d9/10 variants below.
SKIP_PHPUNIT: 1
# Run two variations of composer job.
composer:
parallel:
matrix:
- _TARGET_PHP: [ "7.4" ]
_TARGET_CORE: [ "9.5.x" ]
- _TARGET_PHP: [ "8.1" ]
_TARGET_CORE: [ "$CORE_STABLE" ]
#
# The 4 validation jobs below are explicit about their artifact. This is not strictly needed
# (last wins) but done for demonstration. https://docs.gitlab.com/ee/ci/jobs/job_control.html#fetch-artifacts-from-a-parallelmatrix-job
#
drupal-check:
stage: validate
allow_failure: true
dependencies:
- "composer: [8.1, $CORE_STABLE]"
rules:
- if: '$SKIP_DRUPAL_CHECK == "1"'
when: never
- when: on_success
before_script:
- composer require mglaman/drupal-check --dev
script:
- vendor/bin/drupal-check --drupal-root $CI_PROJECT_DIR/$_WEB_ROOT $CI_PROJECT_DIR/$_WEB_ROOT/modules/custom/$CI_PROJECT_NAME
phpcs:
dependencies:
- "composer: [8.1, $CORE_STABLE]"
composer-lint:
dependencies:
- "composer: [8.1, $CORE_STABLE]"
eslint:
dependencies:
- "composer: [8.1, $CORE_STABLE]"
stylelint:
dependencies:
- "composer: [8.1, $CORE_STABLE]"
.phpunit-local:
variables:
SKIP_PHPUNIT: 0
phpunit-d9:
needs:
- job: composer
parallel:
matrix:
- _TARGET_PHP: "7.4"
_TARGET_CORE: "9.5.x"
variables:
_TARGET_PHP: "7.4"
extends:
- .phpunit-base
- .phpunit-local
phpunit-d10:
needs:
- job: composer
parallel:
matrix:
- _TARGET_PHP: "8.1"
_TARGET_CORE: $CORE_STABLE
variables:
_TARGET_PHP: "8.1"
extends:
- .phpunit-base
- .phpunit-local
###################################################################################
#
# *
# /(
# ((((,
# /(((((((
# ((((((((((*
# ,(((((((((((((((
# ,(((((((((((((((((((
# ((((((((((((((((((((((((*
# *(((((((((((((((((((((((((((((
# ((((((((((((((((((((((((((((((((((*
# *(((((((((((((((((( .((((((((((((((((((
# ((((((((((((((((((. /(((((((((((((((((*
# /((((((((((((((((( .(((((((((((((((((,
# ,(((((((((((((((((( ((((((((((((((((((
# .(((((((((((((((((((( .(((((((((((((((((
# ((((((((((((((((((((((( ((((((((((((((((/
# (((((((((((((((((((((((((((/ ,(((((((((((((((*
# .((((((((((((((/ /(((((((((((((. ,(((((((((((((((
# *(((((((((((((( ,(((((((((((((/ *((((((((((((((.
# ((((((((((((((, /(((((((((((((. ((((((((((((((,
# (((((((((((((/ ,(((((((((((((* ,(((((((((((((,
# *((((((((((((( .((((((((((((((( ,(((((((((((((
# ((((((((((((/ /((((((((((((((((((. ,((((((((((((/
# ((((((((((((( *(((((((((((((((((((((((* *((((((((((((
# ((((((((((((( ,(((((((((((((..((((((((((((( *((((((((((((
# ((((((((((((, /((((((((((((* /((((((((((((/ ((((((((((((
# ((((((((((((( /((((((((((((/ (((((((((((((* ((((((((((((
# (((((((((((((/ /(((((((((((( ,((((((((((((, *((((((((((((
# (((((((((((((( *(((((((((((/ *((((((((((((. ((((((((((((/
# *((((((((((((((((((((((((((, /(((((((((((((((((((((((((
# ((((((((((((((((((((((((( ((((((((((((((((((((((((,
# .(((((((((((((((((((((((/ ,(((((((((((((((((((((((
# ((((((((((((((((((((((/ ,(((((((((((((((((((((/
# *((((((((((((((((((((( (((((((((((((((((((((,
# ,(((((((((((((((((((((, ((((((((((((((((((((/
# ,(((((((((((((((((((((* /((((((((((((((((((((
# ((((((((((((((((((((((, ,/((((((((((((((((((((,
# ,(((((((((((((((((((((((((((((((((((((((((((((((((((
# .(((((((((((((((((((((((((((((((((((((((((((((
# .((((((((((((((((((((((((((((((((((((,.
# .,(((((((((((((((((((((((((.
#
###################################################################################
language: php
sudo: false
php:
- 5.6
- 7.0
- 7.1
env:
matrix:
- DRUPAL_CORE=8.6.x
global:
MODULE_NAME='message_subscribe'
CODER_VERSION='8.2.*'
mysql:
database: drupal
username: root
encoding: utf8
before_script:
# Remove Xdebug as we don't need it and it causes "PHP Fatal error: Maximum
# function nesting level of '256' reached."
# We also don't care if that file exists or not on PHP 7.
- phpenv config-rm xdebug.ini || true
# Remember the current directory for later use in the Drupal installation.
- TESTDIR=$(pwd)
# Navigate out of module directory to prevent blown stack by recursive module
# lookup.
- cd ..
# Create database.
- mysql -e 'create database drupal'
# Export database variable for kernel tests.
- export SIMPLETEST_DB=mysql://root:@127.0.0.1/drupal
# Download Drupal 8 core.
- travis_retry git clone --branch $DRUPAL_CORE --depth 1 https://git.drupal.org/project/drupal.git
- cd drupal
# Download dependencies.
# @todo Specify in `require` and `require-dev` in `composer.json`
- composer require drupal/flag drupal/message drupal/message_notify
# @todo Revert back to main repo once deprecation issue is committed.
# @see https://github.com/Gizra/og/pull/365
- cd modules && git clone --branch 364-deprecated https://github.com/jhedstrom/og.git && cd -
# Install Composer dependencies.
- composer self-update && composer install
- composer update phpunit/phpunit --with-dependencies
# Coder.
- composer global require drupal/coder:$CODER_VERSION
- ln -s ~/.composer/vendor/drupal/coder/coder_sniffer/Drupal ~/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/
# Reference OG in the Drupal site.
- ln -s $TESTDIR modules/$MODULE_NAME
# Start a web server on port 8888 in the background.
- nohup php -S localhost:8888 > /dev/null 2>&1 &
# Wait until the web server is responding.
- until curl -s localhost:8888; do true; done > /dev/null
# Export web server URL for browser tests.
- export SIMPLETEST_BASE_URL=http://localhost:8888
script:
# Coding standards.
- $HOME/.composer/vendor/bin/phpcs --report=full --standard=Drupal --severity=error $TESTDIR
# Run the PHPUnit tests which also include the kernel tests.
- ./vendor/phpunit/phpunit/phpunit -c ./core/phpunit.xml.dist ./modules/$MODULE_NAME
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment