-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.travis.yml
127 lines (104 loc) · 5.23 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
language: php
sudo: required
dist: xenial
services:
- mysql
- xvfb
php:
- 5.6
- 7.1
- 7.2
- 7.3
mysql:
database: drupal
username: root
encoding: utf8
before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome*.deb
- wget http://chromedriver.storage.googleapis.com/2.42/chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo mv chromedriver /usr/bin
install:
# Set unlimited memory_limit.
- if [ "${TRAVIS_PHP_VERSION}" != 'hhvm' ]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi;
- echo "memory_limit = -1" >> "${INI_FILE}"
# Remove xdebug for the moment. We aren't generating code coverage, and it slows us down.
- if [ "${TRAVIS_PHP_VERSION}" != '7.0' ]; then mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini /tmp/xdebug.ini; fi;
before_script:
# Create drupal database.
- mysql -u root -e "CREATE DATABASE drupal;"
# Set up DB user.
- mysql -uroot -e "CREATE USER drupal@localhost IDENTIFIED BY 'drupal';"
- mysql -uroot -e "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON drupal.* TO 'drupal'@'localhost' IDENTIFIED BY 'drupal';"
# Set github access token for composer if available.
- if [[ $GITHUB_OAUTH_TOKEN ]]; then git config --global github.accesstoken $GITHUB_OAUTH_TOKEN; fi
# Copy module to tmp dir for later use.
- mkdir /tmp/bat; cp -r * /tmp/bat
# Update composer.
- composer -n self-update
# Install drush.
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- composer -n global require drush/drush:8.*
# Install drush composer extension.
- drush dl composer-8.x-1.x
# Install code sniffer.
- composer -n global require drupal/coder
# Register Drupal coding standards.
- phpcs --config-set installed_paths ~/.composer/vendor/drupal/coder/coder_sniffer
# Don't display warnings.
- phpcs --config-set show_warnings 0
# Install required packages for behat.
- cd ./test/behat
- composer -n install
# Make the site.
- cd $TRAVIS_BUILD_DIR
- drush make test/project.make bat
# Copy the bat module into the Drupal site.
- mv /tmp/bat bat/sites/all/modules/bat
- cd bat
- php -d sendmail_path=$(which true) ~/.composer/vendor/bin/drush.php --yes site-install --db-url=mysql://drupal:drupal@127.0.0.1/drupal --account-name=admin --account-pass=test --site-mail=webmaster@roomify.us --site-name="bat"
# Following step with -y should also run composer install.
- drush -y en bat bat_api bat_calendar_reference bat_event bat_event_ui bat_facets bat_fullcalendar bat_unit composer_manager
- drush cc all --yes
# Run a webserver and wait until it is started up.
- drush --debug runserver "http://127.0.0.1" > ~/debug.txt 2>&1 &
- sleep 10
# Link test dir into working dir.
- ln -s $TRAVIS_BUILD_DIR/test .
- mkdir -p $HOME/.cache
- wget -nc -O $HOME/.cache/selenium-server-standalone-3.14.0.jar http://selenium-release.storage.googleapis.com/3.14/selenium-server-standalone-3.14.0.jar || true
- java -jar $HOME/.cache/selenium-server-standalone-3.14.0.jar -port 4444 &> /tmp/selenium.log &
- sleep 5
script:
- cd $TRAVIS_BUILD_DIR/bat/sites/all/modules/bat
# Check coding standards.
- phpcs --standard=Drupal --exclude=Drupal.Array.Array,Drupal.Commenting.FunctionComment,Drupal.Commenting.DocComment,Drupal.Commenting.FileComment,Drupal.NamingConventions.ValidClassName,Drupal.NamingConventions.ValidFunctionName,Drupal.NamingConventions.ValidVariableName,Drupal.InfoFiles.AutoAddedKeys,Drupal.InfoFiles.ClassFiles --report-width=74 --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml --ignore=test $TRAVIS_BUILD_DIR/bat/sites/all/modules/bat
- cd $TRAVIS_BUILD_DIR/bat/test/behat
# behat.yml includes behat.local.yml so it must exist
- touch behat.local.yml
# Set path to drupal root
- export BEHAT_PARAMS="{\"extensions\":{\"Drupal\\\DrupalExtension\":{\"drupal\":{\"drupal_root\":\"$TRAVIS_BUILD_DIR/bat\"}}}}"
- ./bin/behat
after_failure:
- echo "### DB LOG ###"
- cd $TRAVIS_BUILD_DIR/bat
- drush sqlq 'SELECT * FROM watchdog\G'
- echo "### Server log ###"
- cat ~/debug.txt
- echo "### Selenium log ###"
- cat /tmp/selenium.log
notifications:
slack: roomify:Z9qyI59J2b9NAF0XvdCn8VhH
env:
global:
secure: "PUOYps+ygWErjAmF91vh909N927PQad879Kl2X1bZlBpbG5tRgMTdodeG39XxbWjziwnNI+1cybuCg3bqkhAxpf7OmxyIPRbehsIpjIIcVuV+wlkZ7vh0CKlk5fhZA80M3rwqyby6hYxmEj3UpHn4BKJAeH7kwEFGz8DKH96xYfNlmQflAeNCpiGfIFyz1duaWJvLPhw7e2PFpUp3Jt42Sig6w08Ja41v98uagBZ490ZZbZcM6B7GWLNWUcMA5FNCzj1jRHMg7dOZOlw/s1BJkKLE67DDjm0dQVIh5SL/3dZoPbQCqpoW1A6gZxbO61F4EALqfDsEb1LGnTRvzZqqhIQA9zNdrIGgSZzIeHAUGlRaknWjAS+y0WfilSrtvWha2pGYvif5NB2sfhr7wa27C3a6i4L5OZoNzaxxuaS8QJgYIneeESNkiD7/IyT4at0bK0BpV+KFGsa6dO6dWhI3UM7A6PuhSLo8P4CThA0X+US2nHegRgM0slLVC8b0E/ONaEMpHFiygSjf3+z2k2+ETLAa38iQuSLuhrhhUH5luYvim1xlgFvMliCLBk5SCCnTCw2BOLJxq03AdlbAmspw5yrjcOFDov80sTrujSZU98I1dkR8w7nrtuJ7CnRXGPPkbybv1QfYvKIdtzSI0dcsuzNV5kNrvmBRqPgcX3bdCA="
# Cache composer/drush files
cache:
directories:
- $HOME/.cache
- $HOME/.composer/cache
- vendor
- test/behat/bin
- test/behat/vendor
- $HOME/.drush/cache