Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,30 @@ jobs:
run: python -m pip install -e ".[dev]"

- name: Run tests
run: python -m pytest tests/ -v
run: python -m pytest tests/ -v --cov --cov-report=term --cov-report=json

# Coverage badge: the percentage is written to a gist that shields.io
# renders in README. Only from main and from a single matrix entry so
# PRs and duplicate uploads never overwrite the number.
- name: Read coverage percentage
if: github.ref == 'refs/heads/main' && matrix.python-version == '3.12'
id: coverage
run: |
percent=$(python -c 'import json; print(round(json.load(open("coverage.json"))["totals"]["percent_covered"]))')
echo "percent=$percent" >> "$GITHUB_OUTPUT"

- name: Update coverage badge
if: github.ref == 'refs/heads/main' && matrix.python-version == '3.12'
uses: schneegans/dynamic-badges-action@v1.9.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 77b084ed0d46c740183f89ec66af8a95
filename: python-sdk-coverage.json
label: coverage
message: ${{ steps.coverage.outputs.percent }}%
valColorRange: ${{ steps.coverage.outputs.percent }}
minColorRange: 50
maxColorRange: 90

- name: Verify package builds
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ ENV/
# Testing
.pytest_cache/
.coverage
coverage.json
coverage.xml
htmlcov/

# Type checkers
Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dev = [
"ruff>=0.6",
"mypy>=1.10",
"types-requests>=2.28",
"pytest-cov>=4",
]

[project.urls]
Expand All @@ -67,6 +68,13 @@ captcha_solver_api = ["py.typed"]
[tool.pytest.ini_options]
asyncio_mode = "auto"

[tool.coverage.run]
source = ["captcha_solver_api"]
branch = true

[tool.coverage.report]
show_missing = true

[tool.mypy]
# mypy 2.x cannot target 3.9; 3.10 is the lowest it accepts. Runtime
# compatibility with 3.9 is still covered by the CI test matrix.
Expand Down
Loading