Skip to content

Instantly share code, notes, and snippets.

@mmenavas
Created August 13, 2018 04:36
Show Gist options
  • Save mmenavas/b94d95a5f726625dc9e3dcdcd7c956be to your computer and use it in GitHub Desktop.
Save mmenavas/b94d95a5f726625dc9e3dcdcd7c956be to your computer and use it in GitHub Desktop.
Travis CI file for custom Drupal 8 module
language: php
php:
- '7.2'
env:
global:
- MODULE_NAME='example'
- SIMPLETEST_BASE_URL='http://127.0.0.1:8080'
# Ignore Symfony's deprecation notices.
- SYMFONY_DEPRECATIONS_HELPER=weak
mysql:
database: drupal
username: root
encoding: utf8
before_install:
# Disable xdebug.
- phpenv config-rm xdebug.ini
install:
# Download and install Drupal Composer.
- cd .. && composer create-project drupal-composer/drupal-project:8.x-dev drupal --stability dev --no-interaction
- cd drupal && composer install
# Create symlink to add Marvel module to drupal site.
- ln -s $TRAVIS_BUILD_DIR web/modules/$MODULE_NAME
# Install Drupal via `drush si`
- ./vendor/bin/drush --yes site-install standard --db-url="mysql://root@127.0.0.1/drupal"
# Enable Marvel module
- ./vendor/bin/drush en $MODULE_NAME
# start a web server on port 8080, run in the background; wait for initialization
# Credit: https://github.com/sonnym/travis-ci-drupal-module-example/blob/8.x-1.x/.travis.yml
- ./vendor/bin/drush runserver 127.0.0.1:8080 &
- until netstat -an 2>/dev/null | grep '8080.*LISTEN'; do true; done
script: cd web && ../vendor/bin/phpunit -c core/phpunit.xml.dist modules/$MODULE_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment