|
| 1 | +language: php |
| 2 | +sudo: false |
| 3 | + |
| 4 | +php: |
| 5 | + - 5.5 |
| 6 | + - 5.6 |
| 7 | + - 7 |
| 8 | + |
| 9 | +env: |
| 10 | + global: |
| 11 | + - DRUPAL_GRAPHQL=8.x-3.x |
| 12 | + - DRUPAL_BUILD_DIR=$TRAVIS_BUILD_DIR/../drupal |
| 13 | + - SIMPLETEST_DB=mysql://root:@127.0.0.1/graphql |
| 14 | + - TRAVIS=true |
| 15 | + matrix: |
| 16 | + - DRUPAL_CORE=8.2.x |
| 17 | + - DRUPAL_CORE=8.3.x |
| 18 | + - DRUPAL_CORE=8.4.x |
| 19 | + |
| 20 | +matrix: |
| 21 | + # Don't wait for the allowed failures to build. |
| 22 | + fast_finish: true |
| 23 | + include: |
| 24 | + - php: 7 |
| 25 | + env: |
| 26 | + - DRUPAL_CORE=8.4.x |
| 27 | + # Only run code coverage on the latest php and drupal versions. |
| 28 | + - WITH_PHPDBG_COVERAGE=true |
| 29 | + allow_failures: |
| 30 | + # Allow the code coverage report to fail. |
| 31 | + - php: 7 |
| 32 | + env: |
| 33 | + - DRUPAL_CORE=8.4.x |
| 34 | + # Only run code coverage on the latest php and drupal versions. |
| 35 | + - WITH_PHPDBG_COVERAGE=true |
| 36 | + |
| 37 | +mysql: |
| 38 | + database: graphql |
| 39 | + username: root |
| 40 | + encoding: utf8 |
| 41 | + |
| 42 | +# Cache composer downloads. |
| 43 | +cache: |
| 44 | + directories: |
| 45 | + - $HOME/.composer |
| 46 | + |
| 47 | +before_install: |
| 48 | + # Disable xdebug. |
| 49 | + - phpenv config-rm xdebug.ini |
| 50 | + |
| 51 | + # Determine the php settings file location. |
| 52 | + - if [[ $TRAVIS_PHP_VERSION = hhvm* ]]; |
| 53 | + then export PHPINI=/etc/hhvm/php.ini; |
| 54 | + else export PHPINI=$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; |
| 55 | + fi |
| 56 | + |
| 57 | + # PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated |
| 58 | + # and will be removed in a future version. To avoid this warning set |
| 59 | + # 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input |
| 60 | + # stream instead. |
| 61 | + - if [[ "$TRAVIS_PHP_VERSION" == "5.6" ]]; |
| 62 | + then echo always_populate_raw_post_data = -1 >> $PHPINI; |
| 63 | + fi; |
| 64 | + |
| 65 | + # Disable the default memory limit. |
| 66 | + - echo memory_limit = -1 >> $PHPINI |
| 67 | + |
| 68 | + # Update composer. |
| 69 | + - composer self-update |
| 70 | + |
| 71 | +install: |
| 72 | + # Create the database. |
| 73 | + - mysql -e 'create database graphql' |
| 74 | + |
| 75 | + # Download Drupal 8 core from the Github mirror because it is faster. |
| 76 | + - git clone --branch $DRUPAL_CORE --depth 1 https://github.com/drupal/drupal.git $DRUPAL_BUILD_DIR |
| 77 | + - git clone --branch $DRUPAL_GRAPHQL --depth 1 https://github.com/fubhy/graphql-drupal.git $DRUPAL_BUILD_DIR/modules/graphql |
| 78 | + |
| 79 | + # Reference the module in the build site. |
| 80 | + - ln -s $TRAVIS_BUILD_DIR $DRUPAL_BUILD_DIR/modules/graphql_json |
| 81 | + |
| 82 | + # When running with phpdbg we need to replace all code occurrences that check |
| 83 | + # for 'cli' with 'phpdbg'. Some files might be write protected, hence the |
| 84 | + # fallback. |
| 85 | + - if [[ "$WITH_PHPDBG_COVERAGE" == "true" ]]; |
| 86 | + then grep -rl 'cli' $DRUPAL_BUILD_DIR/core $DRUPAL_BUILD_DIR/modules | xargs sed -i "s/'cli'/'phpdbg'/g" || true; |
| 87 | + fi |
| 88 | + |
| 89 | + # Bring in the module dependencies without requiring a merge plugin. The |
| 90 | + # require also triggers a full 'composer install'. |
| 91 | + - composer --working-dir=$DRUPAL_BUILD_DIR require youshido/graphql:~1.5 |
| 92 | + |
| 93 | +script: |
| 94 | + # Run the unit tests using phpdbg if the environment variable is 'true'. |
| 95 | + - if [[ "$WITH_PHPDBG_COVERAGE" == "true" ]]; |
| 96 | + then phpdbg -qrr $DRUPAL_BUILD_DIR/vendor/bin/phpunit --configuration $DRUPAL_BUILD_DIR/core/phpunit.xml.dist --coverage-clover $TRAVIS_BUILD_DIR/coverage.xml $TRAVIS_BUILD_DIR; |
| 97 | + fi |
| 98 | + |
| 99 | + # Run the unit tests with standard php otherwise. |
| 100 | + - if [[ "$WITH_PHPDBG_COVERAGE" != "true" ]]; |
| 101 | + then $DRUPAL_BUILD_DIR/vendor/bin/phpunit --configuration $DRUPAL_BUILD_DIR/core/phpunit.xml.dist $TRAVIS_BUILD_DIR; |
| 102 | + fi |
| 103 | + |
| 104 | +after_success: |
| 105 | + - if [[ "$WITH_PHPDBG_COVERAGE" == "true" ]]; |
| 106 | + then bash <(curl -s https://codecov.io/bash); |
| 107 | + fi |
0 commit comments