Skip to content

Commit b9346af

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

1 file changed

Lines changed: 79 additions & 62 deletions

File tree

.github/workflows/quarkus-langchain4j-integration.yml

Lines changed: 79 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ on:
2323

2424
env:
2525
JAVA_HOME: /opt/jenkins/jdks/graal-23.1.0/jdk-21.0.3
26-
MODELS_DIR: /opt/models
26+
TORNADO_ROOT: ${{ github.workspace }}/GPULlama3.java/external/tornadovm
27+
GRAAL_JARS: /opt/graalJars
28+
QUARKUS_PORT: 8081
2729

2830
jobs:
2931
quarkus-integration-test:
@@ -35,34 +37,76 @@ jobs:
3537
matrix:
3638
backend:
3739
- name: opencl
38-
- name: ptx
40+
#- name: ptx
3941

4042
steps:
4143
- name: Checkout GPULlama3
4244
uses: actions/checkout@v4
4345

44-
# Step 1: Install TornadoVM
45-
- name: Install TornadoVM
46+
# # Step 1: Install TornadoVM
47+
# - name: Install TornadoVM
48+
# run: |
49+
# cd ${{ github.workspace }}
50+
#
51+
# wget https://github.com/beehive-lab/TornadoVM/releases/download/v2.1.0/tornadovm-2.1.0-${{ matrix.backend.name }}-linux-amd64.zip
52+
# unzip tornadovm-2.1.0-${{ matrix.backend.name }}-linux-amd64.zip
53+
#
54+
# # Export environment for the current shell
55+
# export TORNADO_SDK="${{ github.workspace }}/tornadovm-2.1.0-${{ matrix.backend.name }}"
56+
# export PATH="$TORNADO_SDK/bin:$JAVA_HOME/bin:$PATH"
57+
#
58+
# # Save to GitHub Actions environment for future steps
59+
# echo "TORNADO_SDK=$TORNADO_SDK" >> $GITHUB_ENV
60+
# echo "PATH=$PATH" >> $GITHUB_ENV
61+
#
62+
# # Check TornadoVM installation
63+
# if tornado --devices && tornado --version; then
64+
# echo "✅ TornadoVM installed"
65+
# else
66+
# echo "❌ TornadoVM installation check failed"
67+
# exit 1
68+
# fi
69+
# Step 1: Clone and build TornadoVM
70+
- name: Clone TornadoVM master
4671
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
72+
git clone --depth 1 --branch master \
73+
https://github.com/beehive-lab/TornadoVM.git \
74+
$TORNADO_ROOT
75+
- name: Set up Python venv for TornadoVM
76+
run: |
77+
python3 -m venv $TORNADO_ROOT/venv
78+
source $TORNADO_ROOT/venv/bin/activate
79+
python --version
80+
- name: Build TornadoVM
81+
run: |
82+
cd $TORNADO_ROOT
83+
mkdir -p graalJars && cp $GRAAL_JARS/* graalJars/
84+
source venv/bin/activate
85+
echo "=== Building TornadoVM ==="
86+
87+
make BACKEND=${{ matrix.backend.name }}
88+
89+
echo "=== Searching for TornadoVM SDK directory ==="
90+
SDK_DIR=$(find dist -type d -maxdepth 3 -path "*/tornadovm-*-${{ matrix.backend.name }}" | head -n 1)
91+
if [ -z "$SDK_DIR" ]; then
92+
echo "::error::Could not locate TornadoVM SDK directory!"
93+
find dist -maxdepth 5 -type d
94+
exit 1
6595
fi
96+
FULL_SDK="${PWD}/${SDK_DIR}"
97+
echo "Detected TornadoVM SDK: $FULL_SDK"
98+
99+
# Export for current shell session
100+
export TORNADO_SDK="$FULL_SDK"
101+
export PATH="$FULL_SDK/bin:$JAVA_HOME/bin:$PATH"
102+
103+
# Save for subsequent steps
104+
echo "TORNADO_SDK=$FULL_SDK" >> $GITHUB_ENV
105+
echo "PATH=$PATH" >> $GITHUB_ENV
106+
107+
echo "=== Checking tornado CLI ==="
108+
which tornado || { echo "::error::tornado not in PATH"; exit 1; }
109+
tornado --devices
66110
67111
# Step 2: Clone Quarkus LangChain4j
68112
- name: Clone Quarkus LangChain4j
@@ -90,20 +134,19 @@ jobs:
90134
cd ${{ github.workspace }}/quarkus-langchain4j/integration-tests/gpu-llama3
91135
export PATH="$TORNADO_SDK/bin:$JAVA_HOME/bin:$PATH"
92136
93-
# Set model path
94-
MODEL_PATH="${MODELS_DIR}/Llama-3.2-1B-Instruct-F16.gguf"
95-
export MODEL_PATH
137+
echo "Running Quarkus-Langchain4j integration test on port $QUARKUS_PORT"
96138
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 &
139+
# Start the Quarkus application in the background
140+
java @"$TORNADO_SDK/tornado-argfile" \
141+
-Dtornado.device.memory=8GB
142+
-Dquarkus.http.port=$QUARKUS_PORT \
143+
-jar target/quarkus-app/quarkus-run.jar &
101144
APP_PID=$!
102145
103146
# Wait for the application to start
104-
echo "Waiting for application to start..."
147+
echo "Starting Quarkus application on port $QUARKUS_PORT..."
105148
for i in {1..30}; do
106-
if curl -s http://localhost:8080/q/health > /dev/null 2>&1; then
149+
if curl -s http://localhost:$QUARKUS_PORT/q/health > /dev/null 2>&1; then
107150
echo "✅ Application started successfully"
108151
break
109152
elif [ $i -eq 30 ]; then
@@ -115,38 +158,12 @@ jobs:
115158
fi
116159
done
117160
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
161+
# Trigger endpoints
162+
BLOCKING_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:$QUARKUS_PORT/chat/blocking)
163+
STREAMING_RESPONSE=$(timeout 10s curl -s -w "%{http_code}" http://localhost:$QUARKUS_PORT/chat/streaming)
148164
149-
echo "✅ GPULlama3 integration test completed"
165+
echo "Blocking endpoint HTTP code: ${BLOCKING_RESPONSE: -3}"
166+
echo "Streaming endpoint HTTP code: ${STREAMING_RESPONSE: -3}"
150167
151168
# Clean shutdown
152169
kill $APP_PID || true

0 commit comments

Comments
 (0)