Skip to content
percent

GitHub Action

WD lcov reporter

v0.2 Latest version

WD lcov reporter

percent

WD lcov reporter

Reports the coverage from lcov file to as MR comment or run output

Installation

Copy and paste the following snippet into your .yml file.

              

- name: WD lcov reporter

uses: Richter-Consulting/[email protected]

Learn more about this action in Richter-Consulting/wd-lcov-reporter

Choose a version

LCOV reporter for GitHub Actions

GitHub Super-Linter CI Check dist/ CodeQL Coverage

A simple action that parse the core data from LCOV file (line, function and block coverage). The out put variables provide basic data to use in PR comments or run output.

Example for configuration

permissions:
  pull-requests: write

jobs:
  coverage:
    - name: LCOV parser
      id: lcov-result
      uses: Richter-Consulting/[email protected]
      with:
        # Coverage file path
        lcov-file: './coverage/lcov.info'
        # Optional: Files to exclude from coverage report
        excluded-files: '**/*.g.dart, **/*.freezed.dart, **/.realm.dart'
        # Optional (default: 'true): Report coverage as step summary
        step-summary: 'true'
        # Optional (default: 'false): Reoprt coverage on PR
        # (with update of the comment)
        pr-comment: 'true'
        # Optional: GitHub token to write the PR comment
        # (also requires premission to do so)
        github-token: ${{ secrets.GITHUB_TOKEN }}
        # Template file for PR comment / step summary
        template-file: ./templates/pr_coverage.md

    - name: Coverage output
      run: |
        echo "${{ steps.lcov-result.outputs.coverage }}"
        echo "${{ steps.lcov-result.outputs.markdown-table }}"

Configuration parameters

lcov-file

Path to the lcov file to parse (currently only one file supported).

excluded-files

Comma separated list of files, that should be excluded from code coverade report. Common globes can be used here:

  • **: folder globe (e.g. **/email.dart would match foo/email.dart but also foo/bar/foo-bar/email.dart)
  • *: filename globe (e.g. **/email-*-validation.dart would match email-domain-validation.dart but not emailvalidation.dart)

step-summary

Publish the coverage table to step summary (optional - default: true)

pr-comment

Publish the coverage table as PR comment. On new push, the comment is updated (optional - default: false)

Example

Coverage Summary

Overall coverage: 22.83 %

Detailed coverage
File Line Coverage Function Coverage Branch Coverage
lib/email.dar 100.00% 0.00% 0.00%
lib/exceptions.dart 40.00% 0.00% 0.00%

github-token

GitHub token, required only to comment on PR. This is also required the write permission on PR (see configuration example). If PR comment is disabled, the token is not needed.

template-string

String to use as template for PR comment or step summary. The following placeholders will be replaced with values calculated in the action:

  • {{overall-coverage}}: The overal coverage as number (with 2 decimal digits), e.g. 78.76
  • {{coverage-table}}: Markdown table with coverages per file (see Markdown Table Result)

template-file

Text file to use as template for the PR comment or step summary. The following placeholders will be replaced with values calculated in the action:

  • {{overall-coverage}}: The overal coverage as number (with 2 decimal digits), e.g. 78.76
  • {{coverage-table}}: Markdown table with coverages per file (see Markdown Table Result)

Overall coverage result

22.83

Mardown Table result

File Line Coverage Function Coverage Branch Coverage
lib/email.dart 100.00% 0.00% 0.00%
lib/exceptions.dart 40.00% 0.00% 0.00%

TODO

  • Parse lcov file, so it is easier to handle the results
  • Provide following outputs
    • Markdown table with code coverage per test file
    • Overall coverage
  • Add possibility to "comment" on PR
  • Add possibility for run output
  • Add templates