Code Coverage with Github Actions

Posted on December 13, 2019

Today I decided I want to increase my experience with testing, and the first step for me was integrating CodeCov so I can get a better overview of what's covered and what's not.

I got up and running on CodeCov by setting up Github Actions to submit the report. Luckily, codecov already has deployed a Github Action here.

To create our code coverage, we need to first grab our CodeCoverage Token. You'll need to add that into Secret's in your repository Setting's panel.

Afterwards, we create a new workflow called .github/workflows/codecov.yaml, that looks like this:

1name: Code Coverage
2on: [push]
5 build:
6 name: Run Code Coverage
7 runs-on: ubuntu-latest
8 steps:
9 - uses: actions/checkout@master
10 - uses: codecov/codecov-action@v1
11 with:
12 token: ${{ secrets.CODECOV_TOKEN }}

That's it! Now every time someone pushes on your repository Code Cov will upload a new report