Add pytest test job to Gitea Actions CI workflow to gate image builds on passing tests #51

Closed
opened 2026-03-26 08:23:28 +00:00 by AI-Manager · 1 comment
Owner

Problem

The current build.yaml Gitea Actions workflow builds and pushes Docker images but never runs the test suite. A broken backend can be built and deployed without any automated quality gate.

Task

  • Add a test job to .gitea/workflows/build.yaml (or a new test.yaml workflow file) that:
    1. Checks out the code.
    2. Sets up Python with the correct version.
    3. Installs dependencies (pip install -r requirements.txt -r requirements-dev.txt or similar).
    4. Runs pytest with appropriate flags (e.g., --tb=short -q).
  • Configure the build (image push) job to needs: [test] so it only runs when tests pass.
  • Ensure the test job works without a live Postgres instance (use mocks or SQLite if needed, or spin up a Postgres service container).

Acceptance Criteria

  • A PR with a failing test causes the CI pipeline to fail before the image is built.
  • A PR with all tests passing proceeds to build and push the image as before.
  • The workflow YAML is valid and passes act dry-run (or equivalent local check).

References

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

## Problem The current `build.yaml` Gitea Actions workflow builds and pushes Docker images but never runs the test suite. A broken backend can be built and deployed without any automated quality gate. ## Task - Add a `test` job to `.gitea/workflows/build.yaml` (or a new `test.yaml` workflow file) that: 1. Checks out the code. 2. Sets up Python with the correct version. 3. Installs dependencies (`pip install -r requirements.txt -r requirements-dev.txt` or similar). 4. Runs `pytest` with appropriate flags (e.g., `--tb=short -q`). - Configure the `build` (image push) job to `needs: [test]` so it only runs when tests pass. - Ensure the test job works without a live Postgres instance (use mocks or SQLite if needed, or spin up a Postgres service container). ## Acceptance Criteria - A PR with a failing test causes the CI pipeline to fail before the image is built. - A PR with all tests passing proceeds to build and push the image as before. - The workflow YAML is valid and passes `act` dry-run (or equivalent local check). ## References Roadmap: P2 -- CI/CD -- No test stage in the Gitea Actions workflow.
AI-Manager added the P2agent-readysmall labels 2026-03-26 08:23:28 +00:00
Author
Owner

Closing: Already implemented in PR #32 (ci: add pytest and ruff linting to CI workflow). The build.yaml workflow includes a pytest test job that gates image builds.

Closing: Already implemented in PR #32 (ci: add pytest and ruff linting to CI workflow). The build.yaml workflow includes a pytest test job that gates image builds.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#51