Add GitHub Actions workflow for releasing Docker image #1
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 Build | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build with Docker Compose | |
| run: | | |
| docker-compose build | |
| - name: Verify builds completed | |
| run: | | |
| echo "✅ Docker Compose build completed successfully" | |
| docker images | grep memoryalpha-rag-api | |
| - name: Test health endpoint readiness | |
| run: | | |
| # Start services in background | |
| docker-compose up -d | |
| # Wait for services to be ready (max 5 minutes) | |
| timeout 300 bash -c 'until curl -f http://localhost:8000/memoryalpha/health > /dev/null 2>&1; do sleep 5; echo "Waiting for API..."; done' | |
| # Verify health endpoint | |
| curl -f http://localhost:8000/memoryalpha/health | |
| echo "✅ Health check passed" | |
| - name: Test ask endpoint | |
| run: | | |
| # Test the synchronous ask endpoint with a simple query | |
| response=$(curl -s -f "http://localhost:8000/memoryalpha/rag/ask?question=What%20is%20the%20Enterprise?&thinkingmode=DISABLED&max_tokens=100&top_k=3") | |
| # Check if response contains expected content | |
| if echo "$response" | grep -q "Enterprise"; then | |
| echo "✅ Ask endpoint test passed" | |
| else | |
| echo "❌ Ask endpoint test failed - no relevant content found" | |
| echo "Response: $response" | |
| exit 1 | |
| fi | |
| - name: Test streaming endpoint | |
| run: | | |
| # Test the streaming endpoint | |
| response=$(timeout 30 curl -s -N -H "Accept: text/event-stream" \ | |
| "http://localhost:8000/memoryalpha/rag/stream?question=What%20is%20a%20Transporter?&thinkingmode=DISABLED&max_tokens=50&top_k=3" \ | |
| | head -10) | |
| # Check if streaming response contains data events | |
| if echo "$response" | grep -q "data:"; then | |
| echo "✅ Streaming endpoint test passed" | |
| else | |
| echo "❌ Streaming endpoint test failed - no streaming data found" | |
| echo "Response: $response" | |
| exit 1 | |
| fi | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| docker-compose down -v | |
| docker system prune -f |