Some checks failed
continuous-integration/drone/push Build encountered an error
add pipeline template to test it
56 lines
1.5 KiB
YAML
56 lines
1.5 KiB
YAML
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: python-ci
|
|
|
|
# Runs on pushes & PRs. Adjust branches as you like.
|
|
trigger:
|
|
event:
|
|
- push
|
|
- pull_request
|
|
|
|
steps:
|
|
# 1) Create a local .venv and install deps using uv
|
|
- name: deps
|
|
image: ghcr.io/astral-sh/uv:latest
|
|
environment:
|
|
UV_NO_SYNC_PROGRESS: "1"
|
|
commands:
|
|
- uv --version
|
|
# Pick your Python version once per project
|
|
- uv python install 3.12
|
|
# Create a project-local venv
|
|
- uv venv .venv
|
|
- . .venv/bin/activate
|
|
# Prefer uv sync if you maintain [tool.uv] with dev-deps; otherwise fall back
|
|
- |
|
|
if [ -f pyproject.toml ] && grep -q "\[tool\.uv\]" pyproject.toml; then
|
|
uv sync --all-extras --dev
|
|
else
|
|
uv pip install -U pip
|
|
# Editable install w/ dev extras if present
|
|
uv pip install -e ".[dev]" || true
|
|
# Fallback to requirements if you keep them
|
|
if [ -f requirements.txt ]; then uv pip install -r requirements.txt; fi
|
|
fi
|
|
# Test/lint tools
|
|
- uv pip install pytest pytest-cov mypy ruff
|
|
|
|
# 2) Lint & type-check
|
|
- name: lint-typecheck
|
|
image: ghcr.io/astral-sh/uv:latest
|
|
commands:
|
|
- . .venv/bin/activate
|
|
- ruff check .
|
|
# Tweak flags as your project matures
|
|
- mypy --ignore-missing-imports .
|
|
|
|
# 3) Run tests
|
|
- name: test
|
|
image: ghcr.io/astral-sh/uv:latest
|
|
commands:
|
|
- . .venv/bin/activate
|
|
- pytest -q --maxfail=1 --disable-warnings --cov --cov-report=term-missing
|
|
|
|
|