Merge pull request #5 from Shankar-105/deploy/test #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16-alpine | |
| env: | |
| POSTGRES_DB: finance_db | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres -d finance_db" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| env: | |
| DATABASE_HOST: 127.0.0.1 | |
| DATABASE_PORT: 5432 | |
| DATABASE_NAME: finance_db | |
| DATABASE_USER: postgres | |
| DATABASE_PASSWORD: postgres | |
| REDIS_HOST: 127.0.0.1 | |
| REDIS_PORT: 6379 | |
| REDIS_DB: 0 | |
| REDIS_PASSWORD: "" | |
| SECRET_KEY: ci-secret-key | |
| ALGORITHM: HS256 | |
| ACCESS_TOKEN_EXPIRE_MINUTES: 30 | |
| REFRESH_TOKEN_EXPIRE_DAYS: 7 | |
| RATE_LIMIT_WINDOW_SECONDS: 60 | |
| RATE_LIMIT_MAX_REQUESTS: 100 | |
| SENSITIVE_RATE_LIMIT_WINDOW_SECONDS: 60 | |
| SENSITIVE_RATE_LIMIT_MAX_REQUESTS: 20 | |
| HEARTBEAT_INTERVAL_SECONDS: 15 | |
| ONLINE_STATUS_TTL_SECONDS: 45 | |
| DASHBOARD_CACHE_TTL_SECONDS: 60 | |
| PYTHONUNBUFFERED: 1 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| cache: "pip" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Verify DB connectivity | |
| run: | | |
| python - <<'PY' | |
| import asyncio | |
| import asyncpg | |
| async def main(): | |
| conn = await asyncpg.connect( | |
| user="postgres", | |
| password="postgres", | |
| host="127.0.0.1", | |
| port=5432, | |
| database="finance_db", | |
| ) | |
| await conn.execute("SELECT 1") | |
| await conn.close() | |
| asyncio.run(main()) | |
| print("PostgreSQL connectivity check passed") | |
| PY | |
| - name: Run tests | |
| run: | | |
| python -m pytest -q |