Skip to content

Instantly share code, notes, and snippets.

@pulyaevskiy
Created April 10, 2016 17:30
Show Gist options
  • Save pulyaevskiy/b957c6855c2864fdbcc13a12201852be to your computer and use it in GitHub Desktop.
Save pulyaevskiy/b957c6855c2864fdbcc13a12201852be to your computer and use it in GitHub Desktop.
Generate code coverage in TravisCI build and send it to Codecov
# Workaround which:
# * Starts observatory in background
# * Runs the test suite
# * Collects coverage and sends it to Codecov
#
# Someday the `test` package will support observatory and below steps
# could be simplified.
#
# Prerequisites:
# * Have Travis CI build for your repo
# * Have `test/all.dart` which executes all-the-tests
# * Have Codecov account with your repo enabled in it.
#
# It is an example for running VM tests only.
sudo: false
language: dart
script:
- pub run test
- pub global activate coverage
- dart --observe=8111 test/all.dart &
- sleep 1 # make sure this is longer then time needed to run the whole test suite
- pub global run coverage:collect_coverage --port=8111 -o coverage.json --resume-isolates
- pub global run coverage:format_coverage --package-root=packages --report-on lib --in coverage.json --out lcov.info --lcov
after_success:
- bash <(curl -s https://codecov.io/bash)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment