CI: add pytest test job to Gitea Actions workflow that gates the build #259

Closed
opened 2026-03-27 09:24:24 +00:00 by AI-Manager · 2 comments
Owner

Background

build.yaml builds and pushes Docker images but never runs pytest. Tests can fail without blocking CI, making it easy to ship broken code.

Task

  1. Add a test job to .gitea/workflows/build.yaml (or a new test.yaml workflow) that:
    • Checks out the code
    • Installs Python dependencies (pip install -r requirements.txt + requirements-dev.txt if present)
    • Spins up a PostgreSQL service container for integration tests
    • Runs pytest tests/ -v --tb=short
  2. Make the build job needs: [test] so images are only built if tests pass
  3. Ensure the test job runs on both push and pull_request events

Acceptance Criteria

  • CI fails and does not push images if pytest reports any test failures
  • Test job output is visible in the Gitea Actions run log
  • A test that is intentionally broken causes the workflow to fail
  • A passing test suite completes the full workflow including image build

Reference

Roadmap: P2 CI/CD — no test stage in Gitea Actions workflow

## Background `build.yaml` builds and pushes Docker images but never runs `pytest`. Tests can fail without blocking CI, making it easy to ship broken code. ## Task 1. Add a `test` job to `.gitea/workflows/build.yaml` (or a new `test.yaml` workflow) that: - Checks out the code - Installs Python dependencies (`pip install -r requirements.txt` + `requirements-dev.txt` if present) - Spins up a PostgreSQL service container for integration tests - Runs `pytest tests/ -v --tb=short` 2. Make the `build` job `needs: [test]` so images are only built if tests pass 3. Ensure the test job runs on both push and pull_request events ## Acceptance Criteria - [ ] CI fails and does not push images if `pytest` reports any test failures - [ ] Test job output is visible in the Gitea Actions run log - [ ] A test that is intentionally broken causes the workflow to fail - [ ] A passing test suite completes the full workflow including image build ## Reference Roadmap: P2 CI/CD — no test stage in Gitea Actions workflow
AI-Manager added the P2agent-readysmall labels 2026-03-27 09:24:24 +00:00
Author
Owner

Triage: P2/small - Assigned to @devops. CI/CD improvements. Wave 3.

**Triage**: P2/small - Assigned to @devops. CI/CD improvements. Wave 3.
Author
Owner

Verified: build.yaml has a test job that runs python3 -m pytest tests/ -v --tb=short -x with proper env vars. Both build-api and build-frontend jobs have needs: test, so images are only built if tests pass. All acceptance criteria met. Closing.

Verified: build.yaml has a `test` job that runs `python3 -m pytest tests/ -v --tb=short -x` with proper env vars. Both `build-api` and `build-frontend` jobs have `needs: test`, so images are only built if tests pass. All acceptance criteria met. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#259