Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Commit

Permalink
Trial support for coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed May 1, 2014
1 parent 2ad10ee commit 13db3de
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
service_name: travis-ci
src_dir: .
coverage_clover: build/logs/clover.xml
json_path: build/logs/coveralls-upload.json
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ before_script:

script:
- find . -path ./bin -prune -o \( -name '*.php' -o -name '*.inc' \) -exec php -lf {} \;
- if [ -e phpunit.xml ] || [ -e phpunit.xml.dist ]; then phpunit; fi
- if [ -e phpunit.xml ] || [ -e phpunit.xml.dist ]; then phpunit $( if [ -e .coveralls.yml ]; then echo --coverage-clover build/logs/clover.xml; fi ); fi
- $PHPCS_DIR/scripts/phpcs --standard=$WPCS_STANDARD $(if [ -n "$PHPCS_IGNORE" ]; then echo --ignore=$PHPCS_IGNORE; fi) $(find . -name '*.php')
- jshint .

after_script:
- if [ -e .coveralls.yml ]; then php vendor/bin/coveralls; fi
3 changes: 3 additions & 0 deletions class-wordpress-readme-parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ function to_markdown( $params = array() ) {
if ( isset( $params['travis_ci_url'] ) ) {
$body .= sprintf( "\n\n[![Build Status](%s.png?branch=master)](%s)", $params['travis_ci_url'], $params['travis_ci_url'] );
}
if ( isset( $params['coveralls_url'] ) ) {
$body .= sprintf( "\n\n[![Build Status](%s)](%s)", $params['coveralls_badge_src'], $params['coveralls_url'] );
}
return $body;
},
'Screenshots' => function ( $body ) {
Expand Down
8 changes: 7 additions & 1 deletion generate-markdown-readme
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ try {
$readme = new WordPress_Readme_Parser( array( 'path' => $readme_txt_path ) );

$md_args = array();
$github_url_regex = '#.+github\.com[:/]([^/]+/[^/]+)\.git$#';
$origin_url = trim( `git config --get remote.origin.url` );
if ( file_exists( $readme_root . '/.travis.yml' ) ) {
$md_args['travis_ci_url'] = preg_replace( '#.+github\.com[:/]([^/]+/[^/]+)\.git$#', 'https://travis-ci.org/$1', trim( `git config --get remote.origin.url` ) );
$md_args['travis_ci_url'] = preg_replace( $github_url_regex, 'https://travis-ci.org/$1', $origin_url );
}
if ( file_exists( $readme_root . '/.coveralls.yml' ) ) {
$md_args['coveralls_badge_src'] = preg_replace( $github_url_regex, 'https://coveralls.io/repos/$1/badge.png', $origin_url );
$md_args['coveralls_url'] = preg_replace( $github_url_regex, 'https://coveralls.io/r/$1', $origin_url );
}
$markdown = $readme->to_markdown( $md_args );

Expand Down

0 comments on commit 13db3de

Please sign in to comment.