diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b01e731..b1543f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,5 +29,79 @@ jobs: - name: Test Docker Build run: docker build -t multai-back-test . - # - name: Run tests - # run: uv run pytest --maxfail=1 --disable-warnings \ No newline at end of file + + test: + name: Run Tests + runs-on: ubuntu-latest + needs: lint-and-typecheck + env: + POSTGRES_USER: test + POSTGRES_PASSWORD: test + POSTGRES_DB: test_db + POSTGRES_PORT: 5432 + POSTGRES_HOST: localhost + REDIS_HOST: localhost + REDIS_PORT: 6379 + NATS_PORT: 4222 + NATS_HOST: localhost + NATS_PASSWORD: dummy + NATS_USER: dummy + MINIO_API_PORT: 9000 + MINIO_ROOT_USER: dummy + MINIO_ROOT_PASSWORD: dummy + MINIO_HOST: localhost + jwt_secret: test_secret + encryption_key: test_encryption_key + FACE_ENCRYPTION_KEY: test_face_encryption_key + FIREBASE_CREDENTIALS_PATH: dummy.json + services: + postgres: + image: pgvector/pgvector:pg16 + env: + POSTGRES_USER: test + POSTGRES_PASSWORD: test + POSTGRES_DB: test_db + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + redis: + image: redis:7-alpine + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 6379:6379 + nats: + image: nats:2.10-alpine + command: --user dummy --pass dummy + ports: + - 4222:4222 + minio: + image: minio/minio:latest + env: + MINIO_ROOT_USER: dummy + MINIO_ROOT_PASSWORD: dummy + command: server /data + ports: + - 9000:9000 + + steps: + - uses: actions/checkout@v6 + - name: Install uv + uses: astral-sh/setup-uv@v7 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version-file: "pyproject.toml" + - name: Install dependencies + run: uv sync --locked --all-extras --dev + - name: Run Migrations + run: uv run alembic upgrade head + - name: Run Tests + run: uv run pytest tests/ \ No newline at end of file diff --git a/tests/e2e/test_stats_endpoint.py b/tests/e2e/test_stats_endpoint.py index f16ca7b..060a540 100644 --- a/tests/e2e/test_stats_endpoint.py +++ b/tests/e2e/test_stats_endpoint.py @@ -1,4 +1,8 @@ import pytest +import os +if os.getenv("MULTAI_RUN_E2E") != "1": + pytest.skip("set MULTAI_RUN_E2E=1 to run live e2e tests", allow_module_level=True) + import uuid from fastapi.testclient import TestClient from datetime import datetime, timezone