forked from CashWilliams/tfa
-
Notifications
You must be signed in to change notification settings - Fork 11
/
.travis.yml
93 lines (73 loc) · 2.85 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
language: php
sudo: false
php:
- 5.5.9
- 5.6
- 7
matrix:
allow_failures:
- php: 7.0
# Don't wait for the allowed failures to build.
fast_finish: true
env:
global:
# The name of the module to run tests on (this module).
- DRUPAL_MODULE=tfa
# Database variable for kernel tests.
- SIMPLETEST_DB="mysql://root:@127.0.0.1/drupal"
# Web server URL for browser tests.
- SIMPLETEST_BASE_URL="http://localhost:8888"
# Drupal database name.
- DATABASE='drupal'
# Drupal database user.
- DB_USERNAME='root'
# Drupal database encoding.
- DB_ENCODE='utf8mb4_unicode_ci'
services:
- mysql
mysql:
database: $DATABASE
username: $DB_USERNAME
encoding: $DB_ENCODE
install:
# Add composer's global bin directory to the path
# See: https://github.com/drush-ops/drush#install---composer
- export PATH="$HOME/.composer/vendor/bin:$PATH"
# Install drush globally
- composer global require drush/drush
- phpenv rehash
before_script:
# Remove Xdebug as we don't need it and it causes the tests to slowdown
- phpenv config-rm xdebug.ini || true
# Create database.
- mysql -e "CREATE DATABASE IF NOT EXISTS drupal CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" -uroot
# Set the drupal root folder location.
- export DRUPAL_ROOT=$TRAVIS_BUILD_DIR/../drupal
# Download Drupal 8 core
- drush -y dl drupal --destination=$DRUPAL_ROOT --drupal-project-rename=drupal
- DRUPAL_ROOT=$DRUPAL_ROOT/drupal
# Reference the module in build site.
- ln -s $TRAVIS_BUILD_DIR $DRUPAL_ROOT/modules/$DRUPAL_MODULE
# Download the additional modules.
- cd $DRUPAL_ROOT/modules
- git clone --depth 1 https://github.com/d8-contrib-modules/ga_login.git
- git clone --branch 8.x-3.x https://git.drupal.org/project/encrypt.git
- git clone --branch 8.x-1.x https://git.drupal.org/project/key.git
# Bring the Encrypt Test module into existence which is a dependency of the TFA module.
- cp -r encrypt/tests/modules/encrypt_test $DRUPAL_ROOT/modules
# Manually clone the dependencies
- git clone --depth 1 --branch 8.x-1.x http://git.drupal.org/project/composer_manager.git
# We need to run simpletest so install drupal and enable simpletest.
- drush -y --root=$DRUPAL_ROOT site-install --db-url=$SIMPLETEST_DB
- drush -y --root=$DRUPAL_ROOT en simpletest
- drush -y --root=$DRUPAL_ROOT en composer_manager
# Initialize composer manage
- cd $DRUPAL_ROOT
- php modules/composer_manager/scripts/init.php
# Install module dependencies through composer
- composer drupal-update
# Start a web server on port 8888, run in the background and wait.
- nohup php -S localhost:8888 > /dev/null 2>&1 &
script:
# Run web test. Specific tests should be added in one of the following formats.
- php $DRUPAL_ROOT/core/scripts/run-tests.sh --php $(which php) --verbose --url $SIMPLETEST_BASE_URL --module $DRUPAL_MODULE