Skip to content

Commit

Permalink
chore: use in-house coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
percevalw committed Sep 13, 2024
1 parent f25de29 commit 360e410
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 24 deletions.
59 changes: 43 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,51 @@ jobs:
python-version: ["3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- name: Cache downloaded resources
uses: actions/cache@v3
with:
path: ~/.data/
key: resources
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- uses: hynek/setup-cached-uv@v2
with:
cache-suffix: -tests-${{ matrix.python-version }}-${{ env.WEEK }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e '.[dev]'
uv venv
source .venv/bin/activate
uv pip install '.[dev]'
- name: Test with Pytest on Python ${{ matrix.python-version }}
run: |
source .venv/bin/activate
pip install pydantic -U
python -m pytest --cov confit --cov-report xml:coverage_pydantic_v2.xml
coverage run -m pytest
- name: Test with Pytest on Python ${{ matrix.python-version }} with pydantic v1
run: |
source .venv/bin/activate
pip install pydantic==1.10.7
python -m pytest --cov confit --cov-report xml:coverage_pydantic_v1.xml
coverage run -m pytest
if: matrix.python-version == '3.9'

- name: Upload coverage
uses: codecov/codecov-action@v2
if: matrix.python-version == '3.9'
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ matrix.python-version }}
path: .coverage.*
if-no-files-found: ignore
include-hidden-files: true

coverage:
name: Coverage
needs: Pytest
uses: aphp/foldedtensor/.github/workflows/coverage.yml@main
with:
base-branch: main
coverage-data-pattern: coverage-data-*
coverage-report: coverage.txt
coverage-badge: coverage.svg
coverage-branch: coverage

Documentation:
runs-on: ubuntu-latest
Expand All @@ -71,10 +87,14 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- uses: hynek/setup-cached-uv@v2
with:
cache-suffix: -docs-${{ matrix.python-version }}-${{ env.WEEK }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[dev]'
uv venv
source .venv/bin/activate
uv pip install '.[dev]'
- name: Build documentation
run: |
mkdocs build --clean
Expand All @@ -87,9 +107,16 @@ jobs:
python-version: ["3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- uses: hynek/setup-cached-uv@v2
with:
cache-suffix: -tests-${{ matrix.python-version }}-${{ env.WEEK }}
- name: Install library
run: |
pip install .
uv venv
source .venv/bin/activate
uv pip install .
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Tests](https://img.shields.io/github/actions/workflow/status/aphp/confit/tests.yml?branch=main&label=tests&style=flat-square)
[![Documentation](https://img.shields.io/github/actions/workflow/status/aphp/confit/documentation.yml?branch=main&label=docs&style=flat-square)](https://aphp.github.io/confit/latest/)
[![PyPI](https://img.shields.io/pypi/v/confit?color=blue&style=flat-square)](https://pypi.org/project/confit/)
[![Codecov](https://img.shields.io/codecov/c/github/aphp/confit?logo=codecov&style=flat-square)](https://codecov.io/gh/aphp/confit)
[![Coverage](https://raw.githubusercontent.com/aphp/confit/coverage/coverage.svg)](https://raw.githubusercontent.com/aphp/confit/coverage/coverage.txt)


# Confit
Expand Down
20 changes: 13 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ dev = [
"numpy",
]

[tool.setuptools.dynamic]
version = { attr = "confit.__version__" }
[tool.hatch.version]
path = "confit/__init__.py"

[tool.interrogate]
ignore-init-method = false
Expand All @@ -65,24 +65,30 @@ color = true
omit-covered-files = false

[tool.coverage.report]
precision = 2
include = ["confit/*"]
omit = [
"confit/autoreload.py",
"tests/*",
]
exclude_also = [
"def __repr__",
"if __name__ == .__main__.:",
"@overload",
"pragma: no cover",
"raise .*Error",
"raise .*Exception",
"warn\\(",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
"Span.set_extension.*",
"Doc.set_extension.*",
"Token.set_extension.*",
]

[tool.coverage.run]
include = ["confit/*"]
concurrency = ["multiprocessing"]
parallel = true

[tool.pytest.ini_options]
testpaths = [
"tests",
Expand Down Expand Up @@ -117,5 +123,5 @@ known-third-party = ["build"]
plugins = "pydantic.mypy"

[build-system]
requires = ["setuptools", "wheel"]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

0 comments on commit 360e410

Please sign in to comment.