From 368fdd3de9526bf5baa8fe12cabb589e56dc7a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sat, 23 Nov 2019 12:38:48 +0100 Subject: [PATCH] Enhancement: Collect coverage on Travis CI --- .travis.yml | 32 +++++++++++++++++++------------- .travis/xdebug.sh | 22 ++++++++++++++++++++++ readme.md | 4 +++- 3 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 .travis/xdebug.sh diff --git a/.travis.yml b/.travis.yml index 04b153eec1..e1e5e2c586 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: @@ -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 diff --git a/.travis/xdebug.sh b/.travis/xdebug.sh new file mode 100644 index 0000000000..c3cebe3c66 --- /dev/null +++ b/.travis/xdebug.sh @@ -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 +} diff --git a/readme.md b/readme.md index c9bac035e9..ab02ab9293 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,7 @@ # Faker +[![Code Coverage](https://codecov.io/gh/fzaninotto/Faker/branch/master/graph/badge.svg)](https://codecov.io/gh/fzaninotto/Faker) + Faker is a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you. Faker is heavily inspired by Perl's [Data::Faker](http://search.cpan.org/~jasonk/Data-Faker-0.07/), and by ruby's [Faker](https://rubygems.org/gems/faker). @@ -53,7 +55,7 @@ composer require fzaninotto/faker ### Autoloading -Faker supports both `PSR-0` as `PSR-4` autoloaders. +Faker supports both `PSR-0` as `PSR-4` autoloaders. ```php