Skip to content

Introduce CI Actions for Quarkus-LangChain4j integration tests with G… #16

Introduce CI Actions for Quarkus-LangChain4j integration tests with G…

Introduce CI Actions for Quarkus-LangChain4j integration tests with G… #16

name: Quarkus LangChain4j Integration Tests
on:
# Temporarily disabled - manual trigger only
push:
branches: [ main, ci/quarkus-langchain4j-IT ]
# pull_request:
# branches: [ main ]
# types: [opened, synchronize, reopened]
# schedule:
# # Run daily at 02:30 UTC to catch dependency breakages
# - cron: '30 2 * * *'
workflow_dispatch:
inputs:
quarkus_langchain4j_version:
description: 'Quarkus LangChain4j version to test against'
required: false
type: string
quarkus_version:
description: 'Quarkus platform version to test against'
required: false
type: string
env:
JAVA_HOME: /opt/jenkins/jdks/graal-23.1.0/jdk-21.0.3
TORNADO_ROOT: ${{ github.workspace }}/GPULlama3.java/external/tornadovm
GRAAL_JARS: /opt/graalJars
QUARKUS_PORT: 8081
jobs:
quarkus-integration-test:
if: github.repository == 'beehive-lab/GPULlama3.java'
runs-on: [self-hosted]
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
backend:
- name: opencl
#- name: ptx
steps:
- name: Checkout GPULlama3
uses: actions/checkout@v4
# # Step 1: Install TornadoVM
# - name: Install TornadoVM
# run: |
# cd ${{ github.workspace }}
#
# wget https://github.com/beehive-lab/TornadoVM/releases/download/v2.1.0/tornadovm-2.1.0-${{ matrix.backend.name }}-linux-amd64.zip
# unzip tornadovm-2.1.0-${{ matrix.backend.name }}-linux-amd64.zip
#
# # Export environment for the current shell
# export TORNADO_SDK="${{ github.workspace }}/tornadovm-2.1.0-${{ matrix.backend.name }}"
# export PATH="$TORNADO_SDK/bin:$JAVA_HOME/bin:$PATH"
#
# # Save to GitHub Actions environment for future steps
# echo "TORNADO_SDK=$TORNADO_SDK" >> $GITHUB_ENV
# echo "PATH=$PATH" >> $GITHUB_ENV
#
# # Check TornadoVM installation
# if tornado --devices && tornado --version; then
# echo "✅ TornadoVM installed"
# else
# echo "❌ TornadoVM installation check failed"
# exit 1
# fi
# Step 1: Clone and build TornadoVM
- name: Clone TornadoVM master
run: |
git clone --depth 1 --branch master \
https://github.com/beehive-lab/TornadoVM.git \
$TORNADO_ROOT
- name: Set up Python venv for TornadoVM
run: |
python3 -m venv $TORNADO_ROOT/venv
source $TORNADO_ROOT/venv/bin/activate
python --version
- name: Build TornadoVM
run: |
cd $TORNADO_ROOT
mkdir -p graalJars && cp $GRAAL_JARS/* graalJars/
source venv/bin/activate
echo "=== Building TornadoVM ==="
make BACKEND=${{ matrix.backend.name }}
echo "=== Searching for TornadoVM SDK directory ==="
SDK_DIR=$(find dist -type d -maxdepth 3 -path "*/tornadovm-*-${{ matrix.backend.name }}" | head -n 1)
if [ -z "$SDK_DIR" ]; then
echo "::error::Could not locate TornadoVM SDK directory!"
find dist -maxdepth 5 -type d
exit 1
fi
FULL_SDK="${PWD}/${SDK_DIR}"
echo "Detected TornadoVM SDK: $FULL_SDK"
# Export for current shell session
export TORNADO_SDK="$FULL_SDK"
export PATH="$FULL_SDK/bin:$JAVA_HOME/bin:$PATH"
# Save for subsequent steps
echo "TORNADO_SDK=$FULL_SDK" >> $GITHUB_ENV
echo "PATH=$PATH" >> $GITHUB_ENV
echo "=== Checking tornado CLI ==="
which tornado || { echo "::error::tornado not in PATH"; exit 1; }
tornado --devices
# Step 2: Clone Quarkus LangChain4j
- name: Clone Quarkus LangChain4j
run: |
cd ${{ github.workspace }}
git clone https://github.com/quarkiverse/quarkus-langchain4j.git
echo "✅ Quarkus LangChain4j cloned"
# Step 3: Build Quarkus LangChain4j (optimized)
- name: Build Quarkus LangChain4j
run: |
cd ${{ github.workspace }}/quarkus-langchain4j
export PATH="$TORNADO_SDK/bin:$JAVA_HOME/bin:$PATH"
# Use reactor to build GPULlama3 integration test + dependencies
# This recompiles everything with the same Java version, avoiding compatibility issues
# The -Dtornado flag activates the TornadoVM profile which includes gpu-llama3 module
mvn clean install -pl integration-tests/gpu-llama3 -am -DskipTests -Dtornado
echo "✅ Quarkus LangChain4j built (GPULlama3 integration test + dependencies)"
# Step 4: Run Integration Test
- name: Run Integration Test
run: |
cd ${{ github.workspace }}/quarkus-langchain4j/integration-tests/gpu-llama3
export PATH="$TORNADO_SDK/bin:$JAVA_HOME/bin:$PATH"
echo "Running Quarkus-Langchain4j integration test on port $QUARKUS_PORT"
# Start the Quarkus application in the background
java @"$TORNADO_SDK/tornado-argfile" \
-Dtornado.device.memory=8GB
-Dquarkus.http.port=$QUARKUS_PORT \
-jar target/quarkus-app/quarkus-run.jar &
APP_PID=$!
# Wait for the application to start
echo "Starting Quarkus application on port $QUARKUS_PORT..."
for i in {1..30}; do
if curl -s http://localhost:$QUARKUS_PORT/q/health > /dev/null 2>&1; then
echo "✅ Application started successfully"
break
elif [ $i -eq 30 ]; then
echo "❌ Application failed to start within 30 seconds"
kill $APP_PID || true
exit 1
else
sleep 1
fi
done
# Trigger endpoints
BLOCKING_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:$QUARKUS_PORT/chat/blocking)
STREAMING_RESPONSE=$(timeout 10s curl -s -w "%{http_code}" http://localhost:$QUARKUS_PORT/chat/streaming)
echo "Blocking endpoint HTTP code: ${BLOCKING_RESPONSE: -3}"
echo "Streaming endpoint HTTP code: ${STREAMING_RESPONSE: -3}"
# Clean shutdown
kill $APP_PID || true
wait $APP_PID 2>/dev/null || true
echo "✅ Integration test completed successfully"