| #!/bin/bash |
| |
| # Make sure dartfmt is run on everything |
| echo "Checking dartfmt..." |
| NEEDS_DARTFMT="$(dartfmt -n lib test tool)" |
| if [[ ${NEEDS_DARTFMT} != "" ]] |
| then |
| echo "FAILED" |
| echo "${NEEDS_DARTFMT}" |
| exit 1 |
| fi |
| echo "PASSED" |
| |
| # Make sure we pass the analyzer |
| echo "Checking dartanalyzer..." |
| FAILS_ANALYZER="$(find lib test tool -name "*.dart" | xargs dartanalyzer --options .analysis_options)" |
| if [[ $FAILS_ANALYZER == *"[error]"* ]] |
| then |
| echo "FAILED" |
| echo "${FAILS_ANALYZER}" |
| exit 1 |
| fi |
| echo "PASSED" |
| |
| # Fast fail the script on failures. |
| set -e |
| |
| # Run the tests. |
| pub run test |
| |
| # 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 \ |
| --retry 2 \ |
| --exclude-test-files \ |
| tool/test_all_for_coverage.dart |
| fi |