Compare commits
63 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e3f7b8baf8 | |||
| 4af6f0743e | |||
| 5c880506b5 | |||
| a3a7edcc61 | |||
| f93f6bdcae | |||
| 35b9267ca9 | |||
| 39a99a4e84 | |||
| e0cc6d49d9 | |||
| 96d1c9a15d | |||
| ee0d391ad0 | |||
| bd3230c275 | |||
| c7a04fdde5 | |||
| efe83d2996 | |||
| db5a766c55 | |||
| 1f99174e83 | |||
| 93d126a749 | |||
| 4546e138ba | |||
| 125cedf806 | |||
| 6f489c7a78 | |||
| fc175be7b5 | |||
| a166a95c4a | |||
| dd94ace224 | |||
| a8f7ad31ff | |||
| ed370e2ded | |||
| dd098b2f6b | |||
| d2c4464978 | |||
| 97fe500537 | |||
| 111c74ca11 | |||
| edbb6f8e5d | |||
| 7d121a89c0 | |||
| 159fdf6e54 | |||
| 4fb042f123 | |||
| 0766dd1553 | |||
| e0683efc0b | |||
| 1b38d5e8b4 | |||
| 2793f27b99 | |||
| afda60d339 | |||
| f21e0e6d14 | |||
| 55d06088fa | |||
| 7461079497 | |||
| eda3e0f75c | |||
| c7f04ba6f0 | |||
| 67896f6476 | |||
| 1e6057f6d0 | |||
| 25df614d11 | |||
| 3ee0aad0bf | |||
| 93ee40a7a2 | |||
| d1914c14b8 | |||
| c2703ce7b6 | |||
| 47224ae4e6 | |||
| 413e76629d | |||
| 6625b1305d | |||
| 77578a4d61 | |||
| 2ce8445bdf | |||
| 22e73b5938 | |||
| f338553518 | |||
| 2ca1146dfd | |||
| e49c256d4a | |||
| baf6a7af4f | |||
| d2db6055ff | |||
| 9aebf8f59e | |||
| e74d307e33 | |||
| 55c9c61f7e |
@@ -1,3 +1,5 @@
|
||||
# Codecov @codecov
|
||||
|
||||
FROM alpine:3.10
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -1,22 +1,34 @@
|
||||
<!-- <p align="center"><img src="./codecov-logo.png" /></p> -->
|
||||
|
||||
# Codecov GitHub Action
|
||||
### Easily upload coverage reports to Codecov from GitHub Actions
|
||||
|
||||
## Usage
|
||||
|
||||
To integrate Codecov with your Actions pipeline, specify the name of this repository with a tag number as a `step` within your `workflow.yml` file. This Action also requires you to [provide an upload token](https://docs.codecov.io/docs/frequently-asked-questions#section-where-is-the-repository-upload-token-found-) from [codecov.io](https://www.codecov.io) (tip: in order to avoid exposing your token, store it as a `secret`). Optionally, you can choose to include three additional inputs to customize the upload context.
|
||||
|
||||
Inside your `.github/workflows/workflow.yml` file:
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/codecov-action@v0.3
|
||||
- uses: actions/codecov-action@v1.0.0
|
||||
with:
|
||||
token: ${{secrets.CODECOV_TOKEN}} #for private repos
|
||||
token: ${{secrets.CODECOV_TOKEN}} #required
|
||||
file: ./coverage.xml #optional
|
||||
flags: unittests #optional
|
||||
name: codecov-umbrella #optional
|
||||
```
|
||||
>**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.
|
||||
>**Note**: This assumes that you've set your Codecov token inside *Settings > Secrets* as `CODECOV_TOKEN`. If not, you can [get an upload token](https://docs.codecov.io/docs/frequently-asked-questions#section-where-is-the-repository-upload-token-found-) for your specific repo on [codecov.io](https://www.codecov.io).
|
||||
|
||||
## Arguments
|
||||
|
||||
Codecov's Action currently supports four inputs from the user: `token`, `file`, `flags`, and `name`. These inputs, along with their descriptions and usage contexts, are listed in the table below:
|
||||
|
||||
| Input | Description | Usage |
|
||||
| :---: | :---: | :---: |
|
||||
| `token` | Used to authorize coverage report uploads | *Required* |
|
||||
| `file` | Location of the coverage report | Optional
|
||||
| `flags` | Flag upload under a certain group | Optional
|
||||
| `name` | Custom defined name for the upload | Optional
|
||||
|
||||
### Example `workflow.yml` with Codecov Action
|
||||
|
||||
@@ -28,35 +40,27 @@ jobs:
|
||||
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
|
||||
uses: codecov/codecov-action@v1.0.0
|
||||
with:
|
||||
token: ${{secrets.CODECOV_TOKEN}}
|
||||
file: ./coverage.xml
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
```
|
||||
## Contributing
|
||||
|
||||
## Arguments
|
||||
|
||||
| Input | Description |
|
||||
| :---: | :---: |
|
||||
| `token` | Used to authorize coverage report uploads |
|
||||
| `file` | Location of the coverage report |
|
||||
| `flags` | Flag upload to group coverage metrics |
|
||||
|
||||
Contributions are welcome! Check out the [Contribution Guide](CONTRIBUTING.md).
|
||||
|
||||
## License
|
||||
|
||||
The code in this project is released under the [MIT License](LICENSE)
|
||||
The code in this project is released under the [MIT License](LICENSE).
|
||||
|
||||
+9
-4
@@ -1,9 +1,12 @@
|
||||
name: 'Codecov'
|
||||
description: 'GitHub action that uploads coverage reports for your repository to codecov.io'
|
||||
author: 'Ibrahim Ali @ Codecov'
|
||||
description: 'GitHub Action that uploads coverage reports for your repository to codecov.io'
|
||||
author: 'Ibrahim Ali <@ibrahim0814> | Codecov'
|
||||
inputs:
|
||||
name:
|
||||
description: 'User defined upload name. Visible in Codecov UI'
|
||||
required: false
|
||||
token:
|
||||
description: 'Set the repository token'
|
||||
description: 'Repository upload token - get it from codecov.io'
|
||||
required: false
|
||||
file:
|
||||
description: 'Path to coverage file to upload'
|
||||
@@ -18,6 +21,8 @@ runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
args:
|
||||
- ${{ inputs.name }}
|
||||
- ${{ inputs.token }}
|
||||
- ${{ inputs.file }}
|
||||
- ${{ inputs.flags }}
|
||||
- ${{ inputs.flags }}
|
||||
|
||||
+16
-10
@@ -1,32 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Codecov @codecov
|
||||
|
||||
set -eu
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
echo "Please provide an upload token from codecov.io"
|
||||
exit 1
|
||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FILE" != "x" ] && [ "x$INPUT_FLAGS" != "x" ] && [ "x$INPUT_NAME" != "x" ]
|
||||
then
|
||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -f $INPUT_FILE -F $INPUT_FLAGS -n $INPUT_NAME
|
||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FILE" != "x" ] && [ "x$INPUT_FLAGS" != "x" ]
|
||||
then
|
||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -f $INPUT_FILE -F $INPUT_FLAGS
|
||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FILE" != "x" ] && [ "x$INPUT_NAME" != "x" ]
|
||||
then
|
||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -f $INPUT_FILE -n $INPUT_NAME
|
||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_NAME" != "x" ] && [ "x$INPUT_FLAGS" != "x" ]
|
||||
then
|
||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -n $INPUT_NAME -F $INPUT_FLAGS
|
||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FILE" != "x" ]
|
||||
then
|
||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -f $INPUT_FILE
|
||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_FLAGS" != "x" ]
|
||||
then
|
||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -F $INPUT_FLAGS
|
||||
elif [ "x$INPUT_FLAGS" != "x" ] && [ "x$INPUT_FILE" != "x" ]
|
||||
elif [ "x$INPUT_TOKEN" != "x" ] && [ "x$INPUT_NAME" != "x" ]
|
||||
then
|
||||
bash <(curl -s https://codecov.io/bash) -F $INPUT_FLAGS -f $INPUT_FILE
|
||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN -n $INPUT_NAME
|
||||
elif [ "x$INPUT_TOKEN" != "x" ]
|
||||
then
|
||||
bash <(curl -s https://codecov.io/bash) -t $INPUT_TOKEN
|
||||
elif [ "x$INPUT_FILE" != "x" ]
|
||||
then
|
||||
bash <(curl -s https://codecov.io/bash) -f $INPUT_FILE
|
||||
elif [ "x$INPUT_FLAGS" != "x" ]
|
||||
then
|
||||
bash <(curl -s https://codecov.io/bash) -F $INPUT_FLAGS
|
||||
else
|
||||
echo "Please provide an upload token from codecov.io with valid arguments"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user