Skip to content

Commit b313ce6

Browse files
authored
docs: included documentation about absolute path (#238)
* docs: updated README and FAQs * docs: added / * docs: included comprehensive line
1 parent cc418c5 commit b313ce6

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

README.md

+32-9
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ A GitHub Action which helps enforce a minimum code coverage threshold.
1616

1717
Very Good Coverage accepts the following configuration inputs:
1818

19-
| Input name | Description | Default value | Optional |
20-
| ------------ | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------ | -------- |
21-
| path | The path to the lcov.info file. | `"./coverage/lcov.info"` ||
22-
| min_coverage | The minimum coverage percentage allowed. | `100` ||
23-
| exclude | List of paths to exclude from the coverage report, separated by an empty space. Supports [globs]() to describe file patterns. | `""` ||
19+
| Input name | Description | Default value | Optional |
20+
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | -------- |
21+
| path | The absolute path to the lcov.info file. | `"/coverage/lcov.info"` ||
22+
| min_coverage | The minimum coverage percentage allowed. | `100` ||
23+
| exclude | List of paths to exclude from the coverage report, separated by an empty space. Supports [globs](<https://en.wikipedia.org/wiki/Glob_(programming)>) to describe file patterns. | `""` ||
2424

2525
## Example usage
2626

2727
```yaml
2828
uses: VeryGoodOpenSource/very_good_coverage@v2
2929
with:
30-
path: './coverage/lcov.info'
30+
path: '/coverage/lcov.info'
3131
min_coverage: 95
3232
exclude: '**/*_observer.dart **/change.dart'
3333
```
@@ -50,17 +50,40 @@ If your generated lcov file is empty this might be because you have no test file
5050
5151
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.
5252
53-
For example, if your non-existent or empty coverage file is meant to be located at `./coverage/lcov.info` you may do:
53+
For example, if your non-existent or empty coverage file is meant to be located at `/coverage/lcov.info` you may do:
5454

5555
```yaml
5656
- name: Check for existing and non-empty coverage file
5757
id: test_coverage_file
58-
run: if [ -s "./coverage/lcov.info" ]; then echo "result=true" >> $GITHUB_OUTPUT ; else echo "result=false" >> $GITHUB_OUTPUT; fi
58+
run: if [ -s "/coverage/lcov.info" ]; then echo "result=true" >> $GITHUB_OUTPUT ; else echo "result=false" >> $GITHUB_OUTPUT; fi
5959
- name: Very Good Coverage
6060
if: steps.test_coverage_file.outputs.result == 'true'
6161
uses: VeryGoodOpenSource/very_good_coverage@v2
6262
with:
63-
path: './coverage/lcov.info'
63+
path: '/coverage/lcov.info'
64+
```
65+
66+
#### Why is my input path not relative to the specified `working-directory`?
67+
68+
[Relevant issue](https://github.com/VeryGoodOpenSource/very_good_coverage/issues/35)
69+
70+
The input path must be absolute. The specified working directory is ignored by the input path. This is because it is [not possible](https://github.com/actions/runner/issues/467) to access the working directory from an action. In other words, Very Good Coverage always runs from the root of your repository.
71+
72+
For example, if your working directory is `my_project` and your file is at `/my_project/coverage/lcov.info` you must do:
73+
74+
```yaml
75+
jobs:
76+
build:
77+
defaults:
78+
run:
79+
working-directory: my_project/
80+
runs-on: ubuntu-latest
81+
steps:
82+
- uses: actions/checkout@v2
83+
- name: Very Good Coverage
84+
uses: VeryGoodOpenSource/very_good_coverage@v2
85+
with:
86+
path: /my_project/coverage/lcov.info
6487
```
6588

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

0 commit comments

Comments
 (0)