forked from drupal-graphql/graphql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
110 lines (91 loc) · 3.39 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
language: php
sudo: false
php:
- 7.1
- 7
- 5.6
- 5.5
env:
global:
- DRUPAL_BUILD_DIR=$TRAVIS_BUILD_DIR/../drupal
- SIMPLETEST_DB=mysql://root:@127.0.0.1/graphql
- TRAVIS=true
matrix:
- DRUPAL_CORE=8.3.x
- DRUPAL_CORE=8.4.x
- DRUPAL_CORE=8.5.x
matrix:
# Don't wait for the allowed failures to build.
fast_finish: true
include:
- php: 7.1
env:
- DRUPAL_CORE=8.4.x
# Only run code coverage on the latest php and drupal versions.
- WITH_PHPDBG_COVERAGE=true
allow_failures:
# Allow the code coverage report to fail.
- php: 7.1
env:
- DRUPAL_CORE=8.4.x
# Only run code coverage on the latest php and drupal versions.
- WITH_PHPDBG_COVERAGE=true
mysql:
database: graphql
username: root
encoding: utf8
# Cache composer downloads.
cache:
directories:
- $HOME/.composer
before_install:
# Disable xdebug.
- phpenv config-rm xdebug.ini
# Determine the php settings file location.
- if [[ $TRAVIS_PHP_VERSION = hhvm* ]];
then export PHPINI=/etc/hhvm/php.ini;
else export PHPINI=$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini;
fi
# PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated
# and will be removed in a future version. To avoid this warning set
# 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input
# stream instead.
- if [[ "$TRAVIS_PHP_VERSION" == "5.6" ]];
then echo always_populate_raw_post_data = -1 >> $PHPINI;
fi;
# Disable the default memory limit.
- echo memory_limit = -1 >> $PHPINI
# Update composer.
- composer self-update
install:
# Create the database.
- mysql -e 'create database graphql'
# Download Drupal 8 core from the Github mirror because it is faster.
- git clone --branch $DRUPAL_CORE --depth 1 https://github.com/drupal/drupal.git $DRUPAL_BUILD_DIR
# Reference the module in the build site.
- ln -s $TRAVIS_BUILD_DIR $DRUPAL_BUILD_DIR/modules/graphql
# Copy the customized phpunit configuration file to the core directory so
# the relative paths are correct.
- cp $DRUPAL_BUILD_DIR/modules/graphql/phpunit.xml.dist $DRUPAL_BUILD_DIR/core/phpunit.xml
# When running with phpdbg we need to replace all code occurrences that check
# for 'cli' with 'phpdbg'. Some files might be write protected, hence the
# fallback.
- if [[ "$WITH_PHPDBG_COVERAGE" == "true" ]];
then grep -rl 'cli' $DRUPAL_BUILD_DIR/core $DRUPAL_BUILD_DIR/modules | xargs sed -i "s/'cli'/'phpdbg'/g" || true;
fi
# Bring in the module dependencies without requiring a merge plugin. The
# require also triggers a full 'composer install'.
- composer --working-dir=$DRUPAL_BUILD_DIR require webonyx/graphql-php:^0.11.5
script:
# Run the unit tests using phpdbg if the environment variable is 'true'.
- if [[ "$WITH_PHPDBG_COVERAGE" == "true" ]];
then phpdbg -qrr $DRUPAL_BUILD_DIR/vendor/bin/phpunit --configuration $DRUPAL_BUILD_DIR/core/phpunit.xml --coverage-clover $TRAVIS_BUILD_DIR/coverage.xml $TRAVIS_BUILD_DIR;
fi
# Run the unit tests with standard php otherwise.
- if [[ "$WITH_PHPDBG_COVERAGE" != "true" ]];
then $DRUPAL_BUILD_DIR/vendor/bin/phpunit --configuration $DRUPAL_BUILD_DIR/core/phpunit.xml $TRAVIS_BUILD_DIR;
fi
after_success:
- if [[ "$WITH_PHPDBG_COVERAGE" == "true" ]];
then bash <(curl -s https://codecov.io/bash);
fi