From b07705a87be31a5c7b459984ce3d686780324307 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 20 Dec 2024 05:01:56 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20Publish=20MyPy=20type=20coverage?= =?UTF-8?q?=20to=20Codecov?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 20 +++++++++++++++----- README.rst | 4 ++-- check.sh | 12 ++++++------ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4704462f0..5afb2112b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,7 +88,7 @@ jobs: name: Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }}) # multiple flags is marked as an error in codecov UI, but is actually fine # https://github.com/codecov/feedback/issues/567 - flags: Windows,${{ matrix.python }} + flags: pytest,Windows,${{ matrix.python }} # this option cannot be set in .codecov.yml fail_ci_if_error: true @@ -141,8 +141,18 @@ jobs: with: directory: empty name: Ubuntu (${{ matrix.python }}${{ matrix.extra_name }}) - flags: Ubuntu,${{ matrix.python }} + flags: pytest,Ubuntu,${{ matrix.python }} fail_ci_if_error: true + - if: >- + always() + && matrix.check_formatting == '1' + uses: codecov/codecov-action@v5 + with: + disable_search: true + files: empty/mypy-cov-*-py-*/* + flags: MyPy + fail_ci_if_error: true + name: MyPy type coverage macOS: name: 'macOS (${{ matrix.python }})' @@ -177,7 +187,7 @@ jobs: with: directory: empty name: macOS (${{ matrix.python }}) - flags: macOS,${{ matrix.python }} + flags: pytest,macOS,${{ matrix.python }} fail_ci_if_error: true # run CI on a musl linux @@ -206,7 +216,7 @@ jobs: with: directory: empty name: Alpine - flags: Alpine,${{ steps.get-version.outputs.version }} + flags: pytest,Alpine,${{ steps.get-version.outputs.version }} fail_ci_if_error: true Cython: @@ -260,7 +270,7 @@ jobs: uses: codecov/codecov-action@v5 with: name: Cython - flags: Cython,${{ steps.get-version.outputs.version }} + flags: pytest,Cython,${{ steps.get-version.outputs.version }} fail_ci_if_error: true # https://github.com/marketplace/actions/alls-green#why diff --git a/README.rst b/README.rst index e3620546a..dda27062d 100644 --- a/README.rst +++ b/README.rst @@ -18,8 +18,8 @@ :target: https://anaconda.org/conda-forge/trio :alt: Latest conda-forge version -.. image:: https://codecov.io/gh/python-trio/trio/branch/main/graph/badge.svg - :target: https://codecov.io/gh/python-trio/trio +.. image:: https://codecov.io/gh/python-trio/trio/graph/badge.svg?flag=pytest + :target: https://app.codecov.io/gh/python-trio/trio?flags[]=pytest :alt: Test coverage Trio – a friendly Python library for async concurrency and I/O diff --git a/check.sh b/check.sh index b1b7cbf98..21ec9d09f 100755 --- a/check.sh +++ b/check.sh @@ -57,19 +57,19 @@ echo "::group::Mypy" rm -f mypy_annotate.dat # Pipefail makes these pipelines fail if mypy does, even if mypy_annotate.py succeeds. set -o pipefail -mypy --show-error-end --python-version=3.13 --platform linux | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Linux \ +mypy --show-error-end --python-version=3.13 --cobertura-xml-report=mypy-cov-linux-py-3.13 --platform linux | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Linux \ || { echo "* Mypy (Linux, Python 3.13) found type errors." >> "$GITHUB_STEP_SUMMARY"; MYPY=1; } # Darwin tests FreeBSD too -mypy --show-error-end --python-version=3.13 --platform darwin | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Mac \ +mypy --show-error-end --python-version=3.13 --cobertura-xml-report=mypy-cov-macos-py-3.13 --platform darwin | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Mac \ || { echo "* Mypy (Mac, Python 3.13) found type errors." >> "$GITHUB_STEP_SUMMARY"; MYPY=1; } -mypy --show-error-end --python-version=3.13 --platform win32 | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Windows \ +mypy --show-error-end --python-version=3.13 --cobertura-xml-report=mypy-cov-windows-py-3.13 --platform win32 | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Windows \ || { echo "* Mypy (Windows, Python 3.13) found type errors." >> "$GITHUB_STEP_SUMMARY"; MYPY=1; } -mypy --show-error-end --python-version=3.8 --platform linux | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Linux \ +mypy --show-error-end --python-version=3.8 --cobertura-xml-report=mypy-cov-linux-py-3.8 --platform linux | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Linux \ || { echo "* Mypy (Linux, Python 3.8) found type errors." >> "$GITHUB_STEP_SUMMARY"; MYPY=1; } # Darwin tests FreeBSD too -mypy --show-error-end --python-version=3.8 --platform darwin | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Mac \ +mypy --show-error-end --python-version=3.8 --cobertura-xml-report=mypy-cov-macos-py-3.8 --platform darwin | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Mac \ || { echo "* Mypy (Mac, Python 3.8) found type errors." >> "$GITHUB_STEP_SUMMARY"; MYPY=1; } -mypy --show-error-end --python-version=3.8 --platform win32 | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Windows \ +mypy --show-error-end --python-version=3.8 --cobertura-xml-report=mypy-cov-windows-py-3.8 --platform win32 | python ./src/trio/_tools/mypy_annotate.py --dumpfile mypy_annotate.dat --platform Windows \ || { echo "* Mypy (Windows, Python 3.8) found type errors." >> "$GITHUB_STEP_SUMMARY"; MYPY=1; } set +o pipefail # Re-display errors using Github's syntax, read out of mypy_annotate.dat