Skip to content

Commit 3d38d98

Browse files
Introduce CI Actions for Quarkus-LangChain4j integration tests with GPULlama3.
1 parent 95b3c88 commit 3d38d98

1 file changed

Lines changed: 149 additions & 0 deletions

File tree

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
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+
echo "✅ TornadoVM installed"
57+
58+
# Step 2: Clone Quarkus LangChain4j
59+
- name: Clone Quarkus LangChain4j
60+
run: |
61+
cd ${{ github.workspace }}
62+
git clone https://github.com/quarkiverse/quarkus-langchain4j.git
63+
echo "✅ Quarkus LangChain4j cloned"
64+
65+
# Step 3: Build Quarkus LangChain4j (optimized)
66+
- name: Build Quarkus LangChain4j
67+
run: |
68+
cd ${{ github.workspace }}/quarkus-langchain4j
69+
export PATH="$TORNADO_SDK/bin:$JAVA_HOME/bin:$PATH"
70+
71+
# Use reactor to build GPULlama3 integration test + dependencies
72+
# This recompiles everything with the same Java version, avoiding compatibility issues
73+
# The -Dtornado flag activates the TornadoVM profile which includes gpu-llama3 module
74+
mvn clean install -pl integration-tests/gpu-llama3 -am -DskipTests -Dtornado
75+
76+
echo "✅ Quarkus LangChain4j built (GPULlama3 integration test + dependencies)"
77+
78+
# Step 4: Run Integration Test
79+
- name: Run Integration Test
80+
run: |
81+
cd ${{ github.workspace }}/quarkus-langchain4j/integration-tests/gpu-llama3
82+
export PATH="$TORNADO_SDK/bin:$JAVA_HOME/bin:$PATH"
83+
84+
# Set model path
85+
MODEL_PATH="${MODELS_DIR}/Qwen3-0.6B-Q8_0.gguf"
86+
if [ ! -f "$MODEL_PATH" ]; then
87+
MODEL_PATH="${MODELS_DIR}/Llama-3.2-1B-Instruct-Q8_0.gguf"
88+
fi
89+
export MODEL_PATH
90+
91+
echo "Running integration test with model: $MODEL_PATH"
92+
93+
# Start the application in the background
94+
java "@$TORNADO_SDK/tornado-argfile" -jar target/quarkus-app/quarkus-run.jar &
95+
APP_PID=$!
96+
97+
# Wait for the application to start
98+
echo "Waiting for application to start..."
99+
for i in {1..30}; do
100+
if curl -s http://localhost:8080/q/health > /dev/null 2>&1; then
101+
echo "✅ Application started successfully"
102+
break
103+
elif [ $i -eq 30 ]; then
104+
echo "❌ Application failed to start within 30 seconds"
105+
kill $APP_PID || true
106+
exit 1
107+
else
108+
sleep 1
109+
fi
110+
done
111+
112+
# Test that GPULlama3 integration is working
113+
echo "Testing GPULlama3 integration..."
114+
115+
# Test the blocking chat endpoint
116+
echo "Testing blocking chat endpoint..."
117+
BLOCKING_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:8080/chat/blocking)
118+
HTTP_CODE="${BLOCKING_RESPONSE: -3}"
119+
120+
if [ "$HTTP_CODE" = "200" ]; then
121+
RESPONSE_BODY="${BLOCKING_RESPONSE%???}"
122+
if [ ${#RESPONSE_BODY} -gt 10 ]; then
123+
echo "✅ Blocking chat endpoint working - received response: ${RESPONSE_BODY:0:50}..."
124+
else
125+
echo "⚠️ Blocking chat endpoint returned short response: $RESPONSE_BODY"
126+
fi
127+
else
128+
echo "❌ Blocking chat endpoint failed with HTTP code: $HTTP_CODE"
129+
echo "Response: ${BLOCKING_RESPONSE%???}"
130+
fi
131+
132+
# Test the streaming chat endpoint (just check it responds)
133+
echo "Testing streaming chat endpoint..."
134+
STREAMING_RESPONSE=$(timeout 10s curl -s -w "%{http_code}" http://localhost:8080/chat/streaming)
135+
STREAMING_HTTP_CODE="${STREAMING_RESPONSE: -3}"
136+
137+
if [ "$STREAMING_HTTP_CODE" = "200" ]; then
138+
echo "✅ Streaming chat endpoint responding"
139+
else
140+
echo "⚠️ Streaming chat endpoint returned HTTP code: $STREAMING_HTTP_CODE"
141+
fi
142+
143+
echo "✅ GPULlama3 integration test completed"
144+
145+
# Clean shutdown
146+
kill $APP_PID || true
147+
wait $APP_PID 2>/dev/null || true
148+
149+
echo "✅ Integration test completed successfully"

0 commit comments

Comments
 (0)