|
| 1 | +name: Quarkus LangChain4j Integration Tests |
| 2 | + |
| 3 | +on: |
| 4 | + # Temporarily disabled - manual trigger only |
| 5 | + push: |
| 6 | + branches: [ main, ci/quarkus-langchain4j-IT ] |
| 7 | + # pull_request: |
| 8 | + # branches: [ main ] |
| 9 | + # types: [opened, synchronize, reopened] |
| 10 | + # schedule: |
| 11 | + # # Run daily at 02:30 UTC to catch dependency breakages |
| 12 | + # - cron: '30 2 * * *' |
| 13 | + workflow_dispatch: |
| 14 | + inputs: |
| 15 | + quarkus_langchain4j_version: |
| 16 | + description: 'Quarkus LangChain4j version to test against' |
| 17 | + required: false |
| 18 | + type: string |
| 19 | + quarkus_version: |
| 20 | + description: 'Quarkus platform version to test against' |
| 21 | + required: false |
| 22 | + type: string |
| 23 | + |
| 24 | +env: |
| 25 | + JAVA_HOME: /opt/jenkins/jdks/graal-23.1.0/jdk-21.0.3 |
| 26 | + MODELS_DIR: /opt/models |
| 27 | + |
| 28 | +jobs: |
| 29 | + quarkus-integration-test: |
| 30 | + if: github.repository == 'beehive-lab/GPULlama3.java' |
| 31 | + runs-on: [self-hosted] |
| 32 | + timeout-minutes: 30 |
| 33 | + strategy: |
| 34 | + fail-fast: false |
| 35 | + matrix: |
| 36 | + backend: |
| 37 | + - name: opencl |
| 38 | + - name: ptx |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Checkout GPULlama3 |
| 42 | + uses: actions/checkout@v4 |
| 43 | + |
| 44 | + # Step 1: Install TornadoVM |
| 45 | + - name: Install TornadoVM |
| 46 | + run: | |
| 47 | + cd ${{ github.workspace }} |
| 48 | + |
| 49 | + wget https://github.com/beehive-lab/TornadoVM/releases/download/v2.1.0/tornadovm-2.1.0-${{ matrix.backend.name }}-linux-amd64.zip |
| 50 | + unzip tornadovm-2.1.0-${{ matrix.backend.name }}-linux-amd64.zip |
| 51 | + |
| 52 | + TORNADO_SDK="${{ github.workspace }}/tornadovm-2.1.0-${{ matrix.backend.name }}" |
| 53 | + echo "TORNADO_SDK=$TORNADO_SDK" >> $GITHUB_ENV |
| 54 | + echo "PATH=$TORNADO_SDK/bin:$JAVA_HOME/bin:$PATH" >> $GITHUB_ENV |
| 55 | + |
| 56 | + tornado --devices |
| 57 | + tornado --version |
| 58 | + |
| 59 | + if [ $? -eq 0 ]; then |
| 60 | + echo "✅ TornadoVM installed" |
| 61 | + else |
| 62 | + echo "❌ TornadoVM installation check failed" |
| 63 | + exit 1 |
| 64 | + fi |
| 65 | +
|
| 66 | + # Step 2: Clone Quarkus LangChain4j |
| 67 | + - name: Clone Quarkus LangChain4j |
| 68 | + run: | |
| 69 | + cd ${{ github.workspace }} |
| 70 | + git clone https://github.com/quarkiverse/quarkus-langchain4j.git |
| 71 | + echo "✅ Quarkus LangChain4j cloned" |
| 72 | +
|
| 73 | + # Step 3: Build Quarkus LangChain4j (optimized) |
| 74 | + - name: Build Quarkus LangChain4j |
| 75 | + run: | |
| 76 | + cd ${{ github.workspace }}/quarkus-langchain4j |
| 77 | + export PATH="$TORNADO_SDK/bin:$JAVA_HOME/bin:$PATH" |
| 78 | + |
| 79 | + # Use reactor to build GPULlama3 integration test + dependencies |
| 80 | + # This recompiles everything with the same Java version, avoiding compatibility issues |
| 81 | + # The -Dtornado flag activates the TornadoVM profile which includes gpu-llama3 module |
| 82 | + mvn clean install -pl integration-tests/gpu-llama3 -am -DskipTests -Dtornado |
| 83 | + |
| 84 | + echo "✅ Quarkus LangChain4j built (GPULlama3 integration test + dependencies)" |
| 85 | +
|
| 86 | + # Step 4: Run Integration Test |
| 87 | + - name: Run Integration Test |
| 88 | + run: | |
| 89 | + cd ${{ github.workspace }}/quarkus-langchain4j/integration-tests/gpu-llama3 |
| 90 | + export PATH="$TORNADO_SDK/bin:$JAVA_HOME/bin:$PATH" |
| 91 | + |
| 92 | + # Set model path |
| 93 | + MODEL_PATH="${MODELS_DIR}/Llama-3.2-1B-Instruct-F16.gguf" |
| 94 | + export MODEL_PATH |
| 95 | + |
| 96 | + echo "Running Quarkus-Langchain4j integration test with model: $MODEL_PATH" |
| 97 | + |
| 98 | + # Start the application in the background |
| 99 | + java "@$TORNADO_SDK/tornado-argfile" -jar target/quarkus-app/quarkus-run.jar & |
| 100 | + APP_PID=$! |
| 101 | + |
| 102 | + # Wait for the application to start |
| 103 | + echo "Waiting for application to start..." |
| 104 | + for i in {1..30}; do |
| 105 | + if curl -s http://localhost:8080/q/health > /dev/null 2>&1; then |
| 106 | + echo "✅ Application started successfully" |
| 107 | + break |
| 108 | + elif [ $i -eq 30 ]; then |
| 109 | + echo "❌ Application failed to start within 30 seconds" |
| 110 | + kill $APP_PID || true |
| 111 | + exit 1 |
| 112 | + else |
| 113 | + sleep 1 |
| 114 | + fi |
| 115 | + done |
| 116 | + |
| 117 | + # Test that GPULlama3 integration is working |
| 118 | + echo "Testing GPULlama3 integration..." |
| 119 | + |
| 120 | + # Test the blocking chat endpoint |
| 121 | + echo "Testing blocking chat endpoint..." |
| 122 | + BLOCKING_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:8080/chat/blocking) |
| 123 | + HTTP_CODE="${BLOCKING_RESPONSE: -3}" |
| 124 | + |
| 125 | + if [ "$HTTP_CODE" = "200" ]; then |
| 126 | + RESPONSE_BODY="${BLOCKING_RESPONSE%???}" |
| 127 | + if [ ${#RESPONSE_BODY} -gt 10 ]; then |
| 128 | + echo "✅ Blocking chat endpoint working - received response: ${RESPONSE_BODY:0:50}..." |
| 129 | + else |
| 130 | + echo "⚠️ Blocking chat endpoint returned short response: $RESPONSE_BODY" |
| 131 | + fi |
| 132 | + else |
| 133 | + echo "❌ Blocking chat endpoint failed with HTTP code: $HTTP_CODE" |
| 134 | + echo "Response: ${BLOCKING_RESPONSE%???}" |
| 135 | + fi |
| 136 | + |
| 137 | + # Test the streaming chat endpoint (just check it responds) |
| 138 | + echo "Testing streaming chat endpoint..." |
| 139 | + STREAMING_RESPONSE=$(timeout 10s curl -s -w "%{http_code}" http://localhost:8080/chat/streaming) |
| 140 | + STREAMING_HTTP_CODE="${STREAMING_RESPONSE: -3}" |
| 141 | + |
| 142 | + if [ "$STREAMING_HTTP_CODE" = "200" ]; then |
| 143 | + echo "✅ Streaming chat endpoint responding" |
| 144 | + else |
| 145 | + echo "⚠️ Streaming chat endpoint returned HTTP code: $STREAMING_HTTP_CODE" |
| 146 | + fi |
| 147 | + |
| 148 | + echo "✅ GPULlama3 integration test completed" |
| 149 | + |
| 150 | + # Clean shutdown |
| 151 | + kill $APP_PID || true |
| 152 | + wait $APP_PID 2>/dev/null || true |
| 153 | + |
| 154 | + echo "✅ Integration test completed successfully" |
0 commit comments