Files
codecov-action/README.md
T

60 lines
1.5 KiB
Markdown
Raw Normal View History

2019-08-06 21:14:41 -07:00
<!-- <p align="center"><img src="./codecov-logo.png" /></p> -->
2019-08-06 19:47:57 -07:00
2019-08-07 06:14:40 -07:00
# Codecov GitHub Action
2019-08-07 06:28:17 -07:00
### Easily upload coverage reports to Codecov from GitHub Actions
2019-07-30 18:21:05 -07:00
2019-08-06 19:29:18 -07:00
## Usage
Inside your `.github/workflows/workflow.yml` file:
```yaml
steps:
- uses: actions/checkout@master
2019-08-07 12:09:55 -07:00
- uses: actions/codecov-action@v0.3
2019-08-06 19:29:18 -07:00
with:
2019-08-07 12:09:55 -07:00
token: ${{secrets.CODECOV_TOKEN}} #for private repos
2019-08-07 12:01:44 -07:00
file: ./coverage.xml #optional
2019-08-06 19:29:18 -07:00
```
2019-08-07 12:01:44 -07:00
>**Note**: This assumes that you've set your Codecov token inside settings > secrets as `CODECOV_TOKEN`. If not, you can get an upload token for your specific repo on codecov.io. A token is *not* required for public repositories.
2019-08-06 19:29:18 -07:00
2019-08-07 07:59:10 -07:00
### Example `workflow.yml` with Codecov Action
```yaml
name: Example workflow for Codecov
on: [push]
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@master
with:
version: 3.7
- name: Generate coverage report
run: |
pip install pytest
pip install pytest-cov
pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v0.2
with:
token: ${{secrets.CODECOV_TOKEN}}
2019-08-07 12:01:44 -07:00
file: ./coverage.xml
2019-08-07 07:59:10 -07:00
```
2019-08-06 19:29:18 -07:00
## Arguments
| Argument | Description |
| :---: | :---: |
| `token` | Used to authorize coverage report uploads |
2019-08-07 12:01:44 -07:00
| `file` | Location of the coverage report |
2019-08-06 19:29:18 -07:00
## License
2019-08-07 06:40:15 -07:00
The code in this project is released under the [MIT License](LICENSE)