diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..a4a70c4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: dart +sudo: false +dart: + - stable + - dev +script: ./tool/travis.sh +env: + - DARTANALYZER_FLAGS=--fatal-warnings diff --git a/README.md b/README.md index cdd9a15..a490a71 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,9 @@ which is in turn based on the paper [The Interval Skip List](https://www.cise.ufl.edu/tr/DOC/REP-1992-45.pdf) by Eric N. Hanson. +[![Build Status](https://travis-ci.org/kseo/interval_skip_list.svg)](https://travis-ci.org/kseo/interval_skip_list) +[![Coverage Status](https://coveralls.io/repos/kseo/interval_skip_list/badge.svg?branch=master&service=github)](https://coveralls.io/github/kseo/interval_skip_list?branch=master) + ## Basic Usage Example ```dart diff --git a/test/all_tests.dart b/test/all_tests.dart new file mode 100644 index 0000000..1794bf7 --- /dev/null +++ b/test/all_tests.dart @@ -0,0 +1,10 @@ +// Copyright (c) 2015, Kwang Yul Seo. All rights reserved. Use of this source code +// is governed by a BSD-style license that can be found in the LICENSE file. + +library interval_skip_list.test; + +import 'interval_skip_list_test.dart' as interval_skip_list_test; + +void main() { + interval_skip_list_test.main(); +} diff --git a/tool/travis.sh b/tool/travis.sh new file mode 100755 index 0000000..61c101b --- /dev/null +++ b/tool/travis.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details. +# All rights reserved. Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +# Fast fail the script on failures. +set -e + +# Verify that the libraries are error and warning-free. +echo "Running dartanalyzer..." +libs=$(find lib -maxdepth 1 -type f -name '*.dart') +dartanalyzer $DARTANALYZER_FLAGS $libs test/all_tests.dart + +# Run the tests. +echo "Running tests..." +pub run test:test + +# Gather and send coverage data. +if [ "$REPO_TOKEN" ] && [ "$TRAVIS_DART_VERSION" = "stable" ]; then + echo "Collecting coverage..." + pub global activate dart_coveralls + pub global run dart_coveralls report \ + --token $REPO_TOKEN \ + --retry 2 \ + --exclude-test-files \ + test/all_tests.dart +fi