# PRD 0002: Test pipeline on Gitea Actions

- **Status:** Active
- **Author:** didericis
- **Created:** 2026-05-08

## Summary

Run the project's test suite on every push to a PR via Gitea Actions, surfacing pass/fail on the PR.

## Problem

There is no automated test run today — tests only run when the author remembers to invoke them locally before pushing or merging. The CI loop is missing: nothing reruns the suite on each push, and there's no shared signal for whether a branch is green.

## Goals / Success Criteria

- Every PR shows a passing/failing tests check from Gitea Actions, updated per push.
- Pushing a fix to a red PR re-runs the workflow automatically and turns it green without manual re-trigger.
- The workflow file is committed in-tree.

## Non-goals

- Pipeline speed / wall-clock optimization.
- Matrix testing across Python versions or operating systems.
- Notifications (Slack, email, etc.) on failure.
- Caching dependencies between runs.

## Scope

### In scope

- A Gitea Actions workflow that runs `tests/run_tests.py` (full suite — unit + integration where the runner's docker topology supports it) on every push event affecting a PR, plus pushes to `main`.
- A status badge in the README so contributors can see CI state at a glance.
- Whatever dependency-manifest changes are needed to make the runner execute `tests/run_tests.py` cleanly.

### Out of scope

- Branch-protection rules / merge gating on `main`.
- Deploy / release pipeline (publishing images, tagging releases, etc.).
- Coverage reporting or quality gates.
- Lint / format checks beyond the test suite.

## Proposed Design

### New services / components

- `.gitea/workflows/test.yml` — workflow definition. Triggers on `pull_request` and `push` to `main`. Runs `tests/run_tests.py` (stdlib `unittest`; no external test deps required).

### Existing code touched

- `tests/` — a small number of integration tests are skipped under `GITEA_ACTIONS=true` because act_runner's docker socket mount breaks their host-loopback assumptions. Skips are local to the affected tests.
- `README.md` — adds a CI status badge.

### Data model changes

None.

### External dependencies

- Relies on a Gitea Actions runner registered to (or instance-scoped above) the repo on `gitea.dideric.is`.

## Open questions

- The two `GITEA_ACTIONS`-skipped integration tests could be rewritten to discover the container's IP via `docker inspect` rather than relying on host port mapping; that would let them pass under the socket-mount topology too. Filed as a follow-up, not in this PRD.

## References

- `tests/run_tests.py` — the runner CI will invoke.
- PRD 0001 (`docs/prds/0001-per-agent-egress-proxy-via-pipelock.md`) — prior PRD for repo numbering reference.
