From 17af03b4c3d9efcd65daa0e369c470cf27f5d825 Mon Sep 17 00:00:00 2001 From: jakkdl Date: Tue, 17 Dec 2024 10:59:42 +0100 Subject: [PATCH 1/6] remove erronously configured codecov flags --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f302cbaa2..ca13c6e33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,7 +87,6 @@ jobs: directory: empty token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46 name: Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }}) - flags: Windows,${{ matrix.python }} Ubuntu: name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})' @@ -137,7 +136,6 @@ jobs: directory: empty token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46 name: Ubuntu (${{ matrix.python }}${{ matrix.extra_name }}) - flags: Ubuntu,${{ matrix.python }} macOS: name: 'macOS (${{ matrix.python }})' @@ -173,7 +171,6 @@ jobs: directory: empty token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46 name: macOS (${{ matrix.python }}) - flags: macOS,${{ matrix.python }} # run CI on a musl linux Alpine: @@ -199,7 +196,6 @@ jobs: directory: empty token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46 name: Alpine - flags: Alpine,3.12 Cython: name: "Cython" From 02a84063923f4700cb7f68b487412ab4a456d9bb Mon Sep 17 00:00:00 2001 From: jakkdl Date: Tue, 17 Dec 2024 11:10:51 +0100 Subject: [PATCH 2/6] add .codecov.yml --- .codecov.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..43cfc2420 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,25 @@ +# -- repository yaml -- + +# Explicitly wait for all jobs to finish, as wait_for_ci prematurely triggers. +# See https://github.com/python-trio/trio/issues/2689 +codecov: + notify: + # This number needs to be changed whenever the number of runs in CI is changed. + # Another option is codecov-cli: https://github.com/codecov/codecov-cli#send-notifications + after_n_builds: 78 + wait_for_ci: false + notify_error: true # if uploads fail, replace cov comment with a comment with errors. + require_ci_to_pass: false + +# only post PR comment if coverage changes +comment: + require_changes: true + +coverage: + # required range + range: 99.6..100 + status: + # require patches to be 100% + patch: + default: + target: 100% From d418dc2d61fd21003536f082edeec34692fb4bf7 Mon Sep 17 00:00:00 2001 From: jakkdl Date: Tue, 17 Dec 2024 11:57:03 +0100 Subject: [PATCH 3/6] move token to yaml file, set fail_ci_if_error --- .codecov.yml | 4 ++++ .github/workflows/ci.yml | 9 +++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 43cfc2420..350707e08 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -11,6 +11,10 @@ codecov: notify_error: true # if uploads fail, replace cov comment with a comment with errors. require_ci_to_pass: false + # Publicly exposing the token has some small risks from mistakes or malicious actors. + # See https://docs.codecov.com/docs/codecov-tokens for correctly configuring it. + token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46 + # only post PR comment if coverage changes comment: require_changes: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca13c6e33..40425d5c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,8 +85,9 @@ jobs: uses: codecov/codecov-action@v3 with: directory: empty - token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46 name: Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }}) + # this option cannot be set in .codecov.yml + fail_ci_if_error: true Ubuntu: name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})' @@ -134,8 +135,8 @@ jobs: uses: codecov/codecov-action@v3 with: directory: empty - token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46 name: Ubuntu (${{ matrix.python }}${{ matrix.extra_name }}) + fail_ci_if_error: true macOS: name: 'macOS (${{ matrix.python }})' @@ -169,8 +170,8 @@ jobs: uses: codecov/codecov-action@v3 with: directory: empty - token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46 name: macOS (${{ matrix.python }}) + fail_ci_if_error: true # run CI on a musl linux Alpine: @@ -194,8 +195,8 @@ jobs: uses: codecov/codecov-action@v3 with: directory: empty - token: 87cefb17-c44b-4f2f-8b30-1fff5769ce46 name: Alpine + fail_ci_if_error: true Cython: name: "Cython" From decfb73fdbba72e7cc704aa089965788f14b6b36 Mon Sep 17 00:00:00 2001 From: jakkdl Date: Tue, 17 Dec 2024 14:44:20 +0100 Subject: [PATCH 4/6] restore flags, make alpine python flag dynamic --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40425d5c7..56c7e4c11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,6 +86,9 @@ jobs: 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 + flags: Windows,${{ matrix.python }} # this option cannot be set in .codecov.yml fail_ci_if_error: true @@ -136,6 +139,7 @@ jobs: with: directory: empty name: Ubuntu (${{ matrix.python }}${{ matrix.extra_name }}) + flags: Ubuntu,${{ matrix.python }} fail_ci_if_error: true macOS: @@ -171,6 +175,7 @@ jobs: with: directory: empty name: macOS (${{ matrix.python }}) + flags: macOS,${{ matrix.python }} fail_ci_if_error: true # run CI on a musl linux @@ -191,11 +196,15 @@ jobs: run: python -m venv .venv - name: Run tests run: source .venv/bin/activate && ./ci.sh + - name: Get Python version for codecov flag + id: get-version + run: echo "version=$(python -V | cut -d' ' -f2 | cut -d'.' -f1,2)" > $GITHUB_OUTPUT - if: always() uses: codecov/codecov-action@v3 with: directory: empty name: Alpine + flags: Alpine,${{ steps.get-version.outputs.version }} fail_ci_if_error: true Cython: From 2fd7fcfacc361c1e5b331a2a31e5d6aec959dbd0 Mon Sep 17 00:00:00 2001 From: jakkdl Date: Tue, 17 Dec 2024 14:55:00 +0100 Subject: [PATCH 5/6] skip codecov if check-formatting is set --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56c7e4c11..93f7be9e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -134,7 +134,7 @@ jobs: env: CHECK_FORMATTING: '${{ matrix.check_formatting }}' NO_TEST_REQUIREMENTS: '${{ matrix.no_test_requirements }}' - - if: always() + - if: ${{ always() && matrix.check_formatting != '1' }} uses: codecov/codecov-action@v3 with: directory: empty From a7a2ff9c6e6ea2fc0168e0ada2174bf8fd065f77 Mon Sep 17 00:00:00 2001 From: John Litborn <11260241+jakkdl@users.noreply.github.com> Date: Tue, 17 Dec 2024 19:58:43 +0100 Subject: [PATCH 6/6] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) --- .codecov.yml | 2 +- .github/workflows/ci.yml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 350707e08..c4b9b096c 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -6,7 +6,7 @@ codecov: notify: # This number needs to be changed whenever the number of runs in CI is changed. # Another option is codecov-cli: https://github.com/codecov/codecov-cli#send-notifications - after_n_builds: 78 + after_n_builds: 27 wait_for_ci: false notify_error: true # if uploads fail, replace cov comment with a comment with errors. require_ci_to_pass: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93f7be9e3..cb00ff85b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -134,7 +134,9 @@ jobs: env: CHECK_FORMATTING: '${{ matrix.check_formatting }}' NO_TEST_REQUIREMENTS: '${{ matrix.no_test_requirements }}' - - if: ${{ always() && matrix.check_formatting != '1' }} + - if: >- + always() + && matrix.check_formatting != '1' uses: codecov/codecov-action@v3 with: directory: empty @@ -198,7 +200,7 @@ jobs: run: source .venv/bin/activate && ./ci.sh - name: Get Python version for codecov flag id: get-version - run: echo "version=$(python -V | cut -d' ' -f2 | cut -d'.' -f1,2)" > $GITHUB_OUTPUT + run: echo "version=$(python -V | cut -d' ' -f2 | cut -d'.' -f1,2)" >> "${GITHUB_OUTPUT}" - if: always() uses: codecov/codecov-action@v3 with: