Skip to content

Commit fd74bc4

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

1 file changed

Lines changed: 155 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)