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.
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 }}"
Path to the lcov file to parse (currently only one file supported).
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 matchfoo/email.dart
but alsofoo/bar/foo-bar/email.dart
)*
: filename globe (e.g.**/email-*-validation.dart
would matchemail-domain-validation.dart
but notemailvalidation.dart
)
Publish the coverage table to step summary (optional - default: true
)
Publish the coverage table as PR comment. On new push, the comment is updated
(optional - default: false
)
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, 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.
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)
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)
22.83
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% |
- 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