Coverage Setup

Automatically tracking your test coverage is super easy with Diligence Quality Tools.

You need to go through two simple steps that'll take you about 5 minutes tops!

  1. (optional) Enable coverage monitoring on the Quality Tools website

  2. Automatically upload your coverage from your GitHub actions

Configuration

Open your repository configuration and make sure "automated github checks" is enabled, also put in a target coverage percentage.

Once you've done those two things we'll start automatically checking if new commits and PRs are up to your standards!

Uploading Coverage

Diligence Quality Tools works well with most development tools by using the common LCOV standard, in this page we'll explain how to get set up using foundry.

If you haven't done so yet set up a GitHub action to automatically run your foundry unit tests. This is a must-have CI integration! Once you've got that set up you simply add the following two steps to your workflow (run coverage measurement & upload artifact):

      - name: Coverage
        run: |
          forge coverage --report lcov
        id: coverage 

      - name: upload coverage
        uses: actions/[email protected]
        with: 
          name: lcov.info
          path: lcov.info
      

Artifacts

You can easily adapt this approach to any other tool. Just make sure to upload the lcov.info artifact!

Last updated