add local ci

This commit is contained in:
Jev
2026-04-22 20:54:57 +02:00
parent b69481867b
commit 1f5661724e
4 changed files with 33 additions and 0 deletions
@@ -0,0 +1,9 @@
.venv
__pycache__
*.pyc
.mypy_cache
.ruff_cache
.pytest_cache
build
dist
*.egg-info
+9
View File
@@ -0,0 +1,9 @@
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
WORKDIR /app
COPY pyproject.toml uv.lock* ./
RUN uv sync --group dev --no-install-project
COPY . .
RUN uv sync --group dev
+1
View File
@@ -21,4 +21,5 @@ source init.sh
uv run invoke lint uv run invoke lint
uv run invoke test uv run invoke test
uv run invoke format uv run invoke format
uv run invoke ci # lint + test in Docker
``` ```
+14
View File
@@ -28,6 +28,20 @@ def test(c):
c.run("uv run pytest --cov=src --cov-report=term-missing") c.run("uv run pytest --cov=src --cov-report=term-missing")
@task
def ci(c):
"""Run lint and tests in a clean Docker container."""
image = "{{ cookiecutter.project_slug }}-ci"
c.run(f"docker build --network=host -t {image} .")
cmd = (
"uv run ruff check src tests && "
"uv run ruff format --check src tests && "
"uv run mypy src && "
"uv run pytest --cov=src --cov-report=term-missing"
)
c.run(f"docker run --rm {image} sh -c '{cmd}'")
@task @task
def clean(c): def clean(c):
"""Preview files to delete (safe mode).""" """Preview files to delete (safe mode)."""