Skip to content

V0.12.1

V0.12.1 #36

# Copyright(C) 2024-2025 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
# This workflow tests the GAIA CLI on Linux (Ubuntu) with Lemonade server support
# Tests include: CLI installation, Lemonade server setup, core commands, and evaluation tools
# Platform: Linux/Ubuntu (Full CLI functionality with Lemonade server)
name: GAIA CLI Tests (Linux)
on:
workflow_call:
push:
branches: ["main"]
paths:
- "src/**"
- "tests/**"
- "setup.py"
- "pyproject.toml"
pull_request:
branches: ["main"]
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "src/**"
- "tests/**"
- "setup.py"
- "pyproject.toml"
merge_group:
workflow_dispatch:
permissions:
contents: read
jobs:
test-gaia-cli-linux:
name: Test GAIA CLI on Linux (Full Integration)
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download and Install Miniforge
run: |
echo "=== Installing Miniforge for Conda Environment Management ==="
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O miniforge.sh
bash miniforge.sh -b -p $HOME/miniforge3
echo "$HOME/miniforge3/bin" >> $GITHUB_PATH
source $HOME/miniforge3/bin/activate
conda init bash
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential curl jq
- name: Create Conda Environment and Install Lemonade
run: |
echo "=== Setting up Conda Environment for Lemonade ==="
source $HOME/miniforge3/bin/activate
conda create -n lemon python=3.10 -y
conda activate lemon
echo "=== Installing Lemonade SDK ==="
pip install lemonade-sdk
echo "=== Verifying Lemonade Installation ==="
lemonade-server-dev -h
- name: Install GAIA Dependencies
run: |
echo "=== Installing GAIA with Dependencies ==="
source $HOME/miniforge3/bin/activate
conda activate lemon
# Install GAIA with basic dependencies
pip install -e .
# Install evaluation dependencies for testing eval commands
pip install -e .[eval]
- name: Verify GAIA CLI installation
run: |
echo "=== Testing GAIA CLI Installation ==="
source $HOME/miniforge3/bin/activate
conda activate lemon
# Test version command
echo "Testing version command:"
gaia --version
# Test help command
echo "Testing help command:"
gaia --help
# Verify gaia command is available
which gaia
echo "GAIA CLI installed successfully!"
- name: Start Lemonade Server and Test Core Commands
run: |
echo "=== Starting Lemonade Server ==="
source $HOME/miniforge3/bin/activate
conda activate lemon
# Start Lemonade server in background with a lightweight model
echo "Starting Lemonade server with Qwen model..."
echo "Note: First run may take 5-10 minutes to download the model (~3GB)"
# Start server and capture both stdout and stderr
lemonade-server-dev run Qwen3-0.6B-GGUF > lemonade.log 2>&1 &
LEMONADE_PID=$!
echo "Lemonade server started with PID: $LEMONADE_PID"
# Function to check if process is still running
check_process_alive() {
if ! kill -0 $LEMONADE_PID 2>/dev/null; then
echo "❌ Lemonade server process has died. Log output:"
cat lemonade.log
return 1
fi
return 0
}
# Wait for server to start up with longer timeout for model download
echo "Waiting for Lemonade server to start (this may take up to 10 minutes for model download)..."
# Check if server is responding with extended timeout and exponential backoff
max_attempts=60 # Increased from 10 to 60
attempt=0
wait_time=5
max_wait_time=30
while [ $attempt -lt $max_attempts ]; do
# Check if process is still alive
if ! check_process_alive; then
exit 1
fi
# Try to connect to health endpoint
if curl -f -m 10 http://localhost:8000/api/v1/health 2>/dev/null; then
echo "✅ Lemonade server is responding!"
break
fi
attempt=$((attempt + 1))
echo "Waiting for server... (attempt $attempt/$max_attempts, waiting ${wait_time}s)"
# Show recent log output every 10 attempts to indicate progress
if [ $((attempt % 10)) -eq 0 ]; then
echo "Recent server output:"
tail -n 5 lemonade.log 2>/dev/null || echo "No log output yet"
fi
sleep $wait_time
# Exponential backoff with max limit
if [ $wait_time -lt $max_wait_time ]; then
wait_time=$((wait_time + 5))
fi
done
if [ $attempt -eq $max_attempts ]; then
echo "❌ Lemonade server failed to start within timeout"
echo "Final server log output:"
cat lemonade.log
kill $LEMONADE_PID 2>/dev/null || true
exit 1
fi
# Pull the model now that server is running
echo "=== Pulling Qwen3-0.6B-GGUF model ==="
lemonade-server-dev pull Qwen3-0.6B-GGUF
# List available models for debugging
echo "=== Listing Available Models ==="
curl -s http://localhost:8000/api/v1/models | jq '.' || echo "Could not list models"
echo "=== Testing Core GAIA CLI Commands with Lemonade ==="
# Test chat command with Qwen model (should now work with Lemonade)
echo "Testing chat command with Qwen3-0.6B-GGUF model:"
timeout 30s gaia chat --model "Qwen3-0.6B-GGUF" "Hello, this is a test message. Please respond briefly." || echo "Chat command completed"
# Test prompt command with Qwen model
echo "Testing prompt command with Qwen3-0.6B-GGUF model:"
timeout 30s gaia prompt --model "Qwen3-0.6B-GGUF" "What is 2+2?" || echo "Prompt command completed"
# Test llm command with Qwen model
echo "Testing llm command with Qwen3-0.6B-GGUF model:"
timeout 30s gaia llm --model "Qwen3-0.6B-GGUF" "Say hello" || echo "LLM command completed"
echo "✅ Core commands tested successfully!"
# Now test summarizer while server is still running
echo ""
echo "=== Testing Summarizer Integration ==="
echo "Testing complete CLI workflow: gaia summarize command"
# Install pytest if not already installed
pip install pytest || true
# Set the test model for summarizer tests
export GAIA_TEST_MODEL="Qwen3-0.6B-GGUF"
# Run the summarizer integration tests
python -m pytest tests/test_summarizer.py -vs --tb=short || TEST_EXIT=$?
if [ "${TEST_EXIT:-0}" -eq 0 ]; then
echo "✅ Summarizer CLI integration tests passed successfully!"
else
echo "❌ Summarizer CLI integration tests failed with exit code: ${TEST_EXIT}"
echo "Note: Error details displayed above"
fi
# Clean up: Stop the Lemonade server
echo "Stopping Lemonade server..."
kill $LEMONADE_PID 2>/dev/null || true
sleep 5
# Clean up log file
rm -f lemonade.log
- name: Test evaluation and utility commands
run: |
echo "=== Testing Evaluation and Utility Commands ==="
source $HOME/miniforge3/bin/activate
conda activate lemon
# Test groundtruth command help
echo "Testing groundtruth command help:"
gaia groundtruth --help
# Test eval command help
echo "Testing eval command help:"
gaia eval --help
# Test report command help
echo "Testing report command help:"
gaia report --help
# Test generate command help
echo "Testing generate command help:"
gaia generate --help
# Test batch-experiment command help
echo "Testing batch-experiment command help:"
gaia batch-experiment --help
# Test create-template command help
echo "Testing create-template command help:"
gaia create-template --help
# Test visualize command help
echo "Testing visualize command help:"
gaia visualize --help
# Test test command help
echo "Testing test command help:"
gaia test --help
# Test youtube command help
echo "Testing youtube command help:"
gaia youtube --help
# Test kill command help
echo "Testing kill command help:"
gaia kill --help
- name: Test platform compatibility
run: |
echo "=== Testing Platform Compatibility ==="
source $HOME/miniforge3/bin/activate
conda activate lemon
# Test that Linux-specific process commands work
echo "Testing kill command with invalid port (should handle gracefully):"
if gaia kill --port 99999 2>&1 | grep -q "No process found"; then
echo "✅ Kill command handled Linux environment gracefully"
else
echo "⚠️ Kill command may not be fully Linux-compatible"
fi
- name: Test import statements
run: |
echo "=== Testing Python Import Compatibility ==="
source $HOME/miniforge3/bin/activate
conda activate lemon
# Test that all modules can be imported on Linux
python -c "
try:
from gaia.cli import main
from gaia.version import version
from gaia.logger import get_logger
from gaia.llm.llm_client import LLMClient
print('✅ All core imports successful on Linux')
except ImportError as e:
print(f'❌ Import error: {e}')
exit(1)
"
- name: Summary
run: |
echo "=== Linux Full Integration Test Summary ==="
echo "✅ GAIA CLI installation works on Linux"
echo "✅ Miniforge and Conda environment setup successful"
echo "✅ Lemonade server installation and startup successful"
echo "✅ Core CLI commands (chat, prompt, llm) working with Lemonade"
echo "✅ Evaluation and utility commands working"
echo "✅ Cross-platform process management working"
echo "✅ Core Python modules import successfully"
echo ""
echo "🎉 Linux now has full GAIA CLI functionality!"
echo "📋 Tested components:"
echo " ✅ Lemonade server with Qwen3-0.6B-GGUF model"
echo " ✅ Core CLI commands using Qwen model (chat, prompt, llm)"
echo " ✅ Evaluation commands (eval, groundtruth, report, etc.)"
echo " ✅ Summarizer CLI integration (gaia summarize command)"
echo " ✅ Cross-platform compatibility"
echo " ✅ Process management and cleanup"
echo ""
echo "🚀 Next enhancements:"
echo " 🔧 Test audio/TTS functionality on Linux"
echo " 🔧 Add Linux NPU driver support (if available)"
echo " 🔧 Optimize model loading and performance"