name: CI on: push: branches: [main, master, develop] pull_request: branches: [main, master] env: PYTHON_VERSION: "3.11" OPENAI_API_KEY: "" # intentionally empty — tests use mock client DEV_MODE: "true" jobs: # ── Lint & type-check ─────────────────────────────────────────────────────── lint: name: Lint & type-check runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} - name: Cache pip uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} - name: Install dev dependencies run: pip install -e ".[dev]" - name: black — format check run: black --check . - name: ruff — lint run: ruff check . - name: mypy — type check run: mypy app/ # ── Unit & integration tests ───────────────────────────────────────────────── test: name: Unit & integration tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} - name: Cache pip uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} - name: Install dev dependencies run: pip install -e ".[dev]" - name: Run tests with coverage run: pytest --timeout=120 - name: v2 backend tests run: pytest backend/tests -q -o addopts="" - name: Upload coverage report uses: actions/upload-artifact@v4 if: always() with: name: coverage-html path: htmlcov/ # ── Docker build check ─────────────────────────────────────────────────────── docker-build: name: Docker build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build Docker image run: docker build -t report-genius-ai:ci . # ── Acceptance tests (isolation + non-invention + cache) ───────────────────── acceptance: name: Acceptance tests runs-on: ubuntu-latest needs: [test] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} - name: Install dev dependencies run: pip install -e ".[dev]" - name: Tenant isolation test run: pytest app/tests/test_isolation.py -v - name: Non-invention (VERIFY) test run: pytest app/tests/test_generator.py -v -k "verify" - name: Cache prevents duplicate LLM calls run: pytest app/tests/test_cache.py -v -k "cache_hit"