Skip to content

Commit

Permalink
Switch to travis-ci and codecov.io
Browse files Browse the repository at this point in the history
  • Loading branch information
achilleasa committed Aug 19, 2017
1 parent ad2f25e commit d2c5f64
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 34 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: dart
dart:
- stable
services:
- rabbitmq
script:
- export PATH="$PATH":"~/.pub-cache/bin"
- pub get --packages-dir
- pub global activate coverage
- cd test
- bash run.sh
- bash test_coverage.sh
- bash <(curl -s https://codecov.io/bash) -X gcov -f '*.lcov'
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# dart_ampq

[![Build Status](https://drone.io/github.com/achilleasa/dart_amqp/status.png)](https://drone.io/github.com/achilleasa/dart_amqp/latest)
[![Coverage Status](https://coveralls.io/repos/achilleasa/dart_amqp/badge.svg)](https://coveralls.io/r/achilleasa/dart_amqp)
[![Build Status](https://travis-ci.org/achilleasa/dart_amqp.svg?branch=master)](https://travis-ci.org/achilleasa/dart_amqp)
[![codecov](https://codecov.io/gh/achilleasa/dart_amqp/branch/master/graph/badge.svg)](https://codecov.io/gh/achilleasa/dart_amqp)

Dart AMQP client implementing protocol version 0.9.1

Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ dev_dependencies:
mock: ">=0.11.0+2 <0.12.0"
http: ">=0.11.1+1 <0.12.0"
xml: ">=2.2.3 <3.0.0"
coverage: "^0.7.0"
dart_codecov_generator: "^0.4.0"
45 changes: 13 additions & 32 deletions test/test_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,14 @@

# Build test coverage reports. To use this script you need to:
# 1) Install lcov package
# 2) Clone dart-lang/coverage repo from GH (https://github.com/dart-lang/coverage)
# 3) Run pub update inside the cloned repo
#
# Then invoke this script passing the path to the coverage tools folder
#

COVERAGE_TOOLS=""

for i in "$@"
do
case ${i} in
-c=*|--coverage-tools=*)
COVERAGE_TOOLS="${i#*=}"
shift
;;
*)
# unknown option
;;
esac
done

if [ "$COVERAGE_TOOLS" == "" ]; then
echo "Please enter path to covert coverage tools folder with the -c or --coverage-tools option"
exit 1
fi
# 2) pub global activate coverage
# 3) Add .pub-cache/bin folder to your path

# Cleanup the backgrounded unit test runner on exit if something goes wrong
trap 'kill $(jobs -p)' EXIT


# Cleanup
mkdir -p coverage
rm -f coverage/coverage.json
rm -f coverage/coverage.lcov
rm -f coverage/filtered.lcov
Expand All @@ -42,21 +19,25 @@ dart --checked --enable-vm-service --package-root=../packages/ --pause-isolates-

# Run coverage collection tool
echo "Waiting for unit tests to run..."
dart --package-root=${COVERAGE_TOOLS}/packages ${COVERAGE_TOOLS}/bin/collect_coverage.dart --port=8181 -o coverage/coverage.json --wait-paused # --resume-isolates
collect_coverage --port=8181 -o coverage/coverage.json --wait-paused # --resume-isolates
echo "Collected coverage data..."

# Convert data to LCOV format
echo "Converting to LCOV format..."
dart --package-root=${COVERAGE_TOOLS}/packages ${COVERAGE_TOOLS}/bin/format_coverage.dart --package-root=../ -i coverage/coverage.json -l > coverage/coverage.lcov
format_coverage --package-root=../ -i coverage/coverage.json -l > coverage/coverage.lcov

# Remove LCOV blocks that do not belong to our project lib/ folder
echo "Filtering unrelated files from the LCOV data..."
PROJECT_ROOT=`pwd | sed -e "s/\\/[^\\/]*$//"`
sed -n '\:^SF.*'"$PROJECT_ROOT"'/lib:,\:end_of_record:p' coverage/coverage.lcov > coverage/filtered.lcov

# Format LCOV data to HTML
echo "Rendering HTML coverage report to: coverage/html"
genhtml coverage/filtered.lcov --output-directory coverage/html --ignore-errors source --quiet
if [ -n "genhtml" ]; then
echo "Rendering HTML coverage report to: coverage/html"
genhtml coverage/filtered.lcov --output-directory coverage/html --ignore-errors source --quiet
echo "The generated coverage data is available here: "`pwd`"/coverage/html/index.html"
fi

rm -f coverage/filtered.lcov

echo "The generated coverage data is available here: "`pwd`"/coverage/html/index.html"
echo
echo

0 comments on commit d2c5f64

Please sign in to comment.