forked from drupal-media/entity_browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
81 lines (65 loc) · 2.9 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
language: php
php:
- 5.4
- 5.5
env:
global:
- MODULE_NAME='entity_browser'
- MODULE_TEST_GROUP='entity_browser'
- DRUPAL_REPO='git://drupalcode.org/project/drupal.git'
- DRUPAL_VERSION='8.0.x'
- PHPCS_VERSION='2.0.*@dev'
- CODER_VERSION='8.2.0-beta1'
matrix:
allow-failures:
- php: 5.5
before_install:
# Ensure we have the latest sources.
- sudo apt-get -y update
# Composer.
- sed -i '1i export PATH="$HOME/.composer/vendor/bin:$PATH"' $HOME/.bashrc
- source $HOME/.bashrc
# - composer self-update
# Drush.
- composer global require "youngj/httpserver:dev-master#41dd2b7"
- composer global require drush/drush:dev-master
# Codesniffer.
- composer global require squizlabs/php_codesniffer:$PHPCS_VERSION
# Coder.
- composer global require drupal/coder:$CODER_VERSION
- ln -s ~/.composer/vendor/drupal/coder/coder_sniffer/Drupal ~/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/
# Ensure the PHP environment is ready.
- phpenv rehash
install:
# Basic PHP packages.
- sudo apt-get install -y --force-yes php5-cgi php5-mysql
# Move the checked out module into the correct structure.
- mkdir /tmp/$MODULE_NAME
- mv * /tmp/$MODULE_NAME/
- git clone --branch $DRUPAL_VERSION $DRUPAL_REPO drupal --depth 1
- mv /tmp/$MODULE_NAME drupal/modules/
before_script:
# This fixes a fail when install Drupal.
- echo 'sendmail_path = /bin/true' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
# Install Drupal and enable the required modules (including this one).
- mysql -e 'create database drupal;'
- cd $TRAVIS_BUILD_DIR/drupal && drush --yes site-install testing --db-url="mysql://[email protected]/drupal"
- cd $TRAVIS_BUILD_DIR/drupal && drush --yes en $MODULE_NAME
- cd $TRAVIS_BUILD_DIR/drupal && drush --yes en simpletest
# Start a web server.
- drush runserver 127.0.0.1:8080 &
- until netstat -an 2>/dev/null | grep '8080.*LISTEN'; do true; done
script:
# Run code sniffer.
- phpcs --report=full --standard=Drupal $TRAVIS_BUILD_DIR/drupal/modules/$MODULE_NAME
# Run the tests
- php $TRAVIS_BUILD_DIR/drupal/core/scripts/run-tests.sh --verbose --color --php `which php` --url http://127.0.0.1:8080 "$MODULE_TEST_GROUP" | tee /tmp/test.txt; TEST_EXIT=${PIPESTATUS[0]}; echo $TEST_EXIT
# Check if we had fails in the run-tests.sh script
# Exit with the inverted value, because if there are no fails found, it will
# exit with 1 and for us that is a good thing so invert it to 0. Travis has
# some issues with the exclamation mark in front so we have to fiddle a bit.
# Also make the grep case insensitive and fail on run-tests.sh regular fails
# as well on fatal errors.
- TEST_OUTPUT=$(! egrep -i "([0-9]+ fails)|(PHP Fatal error)|([0-9]+ exceptions)" /tmp/test.txt > /dev/null)$?; echo $TEST_OUTPUT
# Exit the build
- if [ $TEST_EXIT -eq 0 ] && [ $TEST_OUTPUT -eq 0 ]; then exit 0; else exit 1; fi