From 7270d544a54a09b135919cf818c0b3a2e6d1fc31 Mon Sep 17 00:00:00 2001 From: Sergey Vanyushkin Date: Sat, 9 May 2026 19:51:15 +0300 Subject: [PATCH] ci: setup Woodpecker CI pipeline with parallel jobs, volume cache, and E2E support --- .woodpecker/lint.yaml | 14 ------- .woodpecker/pipeline.yml | 89 ++++++++++++++++++++++++++++++++++++++++ .woodpecker/test.yaml | 11 ----- .woodpecker/type.yaml | 11 ----- pyproject.toml | 6 +-- 5 files changed, 90 insertions(+), 41 deletions(-) delete mode 100644 .woodpecker/lint.yaml create mode 100644 .woodpecker/pipeline.yml delete mode 100644 .woodpecker/test.yaml delete mode 100644 .woodpecker/type.yaml diff --git a/.woodpecker/lint.yaml b/.woodpecker/lint.yaml deleted file mode 100644 index a99960e..0000000 --- a/.woodpecker/lint.yaml +++ /dev/null @@ -1,14 +0,0 @@ -when: - - event: [push, pull_request] - branch: dev - -steps: - - name: lint - image: python:3.13 - commands: - - pip install uv - - uv sync --no-dev --only-group lints - - uv run ruff check . - - uv run ruff format --check . - - uv run isort --check-only . - diff --git a/.woodpecker/pipeline.yml b/.woodpecker/pipeline.yml new file mode 100644 index 0000000..0dda2c6 --- /dev/null +++ b/.woodpecker/pipeline.yml @@ -0,0 +1,89 @@ +when: + event: [push, pull_request] + branch: [dev, main, master] + +steps: + - name: deps + image: python:3.13 + volumes: + - /tmp/uv-cache:/root/.cache/uv + environment: + UV_CACHE_DIR: /root/.cache/uv + UV_LINK_MODE: copy + UV_PYTHON: "3.13" + commands: + - pip install uv + - cd .. + - | + cat > pyproject.toml << 'EOF' + [project] + name = "pyaqa" + version = "0.1.0" + requires-python = ">=3.13" + dependencies = [] + + [tool.uv.workspace] + members = ["blog.pyaqa.ru", "pytfm"] + EOF + - git clone https://git.pyaqa.ru/pi3c/pytfm.git + - cd $CI_WORKSPACE + - rm -rf .venv + - uv sync --group lints --group tests --group types --group dev + + - name: lint + image: python:3.13 + volumes: + - /tmp/uv-cache:/root/.cache/uv + environment: + UV_CACHE_DIR: /root/.cache/uv + UV_LINK_MODE: copy + UV_PYTHON: "3.13" + depends_on: [deps] + commands: + - pip install uv + - uv run --no-sync ruff check . + - uv run --no-sync ruff format --check . + - uv run --no-sync isort --check-only . + + - name: type + image: python:3.13 + volumes: + - /tmp/uv-cache:/root/.cache/uv + environment: + UV_CACHE_DIR: /root/.cache/uv + UV_LINK_MODE: copy + UV_PYTHON: "3.13" + depends_on: [deps] + commands: + - pip install uv + - uv run --no-sync mypy . + + - name: test-unit + image: python:3.13 + volumes: + - /tmp/uv-cache:/root/.cache/uv + environment: + UV_CACHE_DIR: /root/.cache/uv + UV_LINK_MODE: copy + UV_PYTHON: "3.13" + depends_on: [deps] + commands: + - pip install uv + - uv run --no-sync pytest tests/unit/ + + - name: test-e2e + image: python:3.13 + volumes: + - /tmp/uv-cache:/root/.cache/uv + environment: + UV_CACHE_DIR: /root/.cache/uv + UV_LINK_MODE: copy + UV_PYTHON: "3.13" + depends_on: [deps] + commands: + - pip install uv + - apt-get update && apt-get install -y libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libasound2 + - uv run --no-sync playwright install chromium + - uv run --no-sync blog & + - sleep 5 + - uv run --no-sync pytest tests/e2e/ -v --no-cov diff --git a/.woodpecker/test.yaml b/.woodpecker/test.yaml deleted file mode 100644 index 71557b6..0000000 --- a/.woodpecker/test.yaml +++ /dev/null @@ -1,11 +0,0 @@ -when: - - event: [push, pull_request] - branch: dev - -steps: - - name: test - image: python:3.13 - commands: - - pip install uv - - uv sync --no-dev --group tests - - uv run pytest --cov=app --cov-fail-under=70 --cov-report=term-missing diff --git a/.woodpecker/type.yaml b/.woodpecker/type.yaml deleted file mode 100644 index c230690..0000000 --- a/.woodpecker/type.yaml +++ /dev/null @@ -1,11 +0,0 @@ -when: - - event: [push, pull_request] - branch: dev - -steps: - - name: type - image: python:3.13 - commands: - - pip install uv - - uv sync --no-dev --only-group types - - uv run mypy . diff --git a/pyproject.toml b/pyproject.toml index 0bb543e..4f51185 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,14 +48,11 @@ tests = [ "pytfm", ] lints = [ - "black>=23.7.0", "ruff>=0.15.11", "isort>=8.0.1", ] types = [ - "mimesis>=19.1.0", "mypy>=1.20.1", - "pytfm", ] [project.scripts] @@ -66,11 +63,10 @@ pytfm = { workspace = true } [tool.pytest.ini_options] asyncio_mode = "auto" -addopts = "--cov=app --cov-report=term-missing --cov-report=html" +addopts = "--cov=app --cov-fail-under=70 --cov-report=term-missing --cov-report=html" pythonpath = "." testpaths = "tests" xfail_strict = true -exclude = ["tests/e2e"] markers = [ "e2e: End-to-end tests requiring running server", ]