diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..0d68810 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,44 @@ +--- +# Homelab CI — Python lane + secret scan. Lint and tests are HARD gates. +name: CI + +on: + push: + branches: [master] + pull_request: + types: [opened, synchronize, reopened] + +jobs: + python-ci: + runs-on: [homelab, self-hosted, linux, python] + container: + image: node:20-bookworm + steps: + - uses: actions/checkout@v4 + + - name: Install Python tooling + run: | + apt-get update -qq + DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \ + python3 python3-pip python3-venv \ + tesseract-ocr libgl1 libglib2.0-0 + python3 -m pip install --upgrade pip --break-system-packages + pip install -r requirements.txt --break-system-packages + pip install pytest ruff --break-system-packages + + - name: Ruff lint (hard gate) + run: ruff check . + + - name: Pytest (hard gate) + run: pytest -q + + secret-scan: + runs-on: [homelab, self-hosted, linux, heavy] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Gitleaks + run: | + docker run --rm -v "$PWD:/repo" ghcr.io/gitleaks/gitleaks:latest \ + detect --source /repo --no-banner --redact diff --git a/paperpod/vision/document.py b/paperpod/vision/document.py index 1370ac5..e4c28d1 100644 --- a/paperpod/vision/document.py +++ b/paperpod/vision/document.py @@ -130,7 +130,6 @@ def detect_document( resolution for a full-quality perspective warp. """ h, w = image_bgr.shape[:2] - frame_area = float(h * w) scale = detect_width / w if w > detect_width else 1.0 small = ( diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..dcd9132 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,4 @@ +line-length = 120 + +[lint] +select = ["E4", "E7", "E9", "F", "I"] diff --git a/tests/test_pdf_build.py b/tests/test_pdf_build.py index 0e660ef..a0428b1 100644 --- a/tests/test_pdf_build.py +++ b/tests/test_pdf_build.py @@ -1,4 +1,3 @@ -import numpy as np import pytest from PIL import Image @@ -32,7 +31,6 @@ def test_images_to_pdf_multi_page(tmp_path): images_to_pdf(paths, out) - data = out.read_bytes() # img2pdf writes one xobject image per page; a 3-page PDF should be # meaningfully larger than a 1-page PDF of the same-size images. single = tmp_path / "single.pdf"