Skip to content

Commit

Permalink
change coverage to use temp directory;
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Jul 22, 2024
1 parent 938990b commit 1ead750
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 165 deletions.
39 changes: 18 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,28 @@ jobs:
## Inputs
| Name | Description | Required | Default |
| ------------------ | -------------------------------------------------------------------------- | -------- | ---------- |
| token | Token used for pushing fixes and commenting on PRs. | true | |
| run-tests | Whether tests should be run. | false | true |
| run-analysis | Whether static analysis should be run. | false | true |
| run-coverage | Whether code coverage should be run. | false | true |
| run-behind-by | Whether action should check if HEAD branch is behind base branch. | false | true |
| create-comment | Whether the action should comment the output status. | false | true |
| working-directory | Working directory to run the action in | false | "." |
| coverage-directory | Directory for test coverage reports to be saved. See [coverage](#coverage) | false | "coverage" |
//TODO: Remove coverage-directory and use some temp folder
| Name | Description | Required | Default |
| ----------------- | ----------------------------------------------------------------- | -------- | ------- |
| token | Token used for pushing fixes and commenting on PRs. | true | |
| run-tests | Whether tests should be run. | false | true |
| run-analysis | Whether static analysis should be run. | false | true |
| run-coverage | Whether code coverage should be run. | false | true |
| run-prev-coverage | Whether code coverage should be compared with the base branch. | false | true |
| run-behind-by | Whether action should check if HEAD branch is behind base branch. | false | true |
| create-comment | Whether the action should comment the output status. | false | true |
| working-directory | Working directory to run the action in | false | "." |
## Coverage
//TODO: Fix this by deleting the file
By default, running the test coverage will create a directory containing an `lcov.info` file. This defaults to `coverage/lcov.info`, but can be changed using the input `coverage-directory`. It is recommended that this directory is added to `.gitignore` to ensure the file is not committed by the action, potentially causing conflicts.
⚠️ To compare coverage against previous code, it is required that the code is checked out with `fetch-depth: 0`:

> ⚠️ To compare coverage against previous code, it is required that the code is checked out with `fetch-depth: 0`:
>
> ```yaml
> - uses: actions/checkout@v4
> with:
> fetch-depth: 0
> ```
```yaml
- uses: actions/checkout@v4
with:
fetch-depth: 0
```

> During the action, coverage will be calculated, and lcov.info will be saved in temporary directory `.coverage`. Please refrain from using a top level directory with this path, as this could cause issues.

## Contributing

Expand Down
11 changes: 6 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ inputs:
required: false
default: "."

coverage-directory:
description: "The test coverage directory"
required: false
default: "coverage"

run-tests:
description: "Run tests"
required: false
Expand All @@ -38,6 +33,12 @@ inputs:
default: true
type: boolean

run-prev-coverage:
description: "Run test coverage check on base branch"
required: false
default: true
type: boolean

run-behind-by:
description: "Run behind by check"
required: false
Expand Down
Loading

0 comments on commit 1ead750

Please sign in to comment.