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
31 changes: 9 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ jobs:
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write
contents: read

steps:
- name: Checkout
Expand All @@ -45,25 +44,13 @@ jobs:

- name: Run pytest
run: |
set -o pipefail
uv run nox -s test -- --junitxml pytest.xml | tee pytest-coverage.txt
uv run nox -s test -- --cov_report xml

- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@v1
- name: Upload results to Codecov
uses: codecov/codecov-action@v5
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml

- name: Creating coverage folder
run: mkdir -p coverage

- name: Coverage Badge
uses: tj-actions/coverage-badge-py@v2
with:
output: coverage/coverage.svg

- name: Publish coverage report to coverage-badge branch
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: coverage-badge
folder: coverage
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
2 changes: 1 addition & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"ipython",
"isort",
"jaxtyping",
"junitxml",
"kevinrose",
"kwargs",
"levelname",
Expand Down Expand Up @@ -108,6 +107,7 @@
"toolsai",
"typer",
"uline",
"unittests",
"usecases",
"usefixtures",
"usermod",
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ uv run nox -s test
uv run pytest tests/tools/test__logger.py

# Run with JUnit XML output for CI
uv run nox -s test -- --junitxml=results.xml
uv run nox -s test -- --cov_report=xml

# Run pytest directly (bypasses nox)
uv run pytest
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[![Docker](https://github.com/a5chin/python-uv/actions/workflows/docker.yml/badge.svg)](https://github.com/a5chin/python-uv/actions/workflows/docker.yml)
[![Format](https://github.com/a5chin/python-uv/actions/workflows/format.yml/badge.svg)](https://github.com/a5chin/python-uv/actions/workflows/format.yml)
[![Lint](https://github.com/a5chin/python-uv/actions/workflows/lint.yml/badge.svg)](https://github.com/a5chin/python-uv/actions/workflows/lint.yml)
[![Test](https://github.com/a5chin/python-uv/actions/workflows/test.yml/badge.svg)](https://github.com/a5chin/python-uv/actions/workflows/test.yml)
[![codecov](https://codecov.io/github/a5chin/python-uv/graph/badge.svg?token=M9JIB8T6R4)](https://codecov.io/github/a5chin/python-uv)

</div>

Expand Down Expand Up @@ -164,7 +164,7 @@ uv run nox -s lint -- --ruff
uv run nox -s test

# Run tests with JUnit XML output (for CI)
uv run nox -s test -- --junitxml=results.xml
uv run nox -s test -- --cov_report=xml
```

You can also run tools directly:
Expand Down Expand Up @@ -338,17 +338,17 @@ Automated workflows ensure code quality and consistency. All workflows run on pu

**Available workflows in `.github/workflows/`:**

| Workflow | Purpose | Tools Used |
|----------|---------|-----------|
| `docker.yml` | Validate Docker build | Docker |
| `devcontainer.yml` | Validate Dev Container configuration | devcontainer CLI |
| `format.yml` | Check code formatting | Ruff |
| `labeler.yml` | Add label in GitHub | GitHub |
| `lint.yml` | Run static analysis | Ruff, ty |
| `test.yml` | Run test suite with coverage | pytest, coverage |
| `gh-deploy.yml` | Deploy documentation to GitHub Pages | MkDocs |
| `pr-agent.yml` | Automated PR reviews | Qodo AI PR Agent |
| `publish-devcontainer.yml` | Publish Dev Container image | Docker, GHCR |
| Workflow | Purpose | Tools Used |
| -------------------------- | ------------------------------------ | ---------------- |
| `docker.yml` | Validate Docker build | Docker |
| `devcontainer.yml` | Validate Dev Container configuration | devcontainer CLI |
| `format.yml` | Check code formatting | Ruff |
| `labeler.yml` | Add label in GitHub | GitHub |
| `lint.yml` | Run static analysis | Ruff, ty |
| `test.yml` | Run test suite with coverage | pytest, coverage |
| `gh-deploy.yml` | Deploy documentation to GitHub Pages | MkDocs |
| `pr-agent.yml` | Automated PR reviews | Qodo AI PR Agent |
| `publish-devcontainer.yml` | Publish Dev Container image | Docker, GHCR |

## 🎨 VSCode Configuration

Expand Down
29 changes: 29 additions & 0 deletions codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "50...75"

status:
project:
default:
target: auto
threshold: 0%
if_ci_failed: error
patch:
default:
target: 75%

comment:
layout: "reach, diff, flags, files, header, footer"
behavior: default
require_changes: false
require_head: false
require_base: false

ignore:
- "tests/*"
- "noxfile.py"
- "**/__init__.py"
2 changes: 1 addition & 1 deletion docs/guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ uv run nox -s lint -- --ty # ty only
uv run nox -s test

# Run tests with JUnit XML output (for CI)
uv run nox -s test -- --junitxml=results.xml
uv run nox -s test -- --cov_report=xml
```

### Why nox?
Expand Down
8 changes: 4 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CLIArgs(
):
"""CLIArgs is a class that extends BaseSettings to handle command line arguments."""

junitxml: str = ""
cov_report: str = ""
ruff: bool = False
sqlfluff: bool = False
ty: bool = False
Expand Down Expand Up @@ -101,9 +101,9 @@ def test(session: nox.Session) -> None:
"""
args = CLIArgs.parse(session.posargs)

command = ["uv", "run", "pytest"]
if args.junitxml:
command.append(f"--junitxml={args.junitxml}")
command = ["uv", "run", "pytest", "--cov", "--cov-branch"]
if args.cov_report:
command.append(f"--cov-report={args.cov_report}")

session.run(*command)

Expand Down
Loading