Skip to content

Commit 4f5365d

Browse files
Fix .codecov.yml (#296)
* Fix .codecov.yml * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Separate codecov steps for PRs and non-PRs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 9d02182 commit 4f5365d

2 files changed

Lines changed: 28 additions & 13 deletions

File tree

.codecov.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,25 @@ codecov:
33
require_ci_to_pass: yes
44

55
coverage:
6+
range: 70..100
67
precision: 2
78
round: down
8-
range: "70...100"
9-
ignore: Tests
10-
status:
11-
project:
12-
default:
13-
target: auto
14-
threshold: 0%
15-
patch:
16-
default:
17-
target: 97%
9+
ignore:
10+
- "tests/**"
11+
- "**/_version.py"
12+
- "**/__init__.py"
13+
14+
status:
15+
project: # overall coverage
16+
default:
17+
target: auto # fail on any drop
18+
threshold: 0% # or 0.5 % if you want slack
19+
patch: # changed lines
20+
default:
21+
target: 97%
1822

1923
comment:
20-
layout: "header, changes, diff"
24+
layout: header, changes, diff
2125
behavior: default
2226
require_changes: false
2327
branches: null

.github/workflows/ci-test.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,26 @@ jobs:
144144
if: matrix.backend == 'redis'
145145
run: pytest -m redis --cov=cachier --cov-report=term --cov-report=xml:cov.xml
146146

147-
- name: Upload coverage to Codecov
147+
- name: Upload coverage to Codecov (non-PRs)
148+
if: github.event_name != 'pull_request' # pushes, scheduled, etc.
148149
continue-on-error: true
149150
uses: codecov/codecov-action@v5
150151
with:
151152
fail_ci_if_error: true
152-
name: codecov-umbrella
153153
token: ${{ secrets.CODECOV_TOKEN }} # required
154154
flags: ${{ matrix.backend }}
155155

156+
# We need a separate step for PRs because PRs do not have access to
157+
# secrets; hence, provide the token will give it an empty value,
158+
# resulting in an authentication error.
159+
- name: Upload coverage to Codecov (PRs)
160+
if: github.event_name == 'pull_request' # PRs only
161+
continue-on-error: true
162+
uses: codecov/codecov-action@v5
163+
with:
164+
fail_ci_if_error: true
165+
flags: ${{ matrix.backend }}
166+
156167
testing-guardian:
157168
runs-on: ubuntu-latest
158169
needs: pytester

0 commit comments

Comments
 (0)