From 1ea9fb0eb806fd223d32a1621adad711954af800 Mon Sep 17 00:00:00 2001 From: Tom Most Date: Sun, 5 May 2024 21:58:06 -0700 Subject: [PATCH 1/5] Test with Python 3.10, 3.11, and 3.12 --- .github/workflows/tests.yaml | 2 +- setup.cfg | 3 +++ src/incremental/newsfragments/86.misc | 0 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 src/incremental/newsfragments/86.misc diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 76027af1..aecf9a48 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -34,7 +34,7 @@ jobs: # When updating the minimum Python version here, also update the # `python_requires` from `setup.cfg`. # Run on latest minor release of each major python version. - python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9] + python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12'] tox-env: ['tests'] include: diff --git a/setup.cfg b/setup.cfg index e6ffe515..44d0f4de 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,6 +16,9 @@ classifiers = Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 license = MIT description = "A small library that versions your Python projects." long_description = file: README.rst diff --git a/src/incremental/newsfragments/86.misc b/src/incremental/newsfragments/86.misc new file mode 100644 index 00000000..e69de29b From c236c0df978347cb1af623b9795de3f587ac3183 Mon Sep 17 00:00:00 2001 From: Tom Most Date: Sun, 5 May 2024 22:06:33 -0700 Subject: [PATCH 2/5] Fix the Tox config --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 97ae02a7..81f968e0 100644 --- a/tox.ini +++ b/tox.ini @@ -2,6 +2,7 @@ minversion = 3.23.0 requires = virtualenv >= 20.4.3 + tox < 4.0.0 tox-wheel >= 0.6.0 isolated_build = true envlist = @@ -38,6 +39,7 @@ commands = tests: coverage report tests: coverage html tests: coverage xml + mypy: mypy src From ff2ecdc4c20352113274e70a551d47d6975196b9 Mon Sep 17 00:00:00 2001 From: Tom Most Date: Sun, 5 May 2024 22:11:49 -0700 Subject: [PATCH 3/5] Drop Python 2.7 from the test matrix GitHub no longer supports it, so we can't keep it. --- .github/workflows/tests.yaml | 2 +- setup.cfg | 5 ----- src/incremental/86.removal | 1 + src/incremental/newsfragments/86.misc | 0 4 files changed, 2 insertions(+), 6 deletions(-) create mode 100644 src/incremental/86.removal delete mode 100644 src/incremental/newsfragments/86.misc diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index aecf9a48..314d2575 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -34,7 +34,7 @@ jobs: # When updating the minimum Python version here, also update the # `python_requires` from `setup.cfg`. # Run on latest minor release of each major python version. - python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12'] + python-version: [3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12'] tox-env: ['tests'] include: diff --git a/setup.cfg b/setup.cfg index 44d0f4de..b0de040e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,8 +7,6 @@ url = https://github.com/twisted/incremental classifiers = Intended Audience :: Developers License :: OSI Approved :: MIT License - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.4 Programming Language :: Python :: 3.5 @@ -50,9 +48,6 @@ mypy = %(scripts)s mypy==0.812 -[bdist_wheel] -universal = 1 - [flake8] max-line-length = 88 extend-ignore = diff --git a/src/incremental/86.removal b/src/incremental/86.removal new file mode 100644 index 00000000..48cdf750 --- /dev/null +++ b/src/incremental/86.removal @@ -0,0 +1 @@ +Support for Python 2.7 has been dropped for lack of test infrastructure. We no longer provide universal wheels. diff --git a/src/incremental/newsfragments/86.misc b/src/incremental/newsfragments/86.misc deleted file mode 100644 index e69de29b..00000000 From 337d732ad2c31650c622c7b7fef1ef230ae7ca1b Mon Sep 17 00:00:00 2001 From: Tom Most Date: Sun, 5 May 2024 22:33:57 -0700 Subject: [PATCH 4/5] Move code coverage to GHA Shamelessly ripped from twisted/twisted#11744. --- .github/workflows/tests.yaml | 72 ++++++++++++++++++++++++++++++++---- codecov.yaml | 50 ------------------------- 2 files changed, 65 insertions(+), 57 deletions(-) delete mode 100644 codecov.yaml diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 314d2575..ed3aa0f5 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -20,7 +20,6 @@ defaults: shell: bash - jobs: testing: runs-on: ubuntu-20.04 @@ -41,6 +40,7 @@ jobs: # Run non-python version specific jobs. - python-version: 3.9 tox-env: mypy,apidocs + skip-coverage: true steps: - uses: actions/checkout@v2 @@ -77,10 +77,68 @@ jobs: commit_message: Publish docs for ${{ github.sha }} publish_dir: ./website - - uses: codecov/codecov-action@v1 - if: always() && matrix.tox-env == 'tests' + - name: Prepare coverage results + if: ${{ !cancelled() && !matrix.skip-coverage }} + run: | + # Assign the coverage file a name unique to this job so that the + # uploads don't collide. + mv .coverage ".coverage-job-${{ matrix.python-version }}-${{ matrix.job-name }}" + + - name: Store coverage file + if: ${{ !cancelled() && !matrix.skip-coverage }} + uses: actions/upload-artifact@v3 + with: + name: coverage + path: .coverage-job-* + + coverage-report: + name: Coverage report + runs-on: ubuntu-latest + # We want to always run the coverage, even when the + # tests failed. + if: always() + needs: + - testing # Wait for test jobs. + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade coverage[toml] diff_cover + + - name: Download coverage reports + uses: actions/download-artifact@v3 + with: + name: coverage + path: . + + - name: Prepare coverage + run: | + coverage combine .coverage-job-* + # XML is needed for the diff-cover. + coverage xml + + - name: Report coverage + run: | + # Report for the job log. + coverage report --skip-covered --skip-empty >> $GITHUB_STEP_SUMMARY + diff-cover --markdown-report coverage-report.md --compare-branch origin/trunk coverage.xml + + - name: Enforce diff coverage + run: | + diff-cover --fail-under=100 --compare-branch origin/trunk coverage.xml + + - name: Generate HTML report on failure + if: ${{ failure() }} + run: | + coverage html --skip-covered --skip-empty + + - name: Upload HTML report on failure + if: ${{ failure() }} + uses: actions/upload-artifact@v3 with: - files: coverage.xml - name: lnx-${{ matrix.python-version }}-${{ matrix.tox-env }} - fail_ci_if_error: true - functionalities: gcov,search + name: html-report + path: htmlcov diff --git a/codecov.yaml b/codecov.yaml deleted file mode 100644 index 0d16c8dc..00000000 --- a/codecov.yaml +++ /dev/null @@ -1,50 +0,0 @@ -# -# For documentation: https://docs.codecov.io/docs/codecovyml-reference -# Incremental settings: https://codecov.io/gh/twisted/incremental/settings/yaml -# -# We want 100% coverage for new patches to make sure we are always increasing -# the coverage. -# -codecov: - require_ci_to_pass: yes - notify: - wait_for_ci: yes - -coverage: - precision: 2 - round: down - status: - patch: - default: - # New code should have 100% CI coverage as the minimum - # quality assurance measurement. - # If there is a good reason for new code not to have coverage, - # add inline pragma comments. - target: 100% - project: - default: - # Temporary allow for a bit of slack in overall code coverage due to - # swinging coverage that is not triggered by changes in a PR. - # See: https://twistedmatrix.com/trac/ticket/10170 - threshold: 0.02% - tests: - # Make sure we run each test at least once. - # If we don't have 100% coverage for tests, it meant that some - # tests are always skipped. - target: 100% - paths: - - "src/incremental/tests/*" - - "tests/*" - - -# See https://docs.codecov.io/docs/pull-request-comments -comment: - layout: "header, diff, files" - behavior: default - require_changes: true # if true: only post the comment if coverage changes - - -# See https://docs.codecov.io/docs/github-checks -github_checks: - # We want codecov to send inline PR comments for missing coverage. - annotations: true From 9ddc545c5301440e6f23c9da2fb247368a8f1f3b Mon Sep 17 00:00:00 2001 From: Tom Most Date: Sun, 5 May 2024 22:37:00 -0700 Subject: [PATCH 5/5] Better scope the GHA token --- .github/workflows/tests.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ed3aa0f5..b3f5d915 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -15,6 +15,10 @@ on: branches: [ trunk ] +permissions: + contents: read + + defaults: run: shell: bash