Skip to content

Commit f532c3a

Browse files
authored
Merge pull request #64 from samuelcolvin/env-vars
Env vars
2 parents 143333b + 6914527 commit f532c3a

File tree

4 files changed

+29243
-28361
lines changed

4 files changed

+29243
-28361
lines changed

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Codecov GitHub Action
1+
# Codecov GitHub Action
22

33
[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-v1-undefined.svg?logo=github&logoColor=white&style=flat)](https://github.com/marketplace/actions/codecov)
4-
### Easily upload coverage reports to Codecov from GitHub Actions
4+
### Easily upload coverage reports to Codecov from GitHub Actions
55

66
>The latest release of this Action adds support for tokenless uploads from GitHub Actions!
77
88
## Usage
99

10-
To integrate Codecov with your Actions pipeline, specify the name of this repository with a tag number (`@v1` is recommended) as a `step` within your `workflow.yml` file.
10+
To integrate Codecov with your Actions pipeline, specify the name of this repository with a tag number (`@v1` is recommended) as a `step` within your `workflow.yml` file.
1111

1212
If you have a *private repository*, 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 up to four additional inputs to customize the upload context. **For public repositories, no token is needed**
1313

@@ -24,11 +24,11 @@ steps:
2424
name: codecov-umbrella # optional
2525
fail_ci_if_error: true # optional (default = false)
2626
```
27-
>**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). Keep in mind that secrets are *not* available to forks of repositories.
27+
>**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). Keep in mind that secrets are *not* available to forks of repositories.
2828

2929
## Arguments
3030

31-
Codecov's Action currently supports five inputs from the user: `token`, `file`, `flags`,`name`, and `fail_ci_if_error`. These inputs, along with their descriptions and usage contexts, are listed in the table below:
31+
Codecov's Action currently supports five inputs from the user: `token`, `file`, `flags`,`name`, and `fail_ci_if_error`. These inputs, along with their descriptions and usage contexts, are listed in the table below:
3232

3333
>**Update**: We've removed the `yml` parameter with the latest release of this action. Please put your custom codecov yaml file at the root of the repo because other locations will no longer be supported in the future.
3434

@@ -37,6 +37,7 @@ Codecov's Action currently supports five inputs from the user: `token`, `file`,
3737
| `token` | Used to authorize coverage report uploads | *Required for private repos* |
3838
| `file` | Path to the coverage report(s) | Optional
3939
| `flags` | Flag the upload to group coverage metrics (unittests, uitests, etc.). Multiple flags are separated by a comma (ui,chrome) | Optional
40+
| `env_vars` | Environment variables to tag the upload with. Multiple env variables can be separated with commas (e.g. `OS,PYTHON`) | Optional
4041
| `name` | Custom defined name for the upload | Optional
4142
| `fail_ci_if_error` | Specify if CI pipeline should fail when Codecov runs into errors during upload. *Defaults to **false*** | Optional
4243

@@ -49,11 +50,14 @@ jobs:
4950
run:
5051
runs-on: ${{ matrix.os }}
5152
strategy:
52-
matrix:
53+
matrix:
5354
os: [ubuntu-latest, macos-latest, windows-latest]
55+
env:
56+
OS: ${{ matrix.os }}
57+
PYTHON: '3.7'
5458
steps:
5559
- uses: actions/checkout@master
56-
- name: Setup Python
60+
- name: Setup Python
5761
uses: actions/setup-python@master
5862
with:
5963
python-version: 3.7
@@ -62,19 +66,20 @@ jobs:
6266
pip install pytest
6367
pip install pytest-cov
6468
pytest --cov=./ --cov-report=xml
65-
- name: Upload coverage to Codecov
69+
- name: Upload coverage to Codecov
6670
uses: codecov/codecov-action@v1
6771
with:
6872
token: ${{ secrets.CODECOV_TOKEN }}
6973
file: ./coverage.xml
7074
flags: unittests
75+
env_vars: OS,PYTHON
7176
name: codecov-umbrella
7277
fail_ci_if_error: true
7378
```
7479
## Contributing
7580

7681
Contributions are welcome! Check out the [Contribution Guide](CONTRIBUTING.md).
7782

78-
## License
83+
## License
7984

8085
The code in this project is released under the [MIT License](LICENSE).

action.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
name: 'Codecov'
22
description: 'GitHub Action that uploads coverage reports for your repository to codecov.io'
33
author: 'Ibrahim Ali <@ibrahim0814> | Codecov'
4-
inputs:
4+
inputs:
55
name:
66
description: 'User defined upload name. Visible in Codecov UI'
7-
required: false
7+
required: false
88
token:
99
description: 'Repository upload token - get it from codecov.io. Required only for private repositories'
10-
required: false
10+
required: false
1111
file:
1212
description: 'Path to coverage file to upload'
1313
required: false
1414
flags:
1515
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
1616
required: false
17+
env_vars:
18+
description: 'Environment variables to tag the upload with (e.g. PYTHON | OS,PYTHON)'
19+
required: false
1720
fail_ci_if_error:
1821
description: 'Specify whether or not CI build should fail if Codecov runs into an error during upload'
1922
required: false
2023
branding:
21-
color: 'red'
24+
color: 'red'
2225
icon: 'umbrella'
2326
runs:
2427
using: 'node12'
2528
main: 'dist/index.js'
26-

0 commit comments

Comments
 (0)