This commit is contained in:
37
.drone.yml
37
.drone.yml
@@ -3,53 +3,46 @@ kind: pipeline
|
||||
type: docker
|
||||
name: python-ci
|
||||
|
||||
# Runs on pushes & PRs. Adjust branches as you like.
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
event: [ push, pull_request ]
|
||||
|
||||
steps:
|
||||
# 1) Create a local .venv and install deps using uv
|
||||
- name: deps
|
||||
image: ghcr.io/astral-sh/uv:latest
|
||||
- name: setup+deps
|
||||
image: python:3.12-slim
|
||||
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
|
||||
- python -V
|
||||
- apt-get update && apt-get install -y curl ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||
- curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
- export PATH="$HOME/.local/bin:$PATH"
|
||||
# pick python version (use .python-version if present, else 3.12)
|
||||
- PYVER="$( [ -f .python-version ] && cat .python-version || echo 3.12 )"
|
||||
- uv python install "$PYVER"
|
||||
- uv venv .venv
|
||||
- . .venv/bin/activate
|
||||
# Prefer uv sync if you maintain [tool.uv] with dev-deps; otherwise fall back
|
||||
# install project + dev tools
|
||||
- |
|
||||
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
|
||||
image: python:3.12-slim
|
||||
commands:
|
||||
- export PATH="$HOME/.local/bin:$PATH"
|
||||
- . .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
|
||||
image: python:3.12-slim
|
||||
commands:
|
||||
- export PATH="$HOME/.local/bin:$PATH"
|
||||
- . .venv/bin/activate
|
||||
- pytest -q --maxfail=1 --disable-warnings --cov --cov-report=term-missing
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user