Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gitlab CI DTT integration
drupal_tests:
image: hussainweb/drupal-base:php7.3
services:
- mariadb:10.3
stage: test
tags:
- autoscaler
variables:
SITE_BASE_URL: 'http://localhost'
MYSQL_DATABASE: "drupal"
MYSQL_ROOT_PASSWORD: "dbpass"
before_script:
# Install MySQL ourselves for now.
- apt-get update && apt-get install mariadb-client -y
- curl <URL-to-sql- -L --output drupal-db.sql.gz
- gunzip < drupal-db.sql.gz | mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mariadb "$MYSQL_DATABASE"
- ./ci.sh
script:
- composer install -o
# Clearing drush cache and importing configs
- ./vendor/drush/drush/drush cr
- ./vendor/drush/drush/drush -y updatedb
- ./vendor/drush/drush/drush -y config-import
# Phpunit execution
- ./vendor/bin/phpunit --bootstrap=./vendor/weitzman/drupal-test-traits/src/bootstrap-fast.php --configuration ./phpunit.xml --testsuite existing-site
#!/usr/bin/env bash
dir=$(dirname $0)
set -ex
cp ${dir}/settings.local.php ${dir}/../../web/sites/default/settings.local.php
sed -ri -e "s!/var/www/html/web!$CI_PROJECT_DIR/web!g" /etc/apache2/sites-available/*.conf
sed -ri -e "s!/var/www/html/web!$CI_PROJECT_DIR/web!g" /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
service apache2 start
<?php
$databases['default']['default'] = [
'driver' => 'mysql',
'database' => 'database',
'username' => 'root',
'password' => 'dbpass',
'host' => 'mariadb'
];
/**
* Fix for Hash salt error on drush cr
*
* @ref https://github.com/drush-ops/drush/issues/1050
*
*/
$settings['hash_salt'] = 'CHANGE_THIS';
$settings['trusted_host_patterns'][] = '^localhost$';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment