Skip to content

Commit

Permalink
add travis support
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed May 5, 2015
1 parent a93a96b commit c28566a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: dart
sudo: false
dart:
- dev
- stable
script: ./tool/travis.sh
15 changes: 15 additions & 0 deletions tool/ensure_dartfmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

dart_files=$(git ls-tree --name-only --full-tree -r HEAD | grep '.dart$')
[ -z "$dart_files" ] && exit 0

unformatted=$(dartfmt -n $dart_files)
[ -z "$unformatted" ] && exit 0

# Some files are not dartfmt'd. Print message and fail.
echo >&2 "dart files must be formatted with dartfmt. Please run:"
for fn in $unformatted; do
echo >&2 " dartfmt -w $PWD/$fn"
done

exit 1
19 changes: 19 additions & 0 deletions tool/travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Fast fail the script on failures.
set -e

$(dirname -- "$0")/ensure_dartfmt.sh

# Run the tests.
dart --checked test/test_all.dart

# Install dart_coveralls; gather and send coverage data.
if [ "$COVERALLS_TOKEN" ] && [ "$TRAVIS_DART_VERSION" = "stable" ]; then
pub global activate dart_coveralls
pub global run dart_coveralls report \
--token $COVERALLS_TOKEN \
--retry 2 \
--exclude-test-files \
test/test_all.dart
fi

0 comments on commit c28566a

Please sign in to comment.