# Feature Specification: CI/CD Pipeline

**Feature**: `003-cicd-pipeline`
**Created**: 2026-03-06
**Status**: Implemented
**Source**: Migrated from spec/setup-tasks.md

> Note: This is a setup task (infrastructure), not a user-facing feature. It describes the CI/CD pipeline that validates every push to the repository.

## User Scenarios & Testing

### Setup Task T-3 — CI/CD Pipeline (Priority: P0)

Set up a Gitea Actions CI/CD pipeline that runs on every push, ensuring code quality before deployment.

**Acceptance Scenarios**:

1. **Given** a push is made to the repository, **When** the Gitea Actions workflow triggers, **Then** backend tests run via Maven, frontend tests run via Vitest, and the Docker image is built.

2. **Given** all tests pass and the build succeeds, **When** the pipeline completes, **Then** the Docker image is published to the Gitea container registry.

3. **Given** any test fails or the build breaks, **When** the pipeline runs, **Then** it fails visibly and the Docker image is not published.

4. **Given** the workflow file exists, **When** inspected, **Then** it is located in `.gitea/workflows/` and runs on push.

### Edge Cases

- Pipeline must not publish the image if tests pass but the Docker build itself fails.
- Docker image is only published to the Gitea container registry on the same instance (no external registries).

## Requirements

### Functional Requirements

- **FR-T03-01**: Gitea Actions workflow file in `.gitea/workflows/` runs on push: test, build, publish Docker image.
- **FR-T03-02**: Backend tests run via Maven as part of the pipeline.
- **FR-T03-03**: Frontend tests run via Vitest as part of the pipeline.
- **FR-T03-04**: Docker image is published to the Gitea container registry on the same instance.
- **FR-T03-05**: Pipeline fails visibly if any test fails or the build breaks.
- **FR-T03-06**: Docker image is only published if all tests pass and the build succeeds.

### Notes

Per Q-5 resolution: the project uses Gitea as its hosting and CI/CD platform. The pipeline uses Gitea Actions (`.gitea/workflows/`) and publishes Docker images to the Gitea container registry. T-3 depends on T-1 (repository structure with both projects to test and build) and T-2 (Dockerfile used by the pipeline to build and publish the container image).

**Dependencies:** T-1, T-2

## Success Criteria

- [x] Gitea Actions workflow file in `.gitea/workflows/` runs on push: test, build, publish Docker image
- [x] Backend tests run via Maven
- [x] Frontend tests run via Vitest
- [x] Docker image is published to the Gitea container registry on the same instance
- [x] Pipeline fails visibly if any test fails or the build breaks
- [x] Docker image is only published if all tests pass and the build succeeds
