Skip to content

Commit

Permalink
Merge pull request #6023 from sgiehl/master
Browse files Browse the repository at this point in the history
refs #4224, #4302 - added code coverage report using coveralls.io
  • Loading branch information
Stefan Giehl committed Aug 20, 2014
2 parents 6de375e + f7509a5 commit 4c7e446
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .coveralls.yml
@@ -0,0 +1,3 @@
service_name: travis-ci
src_dir: .
coverage_clover: build/logs/clover-*.xml
23 changes: 23 additions & 0 deletions .travis.yml
Expand Up @@ -31,9 +31,24 @@ env:
- secure: "CW73pDjcaabpSL7bWiWIQLydKmvLzA1gWNv/zK0VcAKezQtCAQbqpIY1+B56wOhkaCWa7P+xdd2gUWEtvvdRKEC0sZcgCdHD5pQx390e5PWCMQTFO+doAElI4w4DMATCbH890Wcw2rotiZcjlkPYY+urIpUlcRsl6mMtBVQuQ9c="

matrix:
fast_finish: true
allow_failures:
- php: hhvm
- php: 5.6
- php: 5.4
env: MYSQL_ADAPTER=PDO_MYSQL COVERAGE=Core
- php: 5.4
env: MYSQL_ADAPTER=PDO_MYSQL COVERAGE=Plugins
- php: 5.4
env: MYSQL_ADAPTER=PDO_MYSQL COVERAGE=Integration
include:
# Code Coverage
- php: 5.4
env: MYSQL_ADAPTER=PDO_MYSQL COVERAGE=Core
- php: 5.4
env: MYSQL_ADAPTER=PDO_MYSQL COVERAGE=Plugins
- php: 5.4
env: MYSQL_ADAPTER=PDO_MYSQL COVERAGE=Integration
exclude:
# Javascript tests need to run only on one PHP version
- php: 5.4
Expand Down Expand Up @@ -91,6 +106,10 @@ install:
- git checkout master -- ./tests/travis ./plugins/CoreConsole || true

before_script:
- if [ -z "$TEST_SUITE" ];
then composer require satooshi/php-coveralls dev-master;
fi

- ./tests/travis/configure_git.sh

# print out mysql information
Expand Down Expand Up @@ -139,6 +158,10 @@ after_script:
# change directory back to root travis dir
- cd $PIWIK_ROOT_DIR

- if [ -z "$TEST_SUITE" ];
then php vendor/bin/coveralls -v;
fi

# output contents of files w/ debugging info to screen
- cat /var/log/nginx/error.log
- cat $PIWIK_ROOT_DIR/tmp/php-fpm.log
Expand Down
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -101,3 +101,5 @@ The Piwik project uses an ever-expanding comprehensive set of thousands of unit

Build status (master branch) [![Build Status](https://travis-ci.org/piwik/piwik.png?branch=master)](https://travis-ci.org/piwik/piwik) - Screenshot tests Build [![Build Status](https://travis-ci.org/piwik/piwik-ui-tests.png?branch=master)](https://travis-ci.org/piwik/piwik-ui-tests)

Code Coverage: [![Coverage Status](https://coveralls.io/repos/piwik/piwik/badge.png?branch=master)](https://coveralls.io/r/piwik/piwik?branch=master)

8 changes: 8 additions & 0 deletions plugins/CoreConsole/templates/travis.yml.twig
Expand Up @@ -96,6 +96,10 @@ install:
{% endif %}

before_script:
- if [ -z "$TEST_SUITE" ];
then composer require satooshi/php-coveralls dev-master;
fi

- ./tests/travis/configure_git.sh

# print out mysql information
Expand Down Expand Up @@ -147,6 +151,10 @@ after_script:
# change directory back to root travis dir
- cd $PIWIK_ROOT_DIR

- if [ -z "$TEST_SUITE" ];
then php vendor/bin/coveralls -v;
fi

# output contents of files w/ debugging info to screen
- cat /var/log/nginx/error.log
- cat $PIWIK_ROOT_DIR/tmp/php-fpm.log
Expand Down
14 changes: 14 additions & 0 deletions tests/PHPUnit/phpunit.xml.dist
Expand Up @@ -47,4 +47,18 @@
</testsuite>
</testsuites>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">../../core</directory>
<directory suffix=".php">../../plugins</directory>
<exclude>
<directory suffix=".php">../../core/Updates</directory>
<directory suffix=".php">../../plugins/Example*</directory>
<directory suffix=".php">../../plugins/*/Updates</directory>
<directory suffix=".php">../../plugins/*/libs</directory>
<directory suffix=".php">../../plugins/*/tests</directory>
</exclude>
</whitelist>
</filter>

</phpunit>
14 changes: 13 additions & 1 deletion tests/travis/travis.sh
Expand Up @@ -64,5 +64,17 @@ then
fi
fi
else
travis_wait phpunit --configuration phpunit.xml --coverage-text --colors
if [ "$COVERAGE" = "Integration" ]
then
echo "Executing non Integration tests in test suite IntegrationTests..."
phpunit --configuration phpunit.xml --testsuite IntegrationTests --exclude-group Integration --colors --coverage-clover $TRAVIS_BUILD_DIR/build/logs/clover-integration.xml || true
elif [ "$COVERAGE" = "Core" ]
then
echo "Executing tests in test suite CoreTests..."
phpunit --configuration phpunit.xml --testsuite CoreTests --colors --coverage-clover $TRAVIS_BUILD_DIR/build/logs/clover-core.xml || true
elif [ "$COVERAGE" = "Plugins" ]
then
echo "Executing tests in test suite PluginTests..."
phpunit --configuration phpunit.xml --testsuite PluginTests --colors --coverage-clover $TRAVIS_BUILD_DIR/build/logs/clover-plugins.xml || true
fi;
fi

0 comments on commit 4c7e446

Please sign in to comment.