Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Enhancement: Collect coverage on Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Nov 23, 2019
1 parent f884b66 commit 7e3bb1c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 13 deletions.
32 changes: 19 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ language: php

dist: precise

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- nightly
jobs:
include:
- php: 5.3
- php: 5.4
- php: 5.5
- php: 5.6
- php: 7.0
- php: 7.1
- php: 7.2
- php: 7.3
env: WITH_COVERAGE=true
- php: nightly

matrix:
allow_failures:
Expand All @@ -22,9 +24,13 @@ cache:
- $HOME/.composer/cache

before_install:
- phpenv config-rm xdebug.ini || true
- source .travis/xdebug.sh
- xdebug-disable

before_script:
- travis_retry composer install --no-interaction --prefer-dist
- travis_retry composer install --no-interaction --prefer-dist

script: make sniff test
script:
- make sniff
- if [[ "$WITH_COVERAGE" == "true" ]]; then xdebug-enable; fi
- if [[ "$WITH_COVERAGE" == "true" ]]; then make coverage; else make test; fi
22 changes: 22 additions & 0 deletions .travis/xdebug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# The problem is that we do not want to remove the configuration file, just disable it for a few tasks, then enable it
#
# For reference, see
#
# - https://docs.travis-ci.com/user/languages/php#Disabling-preinstalled-PHP-extensions
# - https://docs.travis-ci.com/user/languages/php#Custom-PHP-configuration

config="/home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini"

function xdebug-disable() {
if [[ -f $config ]]; then
mv $config "$config.bak"
fi
}

function xdebug-enable() {
if [[ -f "$config.bak" ]]; then
mv "$config.bak" $config
fi
}

0 comments on commit 7e3bb1c

Please sign in to comment.