Skip to content

Commit f8a51b6

Browse files
A5rockswebknjaz
andauthored
Codecov v5 (#3312)
* Bump Codecov action to v5 It's more stable and requires a token that is already in the config. Alpine needs curl, gpg, git and jq because of a bug in codecov-action [[1]]. [1]: codecov/codecov-action#1320 * Make codecov v5 work * Remove forgotten lines too * Add an extra thing I missed --------- Co-authored-by: Sviatoslav Sydorenko <wk@sydorenko.org.ua>
1 parent 7f7bf5e commit f8a51b6

File tree

3 files changed

+17
-26
lines changed

3 files changed

+17
-26
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,13 @@ jobs:
215215
LSP: '${{ matrix.lsp }}'
216216
LSP_EXTRACT_FILE: '${{ matrix.lsp_extract_file }}'
217217
- if: always()
218-
uses: codecov/codecov-action@v3
218+
uses: codecov/codecov-action@v5
219219
with:
220-
directory: empty
221220
name: Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})
222221
# multiple flags is marked as an error in codecov UI, but is actually fine
223222
# https://github.com/codecov/feedback/issues/567
224223
flags: Windows,${{ matrix.python }}
225-
fail_ci_if_error: false # change to true when using codecov action v5
224+
fail_ci_if_error: true
226225

227226
Ubuntu:
228227
name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
@@ -291,12 +290,11 @@ jobs:
291290
- if: >-
292291
always()
293292
&& matrix.check_formatting != '1'
294-
uses: codecov/codecov-action@v3
293+
uses: codecov/codecov-action@v5
295294
with:
296-
directory: empty
297295
name: Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})
298296
flags: Ubuntu,${{ matrix.python }}
299-
fail_ci_if_error: false
297+
fail_ci_if_error: true
300298
301299
macOS:
302300
name: 'macOS (${{ matrix.python }})'
@@ -334,12 +332,11 @@ jobs:
334332
- name: Run tests
335333
run: ./ci.sh
336334
- if: always()
337-
uses: codecov/codecov-action@v3
335+
uses: codecov/codecov-action@v5
338336
with:
339-
directory: empty
340337
name: macOS (${{ matrix.python }})
341338
flags: macOS,${{ matrix.python }}
342-
fail_ci_if_error: false
339+
fail_ci_if_error: true
343340

344341
# run CI on a musl linux
345342
Alpine:
@@ -353,9 +350,10 @@ jobs:
353350
- name: Install necessary packages
354351
# can't use setup-python because that python doesn't seem to work;
355352
# `python3-dev` (rather than `python:alpine`) for some ctypes reason,
353+
# `curl`, `gpg`, `git` for codecov-action v4/v5 to work (https://github.com/codecov/codecov-action/issues/1320).
356354
# `nodejs` for pyright (`node-env` pulls in nodejs but that takes a while and can time out the test).
357355
# `perl` for a platform independent `sed -i` alternative
358-
run: apk update && apk add python3-dev bash nodejs perl
356+
run: apk update && apk add python3-dev bash curl gpg git nodejs perl
359357

360358
- name: Retrieve the project source from an sdist inside the GHA artifact
361359
# must be after `apk add` because it relies on `bash` existing
@@ -380,12 +378,11 @@ jobs:
380378
f.write("\n")
381379
382380
- if: always()
383-
uses: codecov/codecov-action@v3
381+
uses: codecov/codecov-action@v5
384382
with:
385-
directory: empty
386383
name: Alpine
387384
flags: Alpine,${{ steps.get-version.outputs.version }}
388-
fail_ci_if_error: false
385+
fail_ci_if_error: true
389386

390387
Cython:
391388
name: "Cython"
@@ -453,7 +450,7 @@ jobs:
453450
with:
454451
name: Cython
455452
flags: Cython,${{ steps.get-version.outputs.version }}
456-
fail_ci_if_error: false
453+
fail_ci_if_error: true
457454

458455
# https://github.com/marketplace/actions/alls-green#why
459456
check: # This job does nothing and is only used for the branch protection

ci.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ echo "::endgroup::"
137137
echo "::group::Coverage"
138138

139139
coverage combine --rcfile ../pyproject.toml
140-
coverage report -m --rcfile ../pyproject.toml
141-
coverage xml --rcfile ../pyproject.toml
140+
cd .. # coverage needs to be in the folder containing src/trio
141+
cp empty/.coverage .
142+
coverage report -m --rcfile ./pyproject.toml
143+
coverage xml --rcfile ./pyproject.toml
142144

143145
# Remove the LSP again; again we want to do this ASAP to avoid
144146
# accidentally breaking other stuff.

pyproject.toml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -292,18 +292,10 @@ show_contexts = true
292292
skip_covered = false
293293

294294
[tool.coverage.paths]
295-
_site-packages-to-src-mapping = [
296-
"src",
297-
"*/src",
298-
'*\src',
299-
"*/lib/pypy*/site-packages",
300-
"*/lib/python*/site-packages",
301-
'*\Lib\site-packages',
302-
]
295+
source = ["src", "**/site-packages"]
303296

304297
[tool.coverage.run]
305298
branch = true
306-
source_pkgs = ["trio"]
307299
omit = [
308300
# Omit the generated files in trio/_core starting with _generated_
309301
"*/trio/_core/_generated_*",
@@ -319,7 +311,7 @@ omit = [
319311
parallel = true
320312
plugins = []
321313
relative_files = true
322-
source = ["."]
314+
source = ["trio"]
323315

324316
[tool.coverage.report]
325317
precision = 1

0 commit comments

Comments
 (0)