From d2c5f64bc52efba655dbbda5fc2498b873a47148 Mon Sep 17 00:00:00 2001 From: Achilleas Anagnostopoulos Date: Thu, 10 Aug 2017 07:52:46 +0100 Subject: [PATCH] Switch to travis-ci and codecov.io --- .travis.yml | 13 +++++++++++++ README.md | 4 ++-- pubspec.yaml | 2 ++ test/test_coverage.sh | 45 +++++++++++++------------------------------ 4 files changed, 30 insertions(+), 34 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c2fa5c1 --- /dev/null +++ b/.travis.yml @@ -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' diff --git a/README.md b/README.md index 58da1fd..f4ae3f9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/pubspec.yaml b/pubspec.yaml index 22c1739..9d72821 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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" diff --git a/test/test_coverage.sh b/test/test_coverage.sh index 761d85e..6b56c53 100644 --- a/test/test_coverage.sh +++ b/test/test_coverage.sh @@ -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 @@ -42,12 +19,12 @@ 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..." @@ -55,8 +32,12 @@ 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 \ No newline at end of file +echo