name: AILIXIR API Tests (Docker) on: workflow_dispatch: jobs: test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 with: lfs: true - name: Pull and verify Git LFS files run: | git lfs version git lfs pull git lfs checkout git lfs ls-files python - <<'PY' from pathlib import Path paths = [ "ai_apps/generation/bundle/models/affinity/config.pkl", "ai_apps/generation/bundle/models/affinity/model.pt", "ai_apps/generation/bundle/models/generator/egfr_generator.chkpt", "ai_apps/generation/bundle/models/generator/reinvent.prior", ] for p in paths: path = Path(p) if not path.exists(): raise SystemExit(f"Missing required artifact: {p}") data = path.read_bytes()[:80] size = path.stat().st_size print(f"{p}: {size} bytes") if data.startswith(b"version https://git-lfs.github.com"): raise SystemExit(f"{p} is still a Git LFS pointer file") PY - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Create .env file for Docker run: | cp docker/laravel.env .env - name: Start Docker containers run: | docker compose up -d --build - name: Wait for services to be healthy run: | echo "Waiting for Laravel API to be ready..." for i in {1..60}; do if docker exec ailixir-laravel curl -f http://127.0.0.1:8000 > /dev/null 2>&1; then echo "Laravel API is ready" break fi echo "Attempt $i/60: Laravel API not ready yet..." sleep 3 done echo "Waiting for ADMET service to be healthy..." for i in {1..120}; do if docker exec ailixir-admet python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" > /dev/null 2>&1; then echo "ADMET service is healthy internally inside container" echo "Waiting additional 10 seconds for service to fully initialize..." sleep 10 break fi echo "Attempt $i/120: ADMET service not ready yet..." sleep 5 done echo "All services are up and running!" docker compose ps - name: Run database migrations run: | docker exec ailixir-laravel php artisan migrate --force - name: Run API tests env: BASE_URL: http://localhost:8080/api TEST_EMAIL: test@example.com TEST_PASSWORD: password123 TEST_NAME: testuser run: | docker exec ailixir-laravel \ python -m pytest tests/ -v --tb=short --junitxml=junit.xml || true - name: Copy test results from container if: always() run: | docker cp ailixir-laravel:/var/www/html/junit.xml ./junit.xml || true - name: Upload test results uses: actions/upload-artifact@v4 if: always() with: name: test-results path: junit.xml - name: Test Summary uses: test-summary/action@v2 with: paths: "junit.xml" if: always() - name: Collect Docker logs if: failure() run: | mkdir -p logs docker compose logs laravel > logs/laravel.log docker compose logs admet > logs/admet.log docker compose logs drug-repurposing > logs/drug-repurposing.log docker compose logs chemical-rag > logs/chemical-rag.log - name: Upload Docker logs uses: actions/upload-artifact@v4 if: failure() with: name: docker-logs path: logs/ - name: Cleanup Docker containers if: always() run: | docker compose down -v