Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace codecov with something simpler for now to fix CI #497

Merged
merged 5 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 45 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -231,6 +231,42 @@ jobs:
password: ${{ secrets.PYPI_TOKEN }}
verbose: true

coverage:
name: Combine & check coverage.
needs: test-linux
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- 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`
Expand All @@ -247,6 +283,7 @@ jobs:
- build
- test-linux
- test-windows
- coverage
- check
- pypi-publish
steps:
Expand Down
2 changes: 0 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Empty file.
15 changes: 15 additions & 0 deletions src/towncrier/test/test_git.py
Original file line number Diff line number Diff line change
@@ -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([])