Page-marker grouping, OCR improvements, homelab CI #3
@@ -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
|
||||
@@ -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 = (
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
line-length = 120
|
||||
|
||||
[lint]
|
||||
select = ["E4", "E7", "E9", "F", "I"]
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user