sterrenb / flutterhole

A third party Android application for the Pi-Hole® dashboard.
https://play.google.com/store/apps/details?id=sterrenburg.github.flutterhole
MIT License
400 stars 27 forks source link

Do you use Codemagic to create `coverage`? #87

Closed rrifafauzikomara closed 4 years ago

rrifafauzikomara commented 4 years ago

Hi @sterrenburg

I see in your README file have 2 badges (codemagic and coverage). And my question is are you create code coverage using Codemagic?

sterrenb commented 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?

rrifafauzikomara commented 4 years ago

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?

sterrenb commented 4 years ago

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)
rrifafauzikomara commented 4 years ago

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
sterrenb commented 4 years ago

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.

rrifafauzikomara commented 4 years ago

I see, thank you very much for your explanation!

NaagAlgates commented 3 years ago

Thank you for this question and answer. It works well.