Skip to content

docs: update README.md inputs and FAQ #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 36 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,53 @@ A GitHub Action which helps enforce a minimum code coverage threshold.

## Inputs

### `path`
Very Good Coverage accepts the following configuration inputs:

**Optional** The path to the `lcov.info` file.
| Input name | Description | Default value | Optional |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------ | -------- |
| path | The path to the lcov.info file. | `"./coverage/lcov.info"` | ✅ |
| min_coverage | The minimum coverage percentage allowed. | `100` | ✅ |
| exclude | List of paths to exclude from the coverage report, separated by an empty space. Supports [globs]() to describe file patterns. | `""` | ✅ |

**Default** `./coverage/lcov.info`

### `min_coverage`
## Example usage

**Optional** The minimum coverage percentage allowed.
```yaml
uses: VeryGoodOpenSource/very_good_coverage@v2
with:
path: './coverage/lcov.info'
min_coverage: 95
exclude: '**/*_observer.dart **/change.dart'
```

**Default** 100
## FAQs

### `exclude`
#### How can I avoid Very Good Coverage reporting an empty or non-existent coverage file?

**Optional** List of paths to exclude from the coverage report, separated by an empty space. Supports `globs` to describe file patterns.
[Relevant issue](https://github.com/VeryGoodOpenSource/very_good_coverage/issues/167)

## Example usage
A failure for non-existent coverage file can be resolved by setting the path input to match the location of the already generated lcov file.

```yaml
uses: VeryGoodOpenSource/very_good_coverage@v2
with:
path: './coverage/lcov.info'
min_coverage: 95
exclude: '**/*_observer.dart **/change.dart'
path: 'my_project/coverage/lcov.info'
```

If your generated lcov file is empty this might be because you have no test files or your tests are not generating any coverage data.

If you wish to always bypass these warnings, we recommend using a conditional statement in your workflow to avoid running the Very Good Coverage action when the lcov file is empty or non-existent.

For example, if your non-existent or empty coverage file is meant to be located at `./coverage/lcov.info` you may do:

```yaml
- name: Check for existing and non-empty coverage file
id: test_coverage_file
run: if [ -s "./coverage/lcov.info" ]; then echo "result=true" >> $GITHUB_OUTPUT ; else echo "result=false" >> $GITHUB_OUTPUT; fi
- name: Very Good Coverage
if: steps.test_coverage_file.outputs.result == 'true'
uses: VeryGoodOpenSource/very_good_coverage@v2
with:
path: './coverage/lcov.info'
```

[ci_badge]: https://github.com/VeryGoodOpenSource/very_good_coverage/workflows/ci/badge.svg
Expand Down