Skip to content

Commit a7811a4

Browse files
author
Vitalii Melnychuk
committed
feat: add `barecheck-api-key parameter usage
1 parent 4b1aa94 commit a7811a4

1 file changed

Lines changed: 38 additions & 20 deletions

File tree

README.md

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,29 @@ GitHub Action that generates coverage reports
88

99
1. Install [Barecheck Application](https://github.com/apps/barecheck)
1010
2. Copy the token provided on the authorization confirmation page and [add it to your build environment](https://docs.github.com/en/actions/reference/environment-variables) as BARECHECK_GITHUB_APP_TOKEN
11-
3. Create Github Actions worrkflow from the [example](https://github.com/barecheck/code-coverage-action#workflow-example)
11+
3. Create Github Actions workflow from the [example](https://github.com/barecheck/code-coverage-action#workflow-example)
1212

1313
## Features
1414

1515
### Show annotations
1616

17-
As a part of code coverage report action also enable an ability to show annotations along with changed lines to keep control what is covered with tests without interapting review process
17+
As a part of code coverage report action also enable an ability to show annotations along with changed lines to keep control of what is covered with tests without interacting review process
1818

1919
![show annotations](./docs/img/show-annotations.png)
2020

2121
### Show uncovered files
2222

23-
In the rea; world, it's hard to get 100% code coverage and keep it all the time. Instead of showing you all uncovered files Barecheck show only the ones you have changed.
23+
In the real; world, it's hard to get 100% code coverage and keep it all the time. Instead of showing you all uncovered files Barecheck show only the ones you have changed.
2424
![code coverage report](./docs/img/barecheck-comment-fail.png)
2525

2626
## Usage
2727

28-
To integrate with this Github Action, you can just use following configuration in your already created workflow. As a result you will get Github Pull request comment with total code coverage
28+
To integrate with this Github Action, you can just use the following configuration in your already created workflow. As a result, you will get Github Pull request comment with total code coverage
2929

3030
```yml
3131
- name: Generate Code Coverage report
3232
id: code-coverage
33-
uses: barecheck/code-coverage-action@v0.6.1
33+
uses: barecheck/code-coverage-action@v1
3434
with:
3535
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
3636
lcov-file: "./coverage/lcov.info"
@@ -43,20 +43,21 @@ To integrate with this Github Action, you can just use following configuration i
4343
4444
## Inputs
4545
46-
| Key | Required | Default | Description |
47-
| ---------------------------- | -------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
48-
| `github-token` | **yes** | - | Default Github Actions token. Token is not requered if Github application is installed and token passed through `barecheck-github-app-token` |
49-
| `lcov-file` | **yes** | - | Lcov.info file that was generated after your test coverage command |
50-
| `barecheck-github-app-token` | **no** | - | Barecheck application token, received after application installation comment. |
51-
| `base-lcov-file` | **no** | - | Lcov.info file that would be used to compare code coverage. The comparision will be disabled if the file is not passed |
52-
| `send-summary-comment` | **no** | true | Option to send Github code coverage comment based on the changes that were made in PR |
53-
| `show-annotations` | **no** | 'warning' | Option to enable Github anotation that would show uncovered files in review tab. Options: ' ' \| warning \| error |
54-
| `minimum-ratio` | **no** | '' | Percantage of uncovered lines that is allowed for new changes |
55-
| `app-name` | **no** | 'Barecheck' | Application name would be used once you have more than one report in your workflow and want to have different reports per application. |
46+
| Key | Required | Default | Description |
47+
| ---------------------------- | -------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
48+
| `github-token` | **yes** | - | Default Github Actions token. The token is not required if GitHub application is installed and the token passed through `barecheck-github-app-token` |
49+
| `lcov-file` | **yes** | - | Lcov.info file that was generated after your test coverage command |
50+
| `barecheck-github-app-token` | **no** | - | Barecheck application token, received after application installation comment. |
51+
| `barecheck-api-key` | **no** | - | Your project API_KEY generated from https://barecheck.com. Use this property to avoid running coverage for the base branch. |
52+
| `base-lcov-file` | **no** | - | Lcov.info file that would be used to compare code coverage. The comparison will be disabled if the file is not passed |
53+
| `send-summary-comment` | **no** | true | Option to send Github code coverage comment based on the changes that were made in PR |
54+
| `show-annotations` | **no** | 'warning' | Option to enable Github annotation that would show uncovered files in review tab. Options: ' ' \| warning \| error |
55+
| `minimum-ratio` | **no** | '' | Percentage of uncovered lines that are allowed for new changes |
56+
| `app-name` | **no** | 'Barecheck' | Application name would be used once you have more than one report in your workflow and want to have different reports per application. |
5657

5758
## Workflow Example
5859

59-
In order to compare your new changes report and base branch you are able to use Github artifacts as in the example below:
60+
In order to compare your new changes report and the base branch you are able to use Github artifacts as in the example below:
6061

6162
```yml
6263
name: Code Coverage
@@ -111,7 +112,7 @@ jobs:
111112
# Compares two code coverage files and generates report as a comment
112113
- name: Generate Code Coverage report
113114
id: code-coverage
114-
uses: barecheck/code-coverage-action@v0.6.1
115+
uses: barecheck/code-coverage-action@v1
115116
with:
116117
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
117118
lcov-file: "./coverage/lcov.info"
@@ -125,12 +126,12 @@ jobs:
125126

126127
### Monorepo support
127128

128-
If you have monorepo with more then one application and want to have different code coverage reports you can use `app-name` input property to define different application names that would be used as a part of title.
129+
If you have monorepo with more than one application and want to have different code coverage reports you can use `app-name` input property to define different application names that would be used as a part of the title.
129130

130131
```yml
131132
- name: Application1 - Generate Code Coverage report
132133
id: code-coverage
133-
uses: barecheck/code-coverage-action@v0.6.1
134+
uses: barecheck/code-coverage-action@v1
134135
with:
135136
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
136137
lcov-file: "./coverage/lcov.info"
@@ -141,14 +142,31 @@ If you have monorepo with more then one application and want to have different c
141142
```yml
142143
- name: Application2 - Generate Code Coverage report
143144
id: code-coverage
144-
uses: barecheck/code-coverage-action@v0.6.1
145+
uses: barecheck/code-coverage-action@v1
145146
with:
146147
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
147148
lcov-file: "./coverage/lcov.info"
148149
base-lcov-file: "./coverage/base-lcov.info"
149150
app-name: "Application 2"
150151
```
151152

153+
### Using Barecheck Cloud
154+
155+
Barecheck cloud is still in beta but there are already some numbers of teams that are using it. Especially, for complex projects where running coverage for the main branch twice just to compare results might lead to performance problems.
156+
Action will not send any data besides just the coverage number and commit sha to the cloud so you can securely use this feature.
157+
158+
```yml
159+
- name: Generate Code Coverage report
160+
id: code-coverage
161+
uses: barecheck/code-coverage-action@v1
162+
with:
163+
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
164+
barecheck-api-key: ${{ secrets.BARECHECK_API_KEY }}
165+
lcov-file: "./coverage/lcov.info"
166+
```
167+
168+
`barecheck-api-key` has a bigger priority than `base-lcov-file` . Once you passed of them, only API KEY will be used. All other parameters can be used in the same way.
169+
152170
## Contributing
153171

154172
- Clone this repository

0 commit comments

Comments
 (0)