Skip to content

Commit

Permalink
Remove codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinche committed Jun 17, 2023
1 parent 65f86c4 commit e5d9e93
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 18 deletions.
66 changes: 56 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,85 @@ jobs:
tests:
name: "Python ${{ matrix.python-version }}"
runs-on: "ubuntu-latest"
env:
USING_COVERAGE: "3.7,3.8,3.9,3.10"

strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy-3.9"]

steps:
- uses: "actions/checkout@v3"

- uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"

- name: "Install dependencies"
run: |
set -xe
python -VV
python -m site
python -m pip install --upgrade pip wheel poetry==1.2.0
python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions
python -m pip install --upgrade tox tox-gh-actions
- name: "Run tox targets for ${{ matrix.python-version }}"
run: "python -m tox"

# We always use a modern Python version for combining coverage to prevent
# parsing errors in older versions for modern code.
- name: "Upload coverage data"
uses: "actions/upload-artifact@v3"
with:
name: "coverage-data"
path: ".coverage.*"
if-no-files-found: "ignore"

coverage:
name: "Combine & check coverage."
needs: "tests"
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v3"

- uses: "actions/setup-python@v4"
with:
python-version: "3.x"
cache: "pip"
python-version: "3.11"

- name: "Upload coverage to Codecov"
if: "contains(env.USING_COVERAGE, matrix.python-version)"
uses: "codecov/codecov-action@v1"
- run: "python -Im pip install --upgrade coverage[toml]"

- uses: "actions/download-artifact@v3"
with:
name: "coverage-data"

- name: "Combine coverage"
run: |
python -Im coverage combine
python -Im coverage html --skip-covered --skip-empty
python -Im coverage json
# Report and write to summary.
python -Im coverage report | sed 's/^/ /' >> $GITHUB_STEP_SUMMARY
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
echo "total=$TOTAL" >> $GITHUB_ENV
- name: "Upload HTML report."
uses: "actions/upload-artifact@v3"
with:
name: "html-report"
path: "htmlcov"

- name: "Make badge"
uses: "schneegans/dynamic-badges-action@v1.4.0"
with:
fail_ci_if_error: true
# GIST_TOKEN is a GitHub personal access token with scope "gist".
auth: ${{ secrets.GIST_TOKEN }}
gistID: 882f02e3df32136c847ba90d2688f06e
filename: covbadge.json
label: Coverage
message: ${{ env.total }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.total }}

package:
name: "Build & verify package"
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ aiofiles: file support for asyncio
.. image:: https://github.com/Tinche/aiofiles/actions/workflows/main.yml/badge.svg
:target: https://github.com/Tinche/aiofiles/actions

.. image:: https://codecov.io/gh/Tinche/aiofiles/branch/master/graph/badge.svg
:target: https://codecov.io/gh/Tinche/aiofiles
.. image:: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/Tinche/882f02e3df32136c847ba90d2688f06e/raw/covbadge.json
:target: https://github.com/python-attrs/cattrs/actions/workflows/main.yml

.. image:: https://img.shields.io/pypi/pyversions/aiofiles.svg
:target: https://github.com/Tinche/aiofiles
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ tox = "^3.25.1"
black = "^22.8.0"
flake8 = "^5.0.4"


[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.coverage.run]
parallel = true
source_pkgs = ["aiofiles"]
4 changes: 0 additions & 4 deletions test_requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ commands =
allowlist_externals = poetry
commands =
poetry install -v --no-root
coverage run --source aiofiles -m pytest tests
coverage run -m pytest tests {posargs}
passenv = CI

0 comments on commit e5d9e93

Please sign in to comment.