Created
January 23, 2020 00:23
-
-
Save hussainweb/be009f41ad6b67618354323fefeeccc5 to your computer and use it in GitHub Desktop.
Gitlab CI DTT integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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