fix: exclude user datasets from git, add to .gitignore #63
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: | |
| # ------------------------------------------------------------------------- | |
| # Backend tests (Python + FastAPI) | |
| # ------------------------------------------------------------------------- | |
| backend-test: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: backend | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: pip install -e ".[dev]" | |
| - name: Run tests | |
| run: PYTHONPATH=. pytest tests/ -v --tb=short | |
| env: | |
| PREDOMICS_DATA_DIR: /tmp/predomics-test | |
| PREDOMICS_PROJECT_DIR: /tmp/predomics-test/projects | |
| PREDOMICS_UPLOAD_DIR: /tmp/predomics-test/uploads | |
| # ------------------------------------------------------------------------- | |
| # Frontend lint + build (Vue.js) | |
| # ------------------------------------------------------------------------- | |
| frontend-build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| # ------------------------------------------------------------------------- | |
| # Docker build + E2E tests (full stack) | |
| # ------------------------------------------------------------------------- | |
| docker-build: | |
| runs-on: ubuntu-latest | |
| needs: [backend-test, frontend-build] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: predomicsapp-web | |
| - name: Checkout gpredomics (Rust ML engine) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: predomics/gpredomics | |
| path: gpredomics | |
| - name: Checkout gpredomicspy (Python bindings) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: predomics/gpredomicspy | |
| path: gpredomicspy | |
| - name: Copy .dockerignore to build context root | |
| run: cp predomicsapp-web/.dockerignore .dockerignore 2>/dev/null || true | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| run: | | |
| docker build -t predomicsapp-web:latest -f predomicsapp-web/Dockerfile . | |
| - name: Test Docker image startup | |
| run: | | |
| # Start a postgres container for the app | |
| docker network create test-net | |
| docker run -d --name test-db --network test-net \ | |
| -e POSTGRES_USER=predomics \ | |
| -e POSTGRES_PASSWORD=predomics \ | |
| -e POSTGRES_DB=predomics \ | |
| postgres:16-alpine | |
| # Wait for postgres | |
| for i in $(seq 1 15); do | |
| if docker exec test-db pg_isready -U predomics > /dev/null 2>&1; then | |
| echo "Postgres ready on attempt $i" | |
| break | |
| fi | |
| sleep 2 | |
| done | |
| # Start app with postgres connection | |
| docker run -d --name test-app --network test-net -p 8000:8000 \ | |
| -e PREDOMICS_DATABASE_URL=postgresql+asyncpg://predomics:predomics@test-db:5432/predomics \ | |
| predomicsapp-web:latest | |
| for i in $(seq 1 30); do | |
| if curl -sf http://localhost:8000/health; then | |
| echo "Health check passed on attempt $i" | |
| docker stop test-app test-db | |
| docker network rm test-net | |
| exit 0 | |
| fi | |
| echo "Waiting for app to start (attempt $i/30)..." | |
| sleep 2 | |
| done | |
| echo "Health check failed after 30 attempts" | |
| docker logs test-app | |
| docker stop test-app test-db | |
| docker network rm test-net | |
| exit 1 | |
| # --- E2E tests (Playwright against the Docker image we just built) --- | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install E2E dependencies | |
| working-directory: predomicsapp-web | |
| run: npm ci | |
| - name: Install Playwright browser | |
| working-directory: predomicsapp-web | |
| run: npx playwright install chromium | |
| - name: Start app for E2E | |
| run: | | |
| docker network create e2e-net | |
| docker run -d --name e2e-db --network e2e-net \ | |
| -e POSTGRES_USER=predomics \ | |
| -e POSTGRES_PASSWORD=predomics \ | |
| -e POSTGRES_DB=predomics \ | |
| postgres:16-alpine | |
| for i in $(seq 1 15); do | |
| if docker exec e2e-db pg_isready -U predomics > /dev/null 2>&1; then | |
| echo "Postgres ready on attempt $i" | |
| break | |
| fi | |
| sleep 2 | |
| done | |
| docker run -d --name e2e-app --network e2e-net -p 8001:8000 \ | |
| -e PREDOMICS_DATABASE_URL=postgresql+asyncpg://predomics:predomics@e2e-db:5432/predomics \ | |
| -e PREDOMICS_SECRET_KEY=e2e-test-secret \ | |
| predomicsapp-web:latest | |
| for i in $(seq 1 30); do | |
| if curl -sf http://localhost:8001/health; then | |
| echo "App ready on attempt $i" | |
| break | |
| fi | |
| echo "Waiting for app (attempt $i/30)..." | |
| sleep 2 | |
| done | |
| - name: Run E2E tests | |
| working-directory: predomicsapp-web | |
| run: npm run test:e2e | |
| env: | |
| BASE_URL: http://localhost:8001 | |
| - name: E2E cleanup | |
| if: always() | |
| run: | | |
| docker stop e2e-app e2e-db 2>/dev/null || true | |
| docker network rm e2e-net 2>/dev/null || true |