laravel-5travis-cixdebugphp-7phpdbg

TravisCI: How to use xdebug or phpdbg according to PHP version (~5.6 or ~7.0)


I've seen that XDebug throws Segmentation Fault under PHP 7, that has been happening me and many others. So I got to the solution of running phpdbg with PHP 7 instead of using XDebug.

My question is how should I configure travis.yml to execute one or the other according to the PHP version I'm testing on.

This is my current config file for PHP 7, also available here

language: php

php:
  - "5.6"
  - "7.0"

install:
  - composer self-update

before_script:
  - phpenv config-rm xdebug.ini
  - mv .env.travis .env
  - mv travis.phpunit.xml phpunit.xml
  - mysql -e 'create database test_timegrid;'
  - composer install --dev --no-interaction
  - php artisan config:clear
  - php artisan migrate
  - php artisan db:seed
  - php artisan geoip:update
  - php artisan config:cache

script:
  - phpdbg -qrr vendor/bin/phpunit --coverage-clover build/logs/clover.xml

after_success:
  - ./travis-codeclimate-report.sh

With these setting I can't run tests for PHP 5.6, and when using XDebug those fail for PHP7, so I have kind of a mutual exclusion problem.

Any hints on this?

This is the Travis builds history and the current project files for PHP 5.6


Solution

  • Since there seem to be work-in-progress in this scenario I've decided to continue using XDebug until I can fully move to PHPDebug and use it for PHP7+ and PHP5.6.

    At this point, builds with XDebug + PHP7.1 are going well but throws sementation fault for PHP7.0. However, this is sort of ok for me, for now.

    Build logs:

    https://travis-ci.org/timegridio/timegrid/builds/173947875