add pipeline template to test it
This commit is contained in:
55
.drone.yml
55
.drone.yml
@@ -0,0 +1,55 @@
|
||||
---
|
||||
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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user