Only check Ollama if its selected #3
This file contains 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: Online Stack Test | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test-online-stack: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Copy .env.example to .env | |
run: cp .env.example .env | |
- name: Create docs directory | |
run: mkdir -p docs | |
- name: Download and extract documentation | |
run: | | |
curl -L "${{ secrets.DOCS_URL }}" -o documentation.zip | |
unzip documentation.zip -d docs | |
rm documentation.zip | |
- name: Set environment variables | |
run: | | |
sed -i "s/^LANGFUSE_PUBLIC_KEY=.*/LANGFUSE_PUBLIC_KEY=\${{ secrets.LANGFUSE_PK }}/" .env | |
sed -i "s/^LANGFUSE_SECRET_KEY=.*/LANGFUSE_SECRET_KEY=\${{ secrets.LANGFUSE_SK }}/" .env | |
sed -i "s|^LANGFUSE_HOST=.*|LANGFUSE_HOST=\${{ secrets.LANGFUSE_HOST }}|" .env | |
sed -i "s|^LOCAL_EMBEDDING=false|LOCAL_EMBEDDING=true|" .env | |
sed -i "s|^GROQ_API_KEY=.*|GROQ_API_KEY=\${{ secrets.GROQ_API_KEY }}|" .env | |
- name: Show contents of .env | |
run: cat .env | |
- name: Run docker-compose | |
run: docker-compose up -d | |
- name: Basic wait | |
run: sleep 100 | |
- name: List running containers | |
run: docker ps | |
- name: Log last 10 lines from all containers | |
run: docker ps -q | xargs -I {} docker logs --tail 10 {} | |
- name: Log RAG api | |
run: docker logs kakawa_rag_api --tail 100 | |
- name: Test Online LangFuse API endpoint | |
run: | | |
response=$(docker exec langfuse wget --header='accept: application/json' -qO - "${{ secrets.LANGFUSE_HOST }}/api/public/health") | |
if echo "$response" | grep OK; then | |
echo "Health check OK" | |
else | |
echo "Health check failed" | |
exit 1 | |
fi | |
- name: Execute RAG API query | |
run: | | |
commit_hash=$(git rev-parse --short HEAD) | |
echo $commit_hash | |
success=false | |
for i in {1..5}; do | |
response=$(docker exec kakawa_rag_api python -c "import requests; response = requests.get('http:https://kakawa_rag_api:8000/rag?query=How%20to%20install%20Mapeo&user_id=github_action&session_id=$commit_hash', headers={'accept': 'application/json'}); print(response.status_code)") | |
if [ "$response" -eq 200 ]; then | |
echo "RAG API endpoint is up and running." | |
success=true | |
break | |
else | |
echo "Attempt $i failed with status code $response. Retrying in 20 seconds..." | |
sleep 20 | |
fi | |
done | |
if [ "$success" = false ]; then | |
echo "RAG API endpoint check failed after 5 attempts." | |
exit 1 | |
fi |