manual use case -- explore page #275
Workflow file for this run
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, pull_request] | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: promptaid | |
| POSTGRES_PASSWORD: promptaid | |
| POSTGRES_DB: promptaid | |
| ports: | |
| - 5433:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U promptaid -d promptaid" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| # Removed MinIO service container - will start manually | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| # --- Front-end: React --- | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install & build front-end | |
| run: | | |
| cd frontend | |
| npm ci | |
| npm run lint || echo "Linting failed" | |
| npm run build | |
| env: | |
| CI: true | |
| # --- Back-end: Python/FastAPI --- | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Python dependencies | |
| run: | | |
| cd py_backend | |
| python -m venv .venv | |
| source .venv/bin/activate | |
| pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Start MinIO | |
| run: | | |
| docker run -d \ | |
| --name minio \ | |
| -p 9000:9000 \ | |
| -e MINIO_ROOT_USER=promptaid \ | |
| -e MINIO_ROOT_PASSWORD=promptaid \ | |
| minio/minio:latest server /data --console-address :9001 | |
| - name: Wait for MinIO | |
| run: | | |
| echo "Waiting for MinIO to start..." | |
| sleep 10 | |
| for i in {1..30}; do | |
| if curl -s http://localhost:9000/minio/health/live > /dev/null 2>&1; then | |
| echo "MinIO is up and responding" | |
| break | |
| fi | |
| echo "Waiting for MinIO... (attempt $i/30)" | |
| sleep 3 | |
| done | |
| if ! curl -s http://localhost:9000/minio/health/live > /dev/null 2>&1; then | |
| echo "MinIO failed to start within expected time" | |
| exit 1 | |
| fi | |
| - name: Setup MinIO bucket | |
| env: | |
| S3_ENDPOINT: http://localhost:9000 | |
| S3_ACCESS_KEY: promptaid | |
| S3_SECRET_KEY: promptaid | |
| run: | | |
| pip install boto3 | |
| python -c " | |
| import boto3 | |
| import time | |
| s3 = boto3.client( | |
| 's3', | |
| endpoint_url='http://localhost:9000', | |
| aws_access_key_id='promptaid', | |
| aws_secret_access_key='promptaid' | |
| ) | |
| for attempt in range(5): | |
| try: | |
| s3.create_bucket(Bucket='promptaid') | |
| print('Bucket created successfully') | |
| break | |
| except Exception as e: | |
| print(f'Attempt {attempt + 1} failed: {e}') | |
| if attempt < 4: | |
| time.sleep(2) | |
| else: | |
| raise | |
| " | |
| - name: Run database migrations | |
| env: | |
| DATABASE_URL: postgresql://promptaid:promptaid@localhost:5433/promptaid | |
| S3_ENDPOINT: http://localhost:9000 | |
| S3_ACCESS_KEY: promptaid | |
| S3_SECRET_KEY: promptaid | |
| S3_BUCKET: promptaid | |
| run: | | |
| cd py_backend | |
| source .venv/bin/activate | |
| alembic upgrade head | |
| - name: Run back-end tests | |
| env: | |
| DATABASE_URL: postgresql://promptaid:promptaid@localhost:5433/promptaid | |
| S3_ENDPOINT: http://localhost:9000 | |
| S3_ACCESS_KEY: promptaid | |
| S3_SECRET_KEY: promptaid | |
| S3_BUCKET: promptaid | |
| run: | | |
| cd py_backend | |
| source .venv/bin/activate | |
| export PYTHONPATH="${PYTHONPATH}:$(pwd)" | |
| pytest | |
| - name: Cleanup MinIO | |
| if: always() | |
| run: | | |
| docker stop minio || true | |
| docker rm minio || true |