From a0aa6a0a04a1b3109513c3e1939a973f19aa34a2 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Wed, 12 Apr 2023 16:50:26 +0200 Subject: [PATCH 1/5] Replace codecov with something simples for now The codecov package has been yanked from PyPI: https://community.codecov.com/t/codecov-yanked-from-pypi-all-versions/4259 --- .github/workflows/ci.yml | 52 +++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c58a1213..87802b1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,15 +92,18 @@ jobs: python-version: ${{ matrix.python.action }} - name: Install dependencies - run: python -m pip install --upgrade pip nox codecov coverage[toml] + run: python -m pip install --upgrade pip nox - uses: twisted/python-info-action@v1 - run: nox --python ${{ matrix.python.action }} -e ${{ matrix.task.nox }} -- --use-wheel dist/*.whl - - name: Codecov - run: | - codecov -n "GitHub Actions - ${{ matrix.task.name}} - ${{ matrix.os.name }} ${{ matrix.python.name }}" + - name: Upload coverage data + uses: actions/upload-artifact@v3 + with: + name: coverage-data + path: .coverage.* + if-no-files-found: ignore test-windows: @@ -133,15 +136,12 @@ jobs: python-version: ${{ matrix.python.action }} - name: Install dependencies - run: python -m pip install --upgrade pip nox codecov coverage[toml] + run: python -m pip install --upgrade pip nox - uses: twisted/python-info-action@v1 - run: nox --python ${{ matrix.python.action }} -e ${{ matrix.task.nox }} -- --use-wheel dist/*.whl - - name: Codecov - run: | - codecov -n "GitHub Actions - ${{ matrix.task.name}} - ${{ matrix.os.name }} ${{ matrix.python.name }}" check: name: ${{ matrix.task.name}} - ${{ matrix.python.name }} @@ -231,6 +231,41 @@ jobs: password: ${{ secrets.PYPI_TOKEN }} verbose: true + coverage: + name: Combine & check coverage. + needs: test-linux + runs-on: ubuntu-latest + + steps: + - uses: actions/setup-python@v4 + with: + # Use latest Python, so it understands all syntax. + python-version: 3.11 + + - run: python -Im pip install --upgrade coverage[toml] + + - uses: actions/download-artifact@v3 + with: + name: coverage-data + + - name: Combine coverage & fail if it's <100%. + run: | + python -Im coverage combine + python -Im coverage html --skip-covered --skip-empty + + # Report and write to summary. + python -Im coverage report | sed 's/^/ /' >> $GITHUB_STEP_SUMMARY + + # Report again and fail if under 100%. + python -Im coverage report --fail-under=100 + + - name: Upload HTML report if check failed. + uses: actions/upload-artifact@v3 + with: + name: html-report + path: htmlcov + if: ${{ failure() }} + # This is a meta-job to simplify PR CI enforcement configuration in GitHub. # Inside the GitHub config UI you only configure this job as required. # All the extra requirements are defined "as code" as part of the `needs` @@ -247,6 +282,7 @@ jobs: - build - test-linux - test-windows + - coverage - check - pypi-publish steps: From 9a0175f4ec22eb219a1911957febde10a01f0f9f Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Wed, 12 Apr 2023 16:56:00 +0200 Subject: [PATCH 2/5] No combining --- noxfile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index 607f89f9..f32539d2 100644 --- a/noxfile.py +++ b/noxfile.py @@ -37,8 +37,6 @@ def tests(session: nox.Session) -> None: if os.environ.get("CI") != "true": session.notify("coverage_report") - else: - session.run("coverage", "combine") @nox.session From b27fb03cce8863b42ef44017d86253494b7cf2b9 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Wed, 12 Apr 2023 16:59:01 +0200 Subject: [PATCH 3/5] Add news fragment --- src/towncrier/newsfragments/497.misc | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/towncrier/newsfragments/497.misc diff --git a/src/towncrier/newsfragments/497.misc b/src/towncrier/newsfragments/497.misc new file mode 100644 index 00000000..e69de29b From 9cd5fe4a052c7deaf3acdfd28aad1d52ecfad6e6 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Wed, 12 Apr 2023 17:01:10 +0200 Subject: [PATCH 4/5] Checkout --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 87802b1b..37e00628 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -237,6 +237,7 @@ jobs: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: # Use latest Python, so it understands all syntax. From 3d1b0d8a6387ab5c06f41cdfe63aaa66e3e2ccd6 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Wed, 12 Apr 2023 17:15:55 +0200 Subject: [PATCH 5/5] Add test for missing case --- src/towncrier/test/test_git.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/towncrier/test/test_git.py diff --git a/src/towncrier/test/test_git.py b/src/towncrier/test/test_git.py new file mode 100644 index 00000000..e4f807af --- /dev/null +++ b/src/towncrier/test/test_git.py @@ -0,0 +1,15 @@ +# Copyright (c) Amber Brown, 2015 +# See LICENSE for details. + + +from twisted.trial.unittest import TestCase + +from towncrier import _git + + +class TestGit(TestCase): + def test_empty_remove(self): + """ + If remove_files gets an empty list, it returns gracefully. + """ + _git.remove_files([])