Spaces:
Sleeping
Sleeping
| 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: 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" | |