-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
87 lines (69 loc) · 3.11 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
notifications:
email:
language: php
php:
- 5.4
- 5.5
env:
- PATH=$PATH:/home/travis/.composer/vendor/bin
mysql:
database: drupal
username: root
encoding: utf8
install:
# Update package managers.
- sudo apt-get update
- composer self-update
# Install Apache.
- sudo apt-get install apache2 libapache2-mod-fastcgi
# Enable php-fpm.
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- sudo a2enmod rewrite actions fastcgi alias
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
# Configure Apache virtual hosts.
- sudo cp -f travis/apache_virtual_hosts.txt /etc/apache2/sites-available/default
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)/../drupal?g" --in-place /etc/apache2/sites-available/default
# Make sure all Apache configuration takes effect.
- sudo service apache2 restart
- curl -v "http://localhost"
# Download Drush.
- composer global require drush/drush:dev-master --prefer-source
- cd /home/travis/.composer/vendor/drush/drush
- drush version
# Download Drupal core.
- cd $TRAVIS_BUILD_DIR/..
- git clone --branch 8.0.x --depth 1 http://git.drupal.org/project/drupal.git
- cd $TRAVIS_BUILD_DIR/../drupal
# Download module dependencies.
- cd $TRAVIS_BUILD_DIR/../drupal/modules
- git clone --branch 8.x-3.x --depth 1 http://git.drupal.org/project/currency.git
# Add Coveralls.io integration.
- cd $TRAVIS_BUILD_DIR/../drupal
- composer require satooshi/php-coveralls:0.6.* --prefer-source
# Copy Payment into Drupal core.
- cp -Rv $TRAVIS_BUILD_DIR $TRAVIS_BUILD_DIR/../drupal/modules/
before_script:
# Set sendmail so drush doesn't throw an error during site install.
- echo "sendmail_path='true'" >> `php --ini | grep "Loaded Configuration" | awk '{print $4}'`
script:
# Run PHPUnit tests and submit code coverage statistics.
- cd $TRAVIS_BUILD_DIR/../drupal/core
- mkdir -p build/logs
- vendor/bin/phpunit -c ../modules/payment/phpunit.xml.dist --bootstrap ../core/tests/bootstrap.php --verbose --debug --coverage-clover build/logs/clover.xml || exit 1
- php vendor/bin/coveralls -v -c ../modules/payment/.coveralls.yml
# Install Drupal core.
- cd $TRAVIS_BUILD_DIR/../drupal
- drush -v site-install minimal --db-url=mysql://root:@localhost/drupal --yes
- phpenv rehash
# Enable Simpletest and run Simpletest tests.
- drush en --yes simpletest
- drush cr
- cd $TRAVIS_BUILD_DIR/../drupal
- php core/scripts/run-tests.sh --verbose --color --concurrency 4 --php `which php` --url http://localhost "Payment" "Payment Form Field" "Payment Reference Field" | tee /tmp/test.txt
# Simpletest does not exit with code 0 on success, so we will need to analyze
# the output to ascertain whether the tests passed.
- TEST_EXIT=${PIPESTATUS[0]}
- TEST_SIMPLETEST=$(! egrep -i "([0-9]+ fails)|(PHP Fatal error)|([0-9]+ exceptions)" /tmp/test.txt > /dev/null)$?
- if [ $TEST_EXIT -eq 0 ] && [ $TEST_SIMPLETEST -eq 0 ]; then exit 0; else exit 1; fi