From b2862a495efd42cb330c57086dbbc4e74e23532a Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 20 Dec 2024 04:46:52 +0100 Subject: [PATCH 1/4] 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]: https://github.com/codecov/codecov-action/issues/1320 --- .github/workflows/ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4489e609d..68f85a697d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -218,7 +218,7 @@ jobs: LSP: '${{ matrix.lsp }}' LSP_EXTRACT_FILE: '${{ matrix.lsp_extract_file }}' - if: always() - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: directory: empty name: Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }}) @@ -284,7 +284,7 @@ jobs: - if: >- always() && matrix.check_formatting != '1' - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: directory: empty name: Ubuntu (${{ matrix.python }}${{ matrix.extra_name }}) @@ -326,7 +326,7 @@ jobs: - name: Run tests run: ./ci.sh - if: always() - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: directory: empty name: macOS (${{ matrix.python }}) @@ -345,9 +345,10 @@ jobs: - name: Install necessary packages # can't use setup-python because that python doesn't seem to work; # `python3-dev` (rather than `python:alpine`) for some ctypes reason, + # `curl`, `gpg`, `git`, `jq` for codecov-action v4/v5 to work (https://github.com/codecov/codecov-action/issues/1320). # `nodejs` for pyright (`node-env` pulls in nodejs but that takes a while and can time out the test). # `perl` for a platform independent `sed -i` alternative - run: apk update && apk add python3-dev bash nodejs perl + run: apk update && apk add python3-dev bash curl gpg git jq nodejs perl - name: Retrieve the project source from an sdist inside the GHA artifact # must be after `apk add` because it relies on `bash` existing uses: re-actors/checkout-python-sdist@release/v2 @@ -362,7 +363,7 @@ jobs: id: get-version run: echo "version=$(python -V | cut -d' ' -f2 | cut -d'.' -f1,2)" >> "${GITHUB_OUTPUT}" - if: always() - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: directory: empty name: Alpine From ed4b2837b0dde059cd739c73a859f65b504f44ee Mon Sep 17 00:00:00 2001 From: A5rocks Date: Tue, 5 Aug 2025 09:35:25 +0900 Subject: [PATCH 2/4] Make codecov v5 work --- .github/workflows/ci.yml | 14 +++++++------- ci.sh | 6 ++++-- pyproject.toml | 12 ++---------- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c860597af..90007cfdb8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -224,7 +224,7 @@ jobs: # 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 }} - fail_ci_if_error: false # change to true when using codecov action v5 + fail_ci_if_error: true Ubuntu: name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})' @@ -298,7 +298,7 @@ jobs: directory: empty name: Ubuntu (${{ matrix.python }}${{ matrix.extra_name }}) flags: Ubuntu,${{ matrix.python }} - fail_ci_if_error: false + fail_ci_if_error: true macOS: name: 'macOS (${{ matrix.python }})' @@ -341,7 +341,7 @@ jobs: directory: empty name: macOS (${{ matrix.python }}) flags: macOS,${{ matrix.python }} - fail_ci_if_error: false + fail_ci_if_error: true # run CI on a musl linux Alpine: @@ -355,10 +355,10 @@ jobs: - name: Install necessary packages # can't use setup-python because that python doesn't seem to work; # `python3-dev` (rather than `python:alpine`) for some ctypes reason, - # `curl`, `gpg`, `git`, `jq` for codecov-action v4/v5 to work (https://github.com/codecov/codecov-action/issues/1320). + # `curl`, `gpg`, `git` for codecov-action v4/v5 to work (https://github.com/codecov/codecov-action/issues/1320). # `nodejs` for pyright (`node-env` pulls in nodejs but that takes a while and can time out the test). # `perl` for a platform independent `sed -i` alternative - run: apk update && apk add python3-dev bash curl gpg git jq nodejs perl + run: apk update && apk add python3-dev bash curl gpg git nodejs perl - name: Retrieve the project source from an sdist inside the GHA artifact # must be after `apk add` because it relies on `bash` existing @@ -388,7 +388,7 @@ jobs: directory: empty name: Alpine flags: Alpine,${{ steps.get-version.outputs.version }} - fail_ci_if_error: false + fail_ci_if_error: true Cython: name: "Cython" @@ -456,7 +456,7 @@ jobs: with: name: Cython flags: Cython,${{ steps.get-version.outputs.version }} - fail_ci_if_error: false + fail_ci_if_error: true # https://github.com/marketplace/actions/alls-green#why check: # This job does nothing and is only used for the branch protection diff --git a/ci.sh b/ci.sh index 8b23ad279f..07797937e9 100755 --- a/ci.sh +++ b/ci.sh @@ -137,8 +137,10 @@ echo "::endgroup::" echo "::group::Coverage" coverage combine --rcfile ../pyproject.toml -coverage report -m --rcfile ../pyproject.toml -coverage xml --rcfile ../pyproject.toml +cd .. # coverage needs to be in the folder containing src/trio +cp empty/.coverage . +coverage report -m --rcfile ./pyproject.toml +coverage xml --rcfile ./pyproject.toml # Remove the LSP again; again we want to do this ASAP to avoid # accidentally breaking other stuff. diff --git a/pyproject.toml b/pyproject.toml index f0ba3610c8..e0434f7e78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -292,18 +292,10 @@ show_contexts = true skip_covered = false [tool.coverage.paths] -_site-packages-to-src-mapping = [ - "src", - "*/src", - '*\src', - "*/lib/pypy*/site-packages", - "*/lib/python*/site-packages", - '*\Lib\site-packages', -] +source = ['**/site-packages'] [tool.coverage.run] branch = true -source_pkgs = ["trio"] omit = [ # Omit the generated files in trio/_core starting with _generated_ "*/trio/_core/_generated_*", @@ -319,7 +311,7 @@ omit = [ parallel = true plugins = [] relative_files = true -source = ["."] +source = ["trio"] [tool.coverage.report] precision = 1 From c3fb5cd6c3d12595579c32264e8501422b06906f Mon Sep 17 00:00:00 2001 From: A5rocks Date: Tue, 5 Aug 2025 09:42:16 +0900 Subject: [PATCH 3/4] Remove forgotten lines too --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90007cfdb8..87e26e9389 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -219,7 +219,6 @@ jobs: - if: always() uses: codecov/codecov-action@v5 with: - directory: empty 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 @@ -295,7 +294,6 @@ jobs: && matrix.check_formatting != '1' uses: codecov/codecov-action@v5 with: - directory: empty name: Ubuntu (${{ matrix.python }}${{ matrix.extra_name }}) flags: Ubuntu,${{ matrix.python }} fail_ci_if_error: true @@ -338,7 +336,6 @@ jobs: - if: always() uses: codecov/codecov-action@v5 with: - directory: empty name: macOS (${{ matrix.python }}) flags: macOS,${{ matrix.python }} fail_ci_if_error: true @@ -385,7 +382,6 @@ jobs: - if: always() uses: codecov/codecov-action@v5 with: - directory: empty name: Alpine flags: Alpine,${{ steps.get-version.outputs.version }} fail_ci_if_error: true From b8f8339367a172e66d99ba84b835f5eadb798a73 Mon Sep 17 00:00:00 2001 From: A5rocks Date: Tue, 5 Aug 2025 10:01:06 +0900 Subject: [PATCH 4/4] Add an extra thing I missed --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e0434f7e78..bec87cfef0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -292,7 +292,7 @@ show_contexts = true skip_covered = false [tool.coverage.paths] -source = ['**/site-packages'] +source = ["src", "**/site-packages"] [tool.coverage.run] branch = true