Closed rrifafauzikomara closed 4 years ago
Hello @rrifafauzikomara 👋 - Thanks for opening an issue!
Codemagic cannot (as far as I know) publish coverage data for Flutter projects itself. I use Coveralls for this repository by pushing coverage data from the Coveralls server, using coveralls-lcov. Is that what you are looking for?
Hi @sterrenburg
So you just run this in Codemagic script:
#!/usr/bin/env sh
set -e
echo "repo_token: $COVERALLS_TOKEN" > .coveralls.yml
gem install coveralls-lcov
flutter test --coverage
coveralls-lcov coverage/lcov.info
And it will automatically generated a badge
for coverage
? Or have another set up?
And it will automatically generated a badge for coverage? Or have another set up?
This script triggers the Coveralls server to parse the coverage data that was generated from flutter test --coverage
. On the Coveralls dashboard, a markdown snippet can be found that you can copy to your README. The badge from this repository looks like this:
[![Coverage Status](https://coveralls.io/repos/github/sterrenburg/flutterhole/badge.svg?branch=master)](https://coveralls.io/github/sterrenburg/flutterhole?branch=master)
So to triggers, it just only with flutter test --coverage
and add it to my codemagic.yaml
like you or must add all script like below
? Because in your Codemagic
script your used all script below.
#!/usr/bin/env sh
set -e
echo "repo_token: $COVERALLS_TOKEN" > .coveralls.yml
gem install coveralls-lcov
flutter test --coverage
coveralls-lcov coverage/lcov.info
Sorry for the confusion, I meant that flutter test --coverage
is needed since Codemagic does not generate it during its own testing phase.
So, if you want to push the coverage to Coveralls, you need the entire script. I believe mine is ran in the post-test phase in Codemagic, but it should not matter. Doing it post-test means that only builds without failing testcases get pushed to Coveralls.
I see, thank you very much for your explanation!
Thank you for this question and answer. It works well.
Hi @sterrenburg
I see in your README file have 2 badges (
codemagic
andcoverage
). And my question is are you createcode coverage
usingCodemagic
?