forked from drupal-graphql/graphql-views
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
118 lines (97 loc) · 3.71 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
111
112
113
114
115
116
117
118
language: php
sudo: false
php:
- 7.3
- 7.2
- 7.1
- 7.0
services:
- mysql
env:
global:
- DRUPAL_GRAPHQL=8.x-3.x
- DRUPAL_BUILD_DIR=$TRAVIS_BUILD_DIR/../drupal
- SIMPLETEST_DB=mysql://root:@127.0.0.1/graphql
- TRAVIS=true
matrix:
- DRUPAL_CORE=8.7.x
- DRUPAL_CORE=8.8.x
matrix:
# Don't wait for the allowed failures to build.
fast_finish: true
include:
- php: 7.3
env:
- DRUPAL_CORE=8.7.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.3
env:
- DRUPAL_CORE=8.7.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
# 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
- git clone --branch $DRUPAL_GRAPHQL --depth 1 https://github.com/drupal-graphql/graphql.git $DRUPAL_BUILD_DIR/modules/graphql
# Reference the module in the build site.
- ln -s $TRAVIS_BUILD_DIR $DRUPAL_BUILD_DIR/modules/graphql_views
# 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.12.5
# For Drupal < 8.8 we have to manually upgrade zend-stdlib to avoid PHP 7.3
# incompatibilities.
- if [[ "$DRUPAL_CORE" = "8.6.x" || "$DRUPAL_CORE" = "8.7.x" ]];
then composer --working-dir=$DRUPAL_BUILD_DIR require zendframework/zend-stdlib:3.2.1;
fi
# For Drupal < 8.8 we have to manually upgrade phpunit to avoid PHP 7.3
# incompatibilities.
- if [[ "$DRUPAL_CORE" = "8.6.x" || "$DRUPAL_CORE" = "8.7.x" ]];
then composer --working-dir=$DRUPAL_BUILD_DIR run-script drupal-phpunit-upgrade;
fi
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