mirror of
https://github.com/codecov/codecov-action.git
synced 2025-12-08 16:16:24 +00:00
Compare commits
118 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5749ba79a | ||
|
|
b4c0b83601 | ||
|
|
3cde50f4f1 | ||
|
|
10e590a5de | ||
|
|
af19dcb193 | ||
|
|
77e74f257f | ||
|
|
1c4a4261fa | ||
|
|
cb218a0977 | ||
|
|
e78f79e460 | ||
|
|
899e5c913e | ||
|
|
886c7c8bc8 | ||
|
|
75d10d924b | ||
|
|
e61b738355 | ||
|
|
cbad155b75 | ||
|
|
9e1c456662 | ||
|
|
392e5b2711 | ||
|
|
bd5538d84a | ||
|
|
9d47efe7b9 | ||
|
|
6aa7ac1896 | ||
|
|
c2a68071b3 | ||
|
|
8273bebacc | ||
|
|
6728012add | ||
|
|
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 | ||
|
|
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 | ||
|
|
125f8ba18b | ||
|
|
6a600290f3 | ||
|
|
839122bfbb | ||
|
|
3f456df687 | ||
|
|
c465c373d0 |
23
.github/workflows/main.yml
vendored
Normal file
23
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
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
|
||||
|
||||
# - name: Generate coverage report
|
||||
# run: |
|
||||
# pip install pytest
|
||||
# pip install pytest-cov
|
||||
# pytest --cov=./ --cov-report=xml
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: ./
|
||||
with:
|
||||
token: ${{secrets.CODECOV_TOKEN}}
|
||||
flags: unittest
|
||||
name: codecov-1
|
||||
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
|
||||
17
Dockerfile
17
Dockerfile
@@ -1,10 +1,15 @@
|
||||
FROM alpine:3.10
|
||||
# Codecov @codecov
|
||||
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
FROM debian:stretch-slim
|
||||
|
||||
RUN apk add --no-cache curl bash git
|
||||
RUN apt-get update && apt-get install -y \
|
||||
ca-certificates \
|
||||
curl \
|
||||
git \
|
||||
mercurial \
|
||||
--no-install-recommends && rm -r /var/lib/apt/lists/*
|
||||
|
||||
RUN chmod +x /app/entrypoint.sh
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
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.
|
||||
60
README.md
60
README.md
@@ -1,28 +1,68 @@
|
||||
<!-- <p align="center"><img src="./codecov-logo.png" /></p> -->
|
||||
# Codecov GitHub Action
|
||||
|
||||
# Codecov Github Action
|
||||
### Easily upload coverage reports to Codecov from Github Actions
|
||||
[](https://github.com/marketplace/actions/codecov)
|
||||
### 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.1
|
||||
- uses: codecov/codecov-action@v1.0.3
|
||||
with:
|
||||
token: ${{secrets.CODECOV_TOKEN}}
|
||||
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
|
||||
|
||||
| Argument | Description |
|
||||
| :---: | :---: |
|
||||
| `token` | Used to authorize coverage report uploads |
|
||||
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
|
||||
|
||||
```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@v1.0.3
|
||||
with:
|
||||
token: ${{secrets.CODECOV_TOKEN}}
|
||||
file: ./coverage.xml
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
```
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome! Check out the [Contribution Guide](CONTRIBUTING.md).
|
||||
|
||||
## License
|
||||
|
||||
The code in this project is released under the MIT License
|
||||
The code in this project is released under the [MIT License](LICENSE).
|
||||
|
||||
21
action.yml
21
action.yml
@@ -1,10 +1,19 @@
|
||||
name: 'Codecov'
|
||||
description: 'Github action that uploads coverage reports for your repository to codecov.io'
|
||||
author: 'Ib @ Codecov'
|
||||
description: 'GitHub Action that uploads coverage reports for your repository to codecov.io'
|
||||
author: 'Ibrahim Ali <@ibrahim0814> | Codecov'
|
||||
inputs:
|
||||
token:
|
||||
description: 'Set the repository token'
|
||||
name:
|
||||
description: 'User defined upload name. Visible in Codecov UI'
|
||||
required: false
|
||||
token:
|
||||
description: 'Repository upload token - get it from codecov.io'
|
||||
required: true
|
||||
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:
|
||||
color: 'red'
|
||||
icon: 'umbrella'
|
||||
@@ -12,4 +21,8 @@ runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
args:
|
||||
- ${{ inputs.name }}
|
||||
- ${{ inputs.token }}
|
||||
- ${{ inputs.file }}
|
||||
- ${{ inputs.flags }}
|
||||
|
||||
|
||||
BIN
codecov-logo.png
BIN
codecov-logo.png
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
21
entrypoint.sh
Normal file → Executable file
21
entrypoint.sh
Normal file → Executable file
@@ -1,11 +1,20 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# Codecov @codecov
|
||||
|
||||
set -eu
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
if [ "x$INPUT_FILE" != 'x' ]; then
|
||||
curl -s https://codecov.io/bash | bash -s -- \
|
||||
-f "$INPUT_FILE" \
|
||||
-t "$INPUT_TOKEN" \
|
||||
-n "$INPUT_NAME" \
|
||||
-F "$INPUT_FLAGS" \
|
||||
-Z || echo 'Codecov upload failed'
|
||||
else
|
||||
bash <(curl -s https://codecov.io/bash) -t $1
|
||||
curl -s https://codecov.io/bash | bash -s -- \
|
||||
-t "$INPUT_TOKEN" \
|
||||
-n "$INPUT_NAME" \
|
||||
-F "$INPUT_FLAGS" \
|
||||
-Z || echo 'Codecov upload failed'
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user