chart-simpleCoverage

Upload Flutter test coverage to Codecov and show a badge in README

When I build a Flutter project, I like to set up coverage early. It helps me track test quality on every push and pull request.

How to create a test badge like this?

Codecov badge

This badge is very useful because we can quickly see the test coverage status in the repository.

Step 1: Login to Codecov

Go to: https://codecov.ioarrow-up-right Login with your GitHub account.

Step 2: Generate lcov.info in local

Run:

After that, you will have:

Step 3: Create GitHub Actions workflow

Create file:

Add this content:

Important: Public vs Private Repository

This workflow usually works directly for public repositories.

For private repositories, add CODECOV_TOKEN in GitHub Secrets, then update the Codecov step:

Step 4: Commit and push

Run:

Step 5: Check CI/CD status

Go to your GitHub repository -> Actions tab. Workflow Coverage should be green.

Step 6: View result on Codecov

Open:

https://app.codecov.io/gh/ngmduc2012/my_langarrow-up-right

Step 7: Add coverage badge to README

Add this code:

Note

If upload fails, check repository visibility and token setup first.

Conclusion

This is my simple way to set up Flutter coverage with Codecov. It is easy to maintain and very helpful when reviewing pull requests.

Buy Me a Coffeearrow-up-right | Support Me on Ko-fiarrow-up-right

Last updated