From d8dc1e335cfb11f93abe5bb95c2c053189e934be Mon Sep 17 00:00:00 2001 From: Gordon Anderson Date: Thu, 21 Jan 2016 02:37:43 +0700 Subject: [PATCH] ENHANCEMENT: Added code coverage and extra badges on the home page --- .travis.yml | 25 +++++++++++++++++++++++-- README.md | 17 ++++++++++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 939dd84..2bb352d 100755 --- a/.travis.yml +++ b/.travis.yml @@ -7,16 +7,25 @@ addons: packages: - tidy +before_install: + - pip install --user codecov + env: global: - DB=MYSQL CORE_RELEASE=3.1 + # Turn coverage off by default, as it's expensive time wise + - COVERAGE=0 + + # The path of the module when installed by composer + - MODULE_PATH=blog + matrix: allow_failures: - php: hhvm-nightly include: - php: 5.6 - env: DB=MYSQL + env: DB=MYSQL COVERAGE=1 - php: 5.5 env: DB=MYSQL - php: 5.4 @@ -35,5 +44,17 @@ before_script: - php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss - cd ~/builds/ss +#Execute tests with or without coverage script: - - vendor/bin/phpunit blog/tests/ + # Execute tests with no coverage. This is the fastest option + - "if [ \"$COVERAGE\" = \"0\" ]; then vendor/bin/phpunit $MODULE_PATH/tests/; fi" + + # Execute tests with coverage. Do this for a small + - "if [ \"$COVERAGE\" = \"1\" ]; then vendor/bin/phpunit --coverage-clover=coverage.clover $MODULE_PATH/tests/; fi" + +#Upload coverage even if there is a failure +after_script: + - "if [ \"$COVERAGE\" = \"1\" ]; then mv coverage.clover ~/build/$TRAVIS_REPO_SLUG/; fi" + - cd ~/build/$TRAVIS_REPO_SLUG + - wget https://scrutinizer-ci.com/ocular.phar + - "if [ \"$COVERAGE\" = \"1\" ]; then travis_retry codecov && travis_retry php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi" diff --git a/README.md b/README.md index 9d6ad6c..47e6c1a 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,21 @@ # SilverStripe Blog Module +[![Build Status](https://travis-ci.org/silverstripe/silverstripe-blog.svg?branch=master)](https://travis-ci.org/silverstripe/silverstripe-blog) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/silverstripe/silverstripe-blog/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-blog/?branch=master) +[![Build Status](https://scrutinizer-ci.com/g/silverstripe/silverstripe-blog/badges/build.png?b=master)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-blog/build-status/master) +[![codecov.io](https://codecov.io/github/silverstripe/silverstripe-blog/coverage.svg?branch=master)](https://codecov.io/github/silverstripe/silverstripe-blog?branch=master) + +[![Latest Stable Version](https://poser.pugx.org/silverstripe/blog/version)](https://packagist.org/packages/silverstripe/blog) +[![Latest Unstable Version](https://poser.pugx.org/silverstripe/blog/v/unstable)](//packagist.org/packages/silverstripe/blog) +[![Total Downloads](https://poser.pugx.org/silverstripe/blog/downloads)](https://packagist.org/packages/silverstripe/blog) +[![License](https://poser.pugx.org/silverstripe/blog/license)](https://packagist.org/packages/silverstripe/blog) +[![Monthly Downloads](https://poser.pugx.org/silverstripe/blog/d/monthly)](https://packagist.org/packages/silverstripe/blog) +[![Daily Downloads](https://poser.pugx.org/silverstripe/blog/d/daily)](https://packagist.org/packages/silverstripe/blog) + +[![Dependency Status](https://www.versioneye.com/php/silverstripe:blog/badge.svg)](https://www.versioneye.com/php/silverstripe:blog) +[![Reference Status](https://www.versioneye.com/php/silverstripe:blog/reference_badge.svg?style=flat)](https://www.versioneye.com/php/silverstripe:blog/references) + +![codecov.io](https://codecov.io/github/silverstripe/silverstripe-blog/branch.svg?branch=master) -[![Build Status](https://travis-ci.org/silverstripe/silverstripe-blog.png?branch=master)](https://travis-ci.org/silverstripe/silverstripe-blog) [![Latest Stable Version](https://poser.pugx.org/silverstripe/blog/v/stable.svg)](https://packagist.org/packages/silverstripe/blog) [![Total Downloads](https://poser.pugx.org/silverstripe/blog/downloads.svg)](https://packagist.org/packages/silverstripe/blog) [![Latest Unstable Version](https://poser.pugx.org/silverstripe/blog/v/unstable.svg)](https://packagist.org/silverstripe/silverstripe/blog) [![License](https://poser.pugx.org/silverstripe/blog/license.svg)](https://packagist.org/packages/silverstripe/blog) ## Documentation [User guide](docs/en/userguide/index.md)