mirror of
https://github.com/codecov/codecov-action.git
synced 2025-12-09 00:26:25 +00:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e74d307e33 | ||
|
|
55c9c61f7e | ||
|
|
e749576e48 | ||
|
|
4a87a38546 | ||
|
|
d7c531ac59 | ||
|
|
b8cc1b68aa | ||
|
|
1cb9bf4ff5 | ||
|
|
48bb5e4ec3 | ||
|
|
a4dba2e03e | ||
|
|
c1b452a1b8 | ||
|
|
6905df41d5 | ||
|
|
052454207d | ||
|
|
0be151486e | ||
|
|
4b3f2da728 | ||
|
|
03b2817fb6 | ||
|
|
6fdf86f06b | ||
|
|
7c7db8b859 | ||
|
|
044d93a92c | ||
|
|
caffaa27c7 | ||
|
|
902f207325 | ||
|
|
72a27786b2 | ||
|
|
30fe6d4bec | ||
|
|
68ee090395 | ||
|
|
ce00a5b662 | ||
|
|
1f8bbdf5bb | ||
|
|
47b142b183 | ||
|
|
95bbe7b4bf | ||
|
|
8e51ca4502 | ||
|
|
0fa1095987 | ||
|
|
02da153e67 |
13
CONTRIBUTING.md
Normal file
13
CONTRIBUTING.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Contribution Guide
|
||||||
|
|
||||||
|
:tada: Thanks for taking the time to contribute! :tada:
|
||||||
|
|
||||||
|
The following is a set of guidelines for contributing to this repository, which is hosted in the [Codecov Organization](https://github.com/codecov) on GitHub.
|
||||||
|
|
||||||
|
## What does this repo do?
|
||||||
|
|
||||||
|
This repo is a GitHub Action, meaning it integrates with the GitHub Actions CI/CD pipeline. It's meant to take formatted reports with code coverage stats and upload them to codecov.io. What's essentially happening in the background is that Actions is spinning up a Linux Docker container with the contents of this repository. Inside that container, we then call a shell scipt that runs Codecov's Bash uploader.
|
||||||
|
|
||||||
|
## PRs and Support
|
||||||
|
|
||||||
|
Feel free to clone, modify code and request a PR to this repository. All PRs will be reviewed by the Codecov team. If your PR has been sitting for a while or if you have any questions, ping us at support@codecov.io
|
||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 Codecov
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
46
README.md
46
README.md
@@ -1,7 +1,7 @@
|
|||||||
<!-- <p align="center"><img src="./codecov-logo.png" /></p> -->
|
<!-- <p align="center"><img src="./codecov-logo.png" /></p> -->
|
||||||
|
|
||||||
# Codecov GitHub Action
|
# Codecov GitHub Action
|
||||||
### Easily upload coverage reports to Codecov from Github Actions
|
### Easily upload coverage reports to Codecov from GitHub Actions
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -10,19 +10,53 @@ Inside your `.github/workflows/workflow.yml` file:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- uses: actions/codecov-action@v0.2
|
- uses: actions/codecov-action@v0.4
|
||||||
with:
|
with:
|
||||||
token: ${{secrets.CODECOV_TOKEN}}
|
token: ${{secrets.CODECOV_TOKEN}} #for private repos
|
||||||
|
file: ./coverage.xml #optional
|
||||||
|
flags: unittests #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.
|
||||||
|
|
||||||
|
### 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.4
|
||||||
|
with:
|
||||||
|
token: ${{secrets.CODECOV_TOKEN}}
|
||||||
|
file: ./coverage.xml
|
||||||
|
flags: unittests
|
||||||
```
|
```
|
||||||
>**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.
|
|
||||||
|
|
||||||
## Arguments
|
## Arguments
|
||||||
|
|
||||||
| Argument | Description |
|
| Input | Description |
|
||||||
| :---: | :---: |
|
| :---: | :---: |
|
||||||
| `token` | Used to authorize coverage report uploads |
|
| `token` | Used to authorize coverage report uploads |
|
||||||
|
| `file` | Location of the coverage report |
|
||||||
|
| `flags` | Flag upload to group coverage metrics |
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
The code in this project is released under the MIT License
|
The code in this project is released under the [MIT License](LICENSE)
|
||||||
|
|||||||
10
action.yml
10
action.yml
@@ -1,10 +1,16 @@
|
|||||||
name: 'Codecov'
|
name: 'Codecov'
|
||||||
description: 'GitHub action that uploads coverage reports for your repository to codecov.io'
|
description: 'GitHub action that uploads coverage reports for your repository to codecov.io'
|
||||||
author: 'Ib @ Codecov'
|
author: 'Ibrahim Ali @ Codecov'
|
||||||
inputs:
|
inputs:
|
||||||
token:
|
token:
|
||||||
description: 'Set the repository token'
|
description: 'Set the repository token'
|
||||||
required: false
|
required: false
|
||||||
|
file:
|
||||||
|
description: 'Path to coverage file to upload'
|
||||||
|
required: false
|
||||||
|
flags:
|
||||||
|
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
|
||||||
|
required: false
|
||||||
branding:
|
branding:
|
||||||
color: 'red'
|
color: 'red'
|
||||||
icon: 'umbrella'
|
icon: 'umbrella'
|
||||||
@@ -13,3 +19,5 @@ runs:
|
|||||||
image: 'Dockerfile'
|
image: 'Dockerfile'
|
||||||
args:
|
args:
|
||||||
- ${{ inputs.token }}
|
- ${{ inputs.token }}
|
||||||
|
- ${{ inputs.file }}
|
||||||
|
- ${{ inputs.flags }}
|
||||||
@@ -3,9 +3,30 @@
|
|||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
if [ $# -eq 0 ]
|
if [ $# -eq 0 ]
|
||||||
then
|
then
|
||||||
bash <(curl -s https://codecov.io/bash)
|
bash <(curl -s https://codecov.io/bash)
|
||||||
|
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" ]
|
||||||
|
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" ]
|
||||||
|
then
|
||||||
|
bash <(curl -s https://codecov.io/bash) -F $INPUT_FLAGS -f $INPUT_FILE
|
||||||
|
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
|
else
|
||||||
bash <(curl -s https://codecov.io/bash) -t $1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user