Skip to content

fix: Support scikit-learn 1.9 in ZeroShotClassification #794

fix: Support scikit-learn 1.9 in ZeroShotClassification

fix: Support scikit-learn 1.9 in ZeroShotClassification #794

name: Test Leaderboard Dockerfile
on:
push:
branches: [ main ]
paths:
- 'Dockerfile'
- '.github/workflows/leaderboard_docker.yml'
- 'pyproject.toml'
- 'uv.lock'
pull_request:
branches: [ main ]
paths:
- 'Dockerfile'
- '.github/workflows/leaderboard_docker.yml'
- 'pyproject.toml'
- 'uv.lock'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-dockerfile:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
ghcr.io/${{ github.repository }}/leaderboard:${{ github.sha }}
ghcr.io/${{ github.repository }}/leaderboard:latest
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
- name: Prepare image for local testing
run: |
docker tag ghcr.io/${{ github.repository }}/leaderboard:${{ github.sha }} mteb-leaderboard:test
- name: Test container can start and run
timeout-minutes: 12
run: |
# Start the container in background
docker run -d --name mteb-test -p 7860:7860 mteb-leaderboard:test
# Monitor container with smart exit conditions
echo "Starting leaderboard container..."
START_TIME=$(date +%s)
STARTUP_DETECTED=false
PROGRESS_DETECTED=false
INIT_COMPLETE_DETECTED=false
while true; do
CURRENT_TIME=$(date +%s)
ELAPSED=$((CURRENT_TIME - START_TIME))
# Maximum timeout: 12 minutes - always fail at timeout
if [ $ELAPSED -gt 720 ]; then
echo "❌ Timeout reached after ${ELAPSED}s - container failed to complete initialization"
docker logs --tail 20 mteb-test
docker stop mteb-test
docker rm mteb-test
exit 1
fi
# Check if container is still running
if ! docker ps | grep -q mteb-test; then
# Container exited, check exit code and logs
EXIT_CODE=$(docker inspect mteb-test --format='{{.State.ExitCode}}')
echo "Container exited with code: $EXIT_CODE after ${ELAPSED}s"
# Check if we made good progress before exit
LOGS=$(docker logs mteb-test 2>&1)
if echo "$LOGS" | grep -q "=== Leaderboard app initialization complete" || \
echo "$LOGS" | grep -q "Running on.*http"; then
echo "✅ Container completed significant startup progress successfully"
docker rm mteb-test
exit 0
else
echo "❌ Container failed before completing startup initialization"
echo "Last logs:"
echo "$LOGS" | tail -10
docker rm mteb-test
exit 1
fi
fi
# Get current logs and check for progress indicators
LOGS=$(docker logs mteb-test 2>&1)
# Check for startup detection
if [ "$STARTUP_DETECTED" = "false" ] && echo "$LOGS" | grep -q "Starting leaderboard app in process"; then
echo "✅ Detected leaderboard app startup"
STARTUP_DETECTED=true
fi
# Check for full initialization complete
if [ "$INIT_COMPLETE_DETECTED" = "false" ] && echo "$LOGS" | grep -q "=== Leaderboard app initialization complete"; then
echo "✅ Detected full app initialization complete!"
INIT_COMPLETE_DETECTED=true
echo "🔄 Testing if server is responding..."
# Give it a moment for the server to fully start
sleep 3
# Try to ping the server
if curl -s --max-time 5 http://localhost:7860/ > /dev/null; then
echo "✅ Server is responding - container fully operational!"
docker stop mteb-test
docker rm mteb-test
exit 0
else
echo "⏳ Server not yet responding, continuing to wait..."
PROGRESS_DETECTED=true
fi
fi
# Check for Gradio server ready
if echo "$LOGS" | grep -q "Running on.*http"; then
echo "✅ Detected Gradio server ready - container fully operational!"
docker stop mteb-test
docker rm mteb-test
exit 0
fi
# Show progress every 30 seconds
if [ $((ELAPSED % 30)) -eq 0 ] && [ $ELAPSED -gt 0 ]; then
echo "Container still running after ${ELAPSED}s... (startup: $STARTUP_DETECTED, init_complete: $INIT_COMPLETE_DETECTED)"
# Show last few lines of logs for progress
echo "$LOGS" | grep -E "(Step [0-9]/7|Starting leaderboard|initialization complete|Running on)" | tail -2
fi
sleep 5
done