forked from socketwench/flag-drupal8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
95 lines (79 loc) · 3.43 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
language: php
php:
- 5.4
- 5.5
mysql:
database: drupal
username: root
encoding: utf8
addons:
hosts:
- travis.dev
env:
global:
- MODULE_NAME='flag'
- MODULE_TEST_GROUP='flag'
- DRUPAL_REPO='git://drupalcode.org/project/drupal.git'
- DRUPAL_VERSION='8.0.x'
- PHPCS_VERSION='2.0.*@dev'
- CODER_VERSION='dev-8.x-2.x'
before_install:
# Install Apache and FastCGI extension to connect to PHP-FPM.
- sudo apt-get update > /dev/null
- sudo apt-get install apache2 libapache2-mod-fastcgi > /dev/null
- sudo a2enmod rewrite actions fastcgi alias
- sudo cp -f .travis/vhost.conf /etc/apache2/sites-available/default
- sudo sed -i -e "s,/var/www,`pwd`,g" /etc/apache2/sites-available/default
# Start PHP-FPM. There is no process manager available to start PHP-FPM on
# Travis CI currently, so we have to locate and enable it manually.
- sudo cp $HOME/.phpenv/versions/`php -r "print PHP_VERSION;"`/etc/php-fpm.conf.default $HOME/.phpenv/versions/`php -r "print PHP_VERSION;"`/etc/php-fpm.conf
- $HOME/.phpenv/versions/`php -r "print PHP_VERSION;"`/sbin/php-fpm
# Import the PHP configuration.
- phpenv config-add .travis/php.ini
# Always update Composer to the recent version, otherwise the drush
# installation fails.
- composer selfupdate
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:dev-master
- composer global require squizlabs/php_codesniffer:$PHPCS_VERSION
- composer global require drupal/coder:$CODER_VERSION
before_script:
# Create a Drupal coding standard reference in PHPCS coding standards.
- ln -s ~/.composer/vendor/drupal/coder/coder_sniffer/Drupal ~/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards
# Remember the current flag test directory for later use in the Drupal
# installation.
- TESTDIR=$(pwd)
# Navigate out of module directory to prevent blown stack by recursive module
# lookup.
- cd ..
# Create new site, stubbing sendmail path with true to prevent delivery errors
# and manually resolving drush path.
- mysql -e 'create database drupal'
# Download Drupal 8 core.
- git clone --depth 1 --branch $DRUPAL_VERSION $DRUPAL_REPO drupal
- cd drupal
# Install Drupal.
- php -d sendmail_path=`which true` ~/.composer/vendor/bin/drush.php --yes --uri=http://travis.dev site-install --db-url=mysql://root:@localhost/drupal testing
# Reference and enable flag in build site.
- ln -s $TESTDIR modules/$MODULE_NAME
- drush --yes pm-enable simpletest $MODULE_NAME
# Start a web server on port 8080, run in the background; wait for
# initialization. This is temporarly disabled since there are no web tests
# yet.
- sudo apachectl restart
- until netstat -an 2>/dev/null | grep '80.*LISTEN'; do true; done
script:
# Run the Coder sniffer for Flag.
- phpcs --report=full --standard=Drupal ./modules/$MODULE_NAME
# Run the Simpletests for Flag.
- php ./core/scripts/run-tests.sh --php `which php` --concurrency 12 --url http://travis.dev --verbose --color "$MODULE_TEST_GROUP"
# Run the PHPUnit tests.
- ./core/vendor/phpunit/phpunit/phpunit -c ./core/phpunit.xml.dist ./modules/$MODULE_NAME
after_failure:
- echo "Failures detected. Outputing additional logs:"
- sudo cat /var/log/apache2/error.log
- sudo cat /var/log/mysql/error.log