Implement persistent embedding cache, add demo output, and LinkedIn-r… #12
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: Fast AI Tests | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'src/main/java/org/k11techlab/framework/ai/**' | |
| - 'src/test/java/org/k11techlab/framework_unittests/aiTests/**' | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| quick-ai-test: | |
| name: Quick AI Validation | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'temurin' | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Set up Chrome (headless) | |
| uses: browser-actions/setup-chrome@v1 | |
| with: | |
| chrome-version: stable | |
| - name: Setup ChromeDriver (Reliable Method) | |
| run: | | |
| # Install ChromeDriver using system package manager (most reliable) | |
| sudo apt-get update | |
| sudo apt-get install -y chromium-chromedriver | |
| # Create symlink for consistent path | |
| sudo ln -sf /usr/bin/chromedriver /usr/local/bin/chromedriver | |
| # Verify installation | |
| chromedriver --version | |
| google-chrome --version | |
| # Show where ChromeDriver is located | |
| which chromedriver | |
| ls -la /usr/local/bin/chromedriver | |
| - name: Compile and test compilation | |
| run: | | |
| mvn clean compile test-compile -q | |
| - name: Install Ollama | |
| run: | | |
| echo "🚀 Installing Ollama..." | |
| curl -fsSL https://ollama.ai/install.sh | sh | |
| - name: Start Ollama and pull model | |
| run: | | |
| echo "🎯 Starting Ollama service..." | |
| nohup ollama serve > ollama.log 2>&1 & | |
| # Wait for Ollama | |
| for i in {1..20}; do | |
| if curl -f http://localhost:11434/api/tags >/dev/null 2>&1; then | |
| echo "✅ Ollama ready!" | |
| break | |
| fi | |
| echo "⏳ Waiting... ($i/20)" | |
| sleep 2 | |
| done | |
| # Pull tiny model for speed with enhanced retry | |
| echo "📥 Pulling tinyllama..." | |
| for attempt in {1..2}; do | |
| echo "Attempt $attempt to pull tinyllama..." | |
| if timeout 180 ollama pull tinyllama; then | |
| echo "✅ Successfully pulled tinyllama on attempt $attempt" | |
| break | |
| else | |
| echo "❌ Failed on attempt $attempt" | |
| if [ $attempt -eq 2 ]; then | |
| echo "⚠️ Using any available models" | |
| fi | |
| sleep 5 | |
| fi | |
| done | |
| echo "📋 Models available:" | |
| ollama list | |
| # Test model functionality | |
| echo "🧪 Testing model:" | |
| if ollama list | grep -q "tinyllama"; then | |
| ollama run tinyllama "Say OK" | |
| else | |
| echo "⚠️ tinyllama not available" | |
| fi | |
| - name: Run Fast AI Test | |
| run: | | |
| echo "🧪 Running single AI test for verification..." | |
| # Test direct Ollama first | |
| echo "🔍 Direct Ollama test:" | |
| curl -X POST http://localhost:11434/api/generate \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"model": "tinyllama", "prompt": "Say OK", "stream": false}' | jq -r '.response' | |
| # Run just the quick test with enhanced logging | |
| mvn test -Dtest=QuickAITest \ | |
| -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver \ | |
| -Dheadless=true \ | |
| -Dai.model=tinyllama \ | |
| -Dollama.host=http://localhost:11434 \ | |
| -Djava.awt.headless=true \ | |
| -Dselenium.suppress.cdp.warnings=true \ | |
| -Dsurefire.useSystemClassLoader=false \ | |
| -X | tee fast-test-output.log | |
| echo "📊 Quick test completed! Analyzing results..." | |
| # Show key outputs | |
| echo "=== AI TEST OUTPUTS ===" | |
| grep -E "(🤖|✅|❌|🔍|⚠️)" fast-test-output.log || echo "No AI emoji outputs found" | |
| echo "=== TEST RESULTS ===" | |
| ls -la target/surefire-reports/ || echo "No surefire reports" | |
| # Show any test results | |
| if [ -d "target/surefire-reports" ]; then | |
| for xml in target/surefire-reports/TEST-*.xml; do | |
| if [ -f "$xml" ]; then | |
| echo "📋 $(basename $xml):" | |
| grep -o 'tests="[0-9]*" errors="[0-9]*" failures="[0-9]*"' "$xml" || echo "No stats found" | |
| fi | |
| done | |
| fi | |
| env: | |
| OLLAMA_HOST: http://localhost:11434 | |
| - name: Upload fast test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: fast-ai-test-results | |
| path: | | |
| target/surefire-reports/ | |
| fast-test-output.log | |
| ollama.log |