From 54ba92bb05931adc225ba24df895d4b48ddd040a Mon Sep 17 00:00:00 2001 From: npeter83 Date: Tue, 18 Aug 2026 01:48:53 +0200 Subject: [PATCH] ci(gitea): add the server-side gate mirror (E1 S3, DX-1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add .gitea/workflows/check.yml so the quality gate runs on the lab act_runner, machine-independent, on every push/PR — the review's "no server-side CI" gap. Two parallel jobs mirror the two local lanes: - frontend (node:20-bookworm, matching the prod build image): tsc + eslint + prettier --check + knip + vitest. - backend (nikolaik/python-nodejs python3.12+node): ruff + the full pytest suite against a real postgres:16 service, with ffmpeg installed and SIFTLODE_TEST_REQUIRE_DB=1 so a DB/ffmpeg that failed to come up is a hard error, never a silent skip. Notes for this runner: pytest runs natively against the service (the docker-compose bind-mount is unreliable under a mounted-socket runner), and the backend uses a baked python+node image rather than actions/setup-python, which can't reach GitHub's python-versions download from the lab. --- .gitea/workflows/check.yml | 64 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .gitea/workflows/check.yml diff --git a/.gitea/workflows/check.yml b/.gitea/workflows/check.yml new file mode 100644 index 00000000..74faec22 --- /dev/null +++ b/.gitea/workflows/check.yml @@ -0,0 +1,64 @@ +# Server-side mirror of the local `siftlode check` gate (E1 S3 / DX-1), so `main` is always green +# independent of any one machine. Two parallel jobs match the two local lanes: +# frontend — tsc (3 projects) + eslint + prettier --check + knip + vitest +# backend — ruff + the full pytest suite (pure-logic + the DB-backed lane) against a real Postgres +# +# Runner: the lab act_runner (LXC 115) maps `ubuntu-latest` -> node:20-bookworm and mounts the Docker +# socket, so service containers work. The backend runs pytest NATIVELY against a `postgres` service +# (not the local docker-compose.test.yml, whose bind-mount is unreliable under a mounted-socket runner); +# fidelity is kept by installing the SAME pinned requirements, Postgres 16, and ffmpeg, and by setting +# SIFTLODE_TEST_REQUIRE_DB=1 so a DB/ffmpeg that failed to come up is a hard error, never a silent skip. +# node 20 matches the prod build image (Dockerfile `node:20-alpine`); S4's node-22 bump moves both. +name: gate + +on: [push, pull_request] + +jobs: + frontend: + runs-on: ubuntu-latest + container: node:20-bookworm + defaults: + run: + working-directory: frontend + steps: + - uses: actions/checkout@v4 + - run: npm ci + - run: npm run typecheck + - run: npm run lint + - run: npm run format:check + - run: npm run knip + - run: npm run test + + backend: + runs-on: ubuntu-latest + # A combined python+node image: python 3.12 (matches the prod Dockerfile) for the tests, and node + # so the JS actions (checkout) run. actions/setup-python is NOT usable here — the runner can't reach + # GitHub's python-versions download, so it must be baked into the image. + container: nikolaik/python-nodejs:python3.12-nodejs20 + services: + postgres: + image: postgres:16-alpine + env: + POSTGRES_USER: siftlode + POSTGRES_PASSWORD: siftlode + POSTGRES_DB: siftlode_test + options: >- + --health-cmd "pg_isready -U siftlode -d siftlode_test" + --health-interval 2s + --health-timeout 3s + --health-retries 30 + env: + DATABASE_URL: postgresql+psycopg://siftlode:siftlode@postgres:5432/siftlode_test + SIFTLODE_TEST_REQUIRE_DB: "1" + steps: + - uses: actions/checkout@v4 + # ffmpeg for the poster/thumbnail tests; postgresql-client for the readiness wait below. + - run: apt-get update && apt-get install -y --no-install-recommends ffmpeg postgresql-client + - name: Wait for Postgres + run: until pg_isready -h postgres -U siftlode -d siftlode_test; do sleep 1; done + - run: pip install --no-cache-dir -r backend/requirements.txt -r backend/requirements-dev.txt + - name: ruff + run: python -m ruff check --config backend/ruff.toml backend scripts + - name: pytest + run: python -m pytest + working-directory: backend