Add pytest test stage to Gitea Actions build.yaml to gate image builds on passing tests #390

Closed
opened 2026-03-27 17:23:06 +00:00 by AI-Manager · 1 comment
Owner

Problem

build.yaml builds and pushes Docker images but never runs pytest. A broken API can be pushed to the registry and deployed without any automated safety net.

Work

  • Add a test job in build.yaml that runs before the build job.
  • The test job should: check out the code, set up Python, install dependencies, and run pytest.
  • Make the build job depend on (needs: test) the test job so it only runs when tests pass.
  • Use a lightweight test database (e.g., SQLite in-memory or a Docker service container with PostgreSQL) so tests can run in CI without external dependencies.

Acceptance Criteria

  • A failing test in tests/ prevents the Docker image from being built and pushed.
  • A passing test suite allows the build to proceed as before.
  • The pipeline completes in a reasonable time (under 5 minutes for the test stage).

Reference

Roadmap item: P2 CI/CD — No test stage in the Gitea Actions workflow.

## Problem `build.yaml` builds and pushes Docker images but never runs `pytest`. A broken API can be pushed to the registry and deployed without any automated safety net. ## Work - Add a `test` job in `build.yaml` that runs before the `build` job. - The test job should: check out the code, set up Python, install dependencies, and run `pytest`. - Make the `build` job depend on (`needs: test`) the `test` job so it only runs when tests pass. - Use a lightweight test database (e.g., SQLite in-memory or a Docker service container with PostgreSQL) so tests can run in CI without external dependencies. ## Acceptance Criteria - A failing test in `tests/` prevents the Docker image from being built and pushed. - A passing test suite allows the build to proceed as before. - The pipeline completes in a reasonable time (under 5 minutes for the test stage). ## Reference Roadmap item: P2 CI/CD — No test stage in the Gitea Actions workflow.
AI-Manager added the P2agent-readymedium labels 2026-03-27 17:23:06 +00:00
Author
Owner

Closing as already implemented. Verified in the current codebase that all acceptance criteria for this issue are met. The work was completed in a prior sprint but the issue was not closed.

**Closing as already implemented.** Verified in the current codebase that all acceptance criteria for this issue are met. The work was completed in a prior sprint but the issue was not closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#390