This commit is contained in:
37
.drone.yml
37
.drone.yml
@@ -3,53 +3,46 @@ kind: pipeline
|
|||||||
type: docker
|
type: docker
|
||||||
name: python-ci
|
name: python-ci
|
||||||
|
|
||||||
# Runs on pushes & PRs. Adjust branches as you like.
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event: [ push, pull_request ]
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# 1) Create a local .venv and install deps using uv
|
- name: setup+deps
|
||||||
- name: deps
|
image: python:3.12-slim
|
||||||
image: ghcr.io/astral-sh/uv:latest
|
|
||||||
environment:
|
environment:
|
||||||
UV_NO_SYNC_PROGRESS: "1"
|
UV_NO_SYNC_PROGRESS: "1"
|
||||||
commands:
|
commands:
|
||||||
- uv --version
|
- python -V
|
||||||
# Pick your Python version once per project
|
- apt-get update && apt-get install -y curl ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||||
- uv python install 3.12
|
- curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
# Create a project-local venv
|
- 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
|
- uv venv .venv
|
||||||
- . .venv/bin/activate
|
- . .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
|
if [ -f pyproject.toml ] && grep -q "\[tool\.uv\]" pyproject.toml; then
|
||||||
uv sync --all-extras --dev
|
uv sync --all-extras --dev
|
||||||
else
|
else
|
||||||
uv pip install -U pip
|
|
||||||
# Editable install w/ dev extras if present
|
|
||||||
uv pip install -e ".[dev]" || true
|
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
|
if [ -f requirements.txt ]; then uv pip install -r requirements.txt; fi
|
||||||
fi
|
fi
|
||||||
# Test/lint tools
|
|
||||||
- uv pip install pytest pytest-cov mypy ruff
|
- uv pip install pytest pytest-cov mypy ruff
|
||||||
|
|
||||||
# 2) Lint & type-check
|
|
||||||
- name: lint-typecheck
|
- name: lint-typecheck
|
||||||
image: ghcr.io/astral-sh/uv:latest
|
image: python:3.12-slim
|
||||||
commands:
|
commands:
|
||||||
|
- export PATH="$HOME/.local/bin:$PATH"
|
||||||
- . .venv/bin/activate
|
- . .venv/bin/activate
|
||||||
- ruff check .
|
- ruff check .
|
||||||
# Tweak flags as your project matures
|
|
||||||
- mypy --ignore-missing-imports .
|
- mypy --ignore-missing-imports .
|
||||||
|
|
||||||
# 3) Run tests
|
|
||||||
- name: test
|
- name: test
|
||||||
image: ghcr.io/astral-sh/uv:latest
|
image: python:3.12-slim
|
||||||
commands:
|
commands:
|
||||||
|
- export PATH="$HOME/.local/bin:$PATH"
|
||||||
- . .venv/bin/activate
|
- . .venv/bin/activate
|
||||||
- pytest -q --maxfail=1 --disable-warnings --cov --cov-report=term-missing
|
- pytest -q --maxfail=1 --disable-warnings --cov --cov-report=term-missing
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user