Skip to content

Commit 8180ccf

Browse files
Update README.md
add warning section and turn full example into quickstart section
1 parent 6515afe commit 8180ccf

File tree

1 file changed

+48
-46
lines changed

1 file changed

+48
-46
lines changed

README.md

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
1+
> :warning: **This action does not replace [codecov-action](https://github.com/codecov/codecov-action)**: You must include both actions if you want to upload both coverage and test results. See the quickstart section below for an example that uploads both coverage and test results.
2+
3+
## Quickstart
4+
5+
```yaml
6+
name: Example workflow for Codecov
7+
on: [push]
8+
jobs:
9+
run:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
env:
15+
OS: ${{ matrix.os }}
16+
PYTHON: '3.10'
17+
steps:
18+
- uses: actions/checkout@master
19+
- name: Setup Python
20+
uses: actions/setup-python@master
21+
with:
22+
python-version: 3.10
23+
- name: Generate coverage and test result report
24+
run: |
25+
pip install pytest
26+
pip install pytest-cov
27+
pytest --cov=./ --cov-report=xml --junitxml=./junit.xml
28+
- name: Upload test results to Codecov
29+
if: ${{ !cancelled() }}
30+
uses: codecov/test-results-action@v1
31+
with:
32+
files: ./junit.xml,!./cache
33+
flags: python3.10
34+
name: codecov-umbrella-test-results
35+
token: ${{ secrets.CODECOV_TOKEN }}
36+
- name: Upload coverage to Codecov
37+
uses: codecov/codecov-action@v4
38+
with:
39+
directory: ./coverage/reports/
40+
env_vars: OS,PYTHON
41+
fail_ci_if_error: true
42+
files: ./coverage1.xml,./coverage2.xml,!./cache
43+
flags: unittests
44+
name: codecov-umbrella
45+
token: ${{ secrets.CODECOV_TOKEN }}
46+
verbose: true
47+
```
48+
149
## Usage
250
351
Currently, the Action will identify linux, macos, and windows runners. However, the Action may misidentify other architectures. The OS can be specified as
@@ -73,49 +121,3 @@ Codecov's Action supports inputs from the user. These inputs, along with their d
73121
| `verbose` | Specify whether the Codecov output should be verbose | Optional
74122
| `version` | Specify which version of the Codecov CLI should be used. Defaults to `latest` | Optional
75123
| `working-directory` | Directory in which to execute codecov.sh | Optional
76-
77-
### Example `workflow.yml` with Codecov Action
78-
79-
```yaml
80-
name: Example workflow for Codecov
81-
on: [push]
82-
jobs:
83-
run:
84-
runs-on: ${{ matrix.os }}
85-
strategy:
86-
matrix:
87-
os: [ubuntu-latest, macos-latest, windows-latest]
88-
env:
89-
OS: ${{ matrix.os }}
90-
PYTHON: '3.10'
91-
steps:
92-
- uses: actions/checkout@master
93-
- name: Setup Python
94-
uses: actions/setup-python@master
95-
with:
96-
python-version: 3.10
97-
- name: Generate coverage and test result report
98-
run: |
99-
pip install pytest
100-
pip install pytest-cov
101-
pytest --cov=./ --cov-report=xml --junitxml=./junit.xml
102-
- name: Upload test results to Codecov
103-
if: ${{ !cancelled() }}
104-
uses: codecov/test-results-action@v1
105-
with:
106-
files: ./junit.xml,!./cache
107-
flags: python3.10
108-
name: codecov-umbrella-test-results
109-
token: ${{ secrets.CODECOV_TOKEN }}
110-
- name: Upload coverage to Codecov
111-
uses: codecov/codecov-action@v4
112-
with:
113-
directory: ./coverage/reports/
114-
env_vars: OS,PYTHON
115-
fail_ci_if_error: true
116-
files: ./coverage1.xml,./coverage2.xml,!./cache
117-
flags: unittests
118-
name: codecov-umbrella
119-
token: ${{ secrets.CODECOV_TOKEN }}
120-
verbose: true
121-
```

0 commit comments

Comments
 (0)