AddCI Actions for Quarkus-LangChain4j integration #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Integration Quarkus-LangChain4j | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| types: [opened, synchronize, reopened] | |
| schedule: | |
| # Run every Saturday at 02:30 UTC to catch dependency breakages | |
| - cron: '30 2 * * 6' | |
| 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: true | |
| matrix: | |
| backend: | |
| - name: opencl | |
| - name: ptx | |
| steps: | |
| - name: Checkout GPULlama3 | |
| uses: actions/checkout@v4 | |
| # 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 TORNADOVM_HOME="$FULL_SDK" | |
| export PATH="$FULL_SDK/bin:$JAVA_HOME/bin:$PATH" | |
| # Save for subsequent steps | |
| echo "TORNADOVM_HOME=$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: Build GPULlama3.java | |
| - name: Build GPULlama3.java | |
| run: | | |
| cd ${{ github.workspace }} | |
| echo "Using TORNADOVM_HOME=$TORNADOVM_HOME" | |
| export PATH="$TORNADOVM_HOME/bin:$JAVA_HOME/bin:$PATH" | |
| tornado --version | |
| # Append SNAPSHOT to GPULlama3 version | |
| GPULLAMA3_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| GPULLAMA3_VERSION="${GPULLAMA3_VERSION}-SNAPSHOT" | |
| echo "GPULlama3 version: $GPULLAMA3_VERSION" | |
| ./mvnw versions:set -DnewVersion=$GPULLAMA3_VERSION | |
| # Build | |
| ./mvnw clean install -DskipTests | |
| # Save GPULlama3.java version for subsequent steps | |
| echo "GPULLAMA3_VERSION=$GPULLAMA3_VERSION" >> $GITHUB_ENV | |
| # Step 3: Clone Quarkus LangChain4j | |
| - name: Clone Quarkus LangChain4j | |
| run: | | |
| cd ${{ github.workspace }} | |
| git clone https://github.com/quarkiverse/quarkus-langchain4j.git | |
| # Step 4: Build Quarkus LangChain4j with current GPULlama3.java | |
| - name: Build Quarkus LangChain4j | |
| run: | | |
| cd ${{ github.workspace }}/quarkus-langchain4j | |
| export PATH="$TORNADOVM_HOME/bin:$JAVA_HOME/bin:$PATH" | |
| # Update the GPULlama3 version used by quarkus-langchain4j | |
| RUNTIME_POM="model-providers/gpu-llama3/runtime/pom.xml" | |
| sed -i 's/<version>${gpu-llama3.version}<\/version>/<version>'$GPULLAMA3_VERSION'<\/version>/' "$RUNTIME_POM" | |
| # Use reactor to build *only *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 | |
| # Step 4.5: Verify Local GPULlama3 Usage (Not Maven Central) | |
| - name: Verify Local GPULlama3 Usage | |
| run: | | |
| cd ${{ github.workspace }}/quarkus-langchain4j | |
| echo "=== Verifying GPULlama3 source (Local SNAPSHOT vs Maven Central) ===" | |
| echo "Using GPULlama3 version: $GPULLAMA3_VERSION" | |
| # 1. Check what's in local Maven repository | |
| echo "1. Local Maven repository contents:" | |
| LOCAL_DIR="$HOME/.m2/repository/io/github/beehive-lab/gpu-llama3/${GPULLAMA3_VERSION}" | |
| if [ -d "$LOCAL_DIR" ]; then | |
| ls -la "$LOCAL_DIR/" | |
| if [ -f "$LOCAL_DIR/gpu-llama3-${GPULLAMA3_VERSION}.jar" ]; then | |
| echo "Local jar timestamp: $(stat -c %y $LOCAL_DIR/gpu-llama3-${GPULLAMA3_VERSION}.jar)" | |
| fi | |
| else | |
| echo "ERROR: Local directory not found: $LOCAL_DIR" | |
| exit 1 | |
| fi | |
| # 2. Check resolved dependency source | |
| echo "2. Maven dependency resolution:" | |
| mvn dependency:tree -pl model-providers/gpu-llama3/runtime | grep gpu-llama3 | |
| # 3. Verify no downloads from Maven Central | |
| echo "3. Verifying SNAPSHOT builds don't trigger Maven Central downloads:" | |
| echo "✅ SNAPSHOT versions are never downloaded from Maven Central (only from snapshot repositories)" | |
| # 4. Confirm the artifact is present and being used | |
| echo "4. Final verification - local artifact exists and is being used:" | |
| if [ -f "$LOCAL_DIR/gpu-llama3-${GPULLAMA3_VERSION}.jar" ]; then | |
| echo "✅ SUCCESS: Using local SNAPSHOT build" | |
| ls -lh "$LOCAL_DIR/gpu-llama3-${GPULLAMA3_VERSION}.jar" | |
| else | |
| echo "❌ ERROR: Local artifact not found at $LOCAL_DIR/gpu-llama3-${GPULLAMA3_VERSION}.jar" | |
| exit 1 | |
| fi | |
| # Step 5: Start Quarkus Application and Wait for Startup | |
| - name: Start Quarkus Application and Wait for Startup | |
| run: | | |
| cd ${{ github.workspace }}/quarkus-langchain4j/integration-tests/gpu-llama3 | |
| export PATH="$TORNADOVM_HOME/bin:$JAVA_HOME/bin:$PATH" | |
| echo "Starting Quarkus application on port $QUARKUS_PORT..." | |
| # Start the Quarkus application in the background | |
| java @"$TORNADOVM_HOME/tornado-argfile" \ | |
| -Dtornado.device.memory=8GB \ | |
| -Dquarkus.http.port=$QUARKUS_PORT \ | |
| -jar target/quarkus-app/quarkus-run.jar & | |
| APP_PID=$! | |
| if [ -z "$APP_PID" ]; then | |
| echo "ERROR: Failed to start Quarkus application" | |
| exit 1 | |
| fi | |
| echo "Waiting for Quarkus application to start..." | |
| # Wait for application to be ready | |
| for i in {1..30}; do | |
| if curl -s http://localhost:$QUARKUS_PORT/q/health > /dev/null 2>&1; then | |
| echo "Application ready after ${i} seconds" | |
| echo "Health endpoint: http://localhost:$QUARKUS_PORT/q/health" | |
| break | |
| elif [ $i -eq 30 ]; then | |
| echo "ERROR: Application failed to start within 30 seconds" | |
| echo "Debugging info:" | |
| echo "- Port: $QUARKUS_PORT" | |
| echo "- Process ID: $APP_PID" | |
| echo "- Health URL: http://localhost:$QUARKUS_PORT/q/health" | |
| kill $APP_PID || true | |
| exit 1 | |
| else | |
| [ $((i % 5)) -eq 0 ] && echo "Still waiting... (${i}s)" | |
| sleep 1 | |
| fi | |
| done | |
| # Step 6: Run test 1 | |
| - name: Trigger Blocking Endpoint | |
| run: | | |
| # Trigger endpoint | |
| HTTP_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:$QUARKUS_PORT/chat/blocking) | |
| HTTP_RESPONSE_CODE="${HTTP_RESPONSE: -3}" | |
| HTTP_RESPONSE_BODY="$HTTP_RESPONSE%???}" | |
| # Check response code | |
| if [ "$HTTP_RESPONSE_CODE" != "200" ]; then | |
| echo "ERROR: Blocking endpoint returned HTTP code $HTTP_RESPONSE_CODE" | |
| exit 1 | |
| else | |
| echo "SUCCESS: Blocking endpoint returned HTTP code: ${HTTP_RESPONSE: -3}" | |
| echo "HTTP Response body: $HTTP_RESPONSE_BODY" | |
| fi | |
| # Step 7: Run test 2 | |
| - name: Trigger Streaming Endpoint | |
| run: | | |
| # Trigger endpoint | |
| HTTP_RESPONSE=$(timeout 10s curl -s -w "%{http_code}" http://localhost:$QUARKUS_PORT/chat/streaming) | |
| HTTP_RESPONSE_CODE="${HTTP_RESPONSE: -3}" | |
| HTTP_RESPONSE_BODY="$HTTP_RESPONSE%???}" | |
| # Check response code | |
| if [ "$HTTP_RESPONSE_CODE" != "200" ]; then | |
| echo "ERROR: Streaming endpoint returned HTTP code $HTTP_RESPONSE_CODE" | |
| exit 1 | |
| else | |
| echo "SUCCESS: Streaming endpoint returned HTTP code: ${HTTP_RESPONSE: -3}" | |
| echo "HTTP Response body: $HTTP_RESPONSE_BODY" | |
| fi | |
| # Step 8: Cleanup & Shutdown | |
| - name: Cleanup & Shutdown | |
| run: | | |
| # Clean shutdown | |
| kill $APP_PID || true | |
| wait $APP_PID 2>/dev/null || true |