Skip to content

Commit 4f66fab

Browse files
authored
Merge pull request #3156 from jakkdl/codecov_stuff
Codecov improvements
2 parents b10c043 + 2c53ff2 commit 4f66fab

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

.codecov.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# -- repository yaml --
2+
3+
# Explicitly wait for all jobs to finish, as wait_for_ci prematurely triggers.
4+
# See https://github.com/python-trio/trio/issues/2689
5+
codecov:
6+
notify:
7+
# This number needs to be changed whenever the number of runs in CI is changed.
8+
# Another option is codecov-cli: https://github.com/codecov/codecov-cli#send-notifications
9+
after_n_builds: 27
10+
wait_for_ci: false
11+
notify_error: true # if uploads fail, replace cov comment with a comment with errors.
12+
require_ci_to_pass: false
13+
14+
# Publicly exposing the token has some small risks from mistakes or malicious actors.
15+
# See https://docs.codecov.com/docs/codecov-tokens for correctly configuring it.
16+
token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46
17+
18+
# only post PR comment if coverage changes
19+
comment:
20+
require_changes: true
21+
22+
coverage:
23+
# required range
24+
range: 99.6..100
25+
status:
26+
# require patches to be 100%
27+
patch:
28+
default:
29+
target: 100%

.github/workflows/ci.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ jobs:
8585
uses: codecov/codecov-action@v3
8686
with:
8787
directory: empty
88-
token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46
8988
name: Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})
89+
# multiple flags is marked as an error in codecov UI, but is actually fine
90+
# https://github.com/codecov/feedback/issues/567
9091
flags: Windows,${{ matrix.python }}
92+
# this option cannot be set in .codecov.yml
93+
fail_ci_if_error: true
9194

9295
Ubuntu:
9396
name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
@@ -131,13 +134,15 @@ jobs:
131134
env:
132135
CHECK_FORMATTING: '${{ matrix.check_formatting }}'
133136
NO_TEST_REQUIREMENTS: '${{ matrix.no_test_requirements }}'
134-
- if: always()
137+
- if: >-
138+
always()
139+
&& matrix.check_formatting != '1'
135140
uses: codecov/codecov-action@v3
136141
with:
137142
directory: empty
138-
token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46
139143
name: Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})
140144
flags: Ubuntu,${{ matrix.python }}
145+
fail_ci_if_error: true
141146
142147
macOS:
143148
name: 'macOS (${{ matrix.python }})'
@@ -171,9 +176,9 @@ jobs:
171176
uses: codecov/codecov-action@v3
172177
with:
173178
directory: empty
174-
token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46
175179
name: macOS (${{ matrix.python }})
176180
flags: macOS,${{ matrix.python }}
181+
fail_ci_if_error: true
177182

178183
# run CI on a musl linux
179184
Alpine:
@@ -193,13 +198,16 @@ jobs:
193198
run: python -m venv .venv
194199
- name: Run tests
195200
run: source .venv/bin/activate && ./ci.sh
201+
- name: Get Python version for codecov flag
202+
id: get-version
203+
run: echo "version=$(python -V | cut -d' ' -f2 | cut -d'.' -f1,2)" >> "${GITHUB_OUTPUT}"
196204
- if: always()
197205
uses: codecov/codecov-action@v3
198206
with:
199207
directory: empty
200-
token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46
201208
name: Alpine
202-
flags: Alpine,3.12
209+
flags: Alpine,${{ steps.get-version.outputs.version }}
210+
fail_ci_if_error: true
203211

204212
Cython:
205213
name: "Cython"

0 commit comments

Comments
 (0)