Introduce CI Actions for Quarkus-LangChain4j integration tests with G… #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: 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 | |
| MODELS_DIR: /opt/models | |
| 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 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 2: Clone Quarkus LangChain4j from your fork | |
| - name: Clone Quarkus LangChain4j | |
| run: | | |
| cd ${{ github.workspace }} | |
| git clone --branch gpu-llama3-ci-support https://github.com/orionpapadakis/quarkus-langchain4j.git | |
| echo "✅ Quarkus LangChain4j cloned from fork" | |
| # 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" | |
| # Set model path | |
| MODEL_PATH="${MODELS_DIR}/Llama-3.2-1B-Instruct-F16.gguf" | |
| export MODEL_PATH | |
| echo "Running Quarkus-Langchain4j integration test with model: $MODEL_PATH" | |
| # Start the app with the test profile | |
| java -jar target/quarkus-app/quarkus-run.jar \ | |
| -Dquarkus.profile=test \ | |
| @"$TORNADO_SDK/tornado-argfile" & | |
| APP_PID=$! | |
| # Wait for the application to start | |
| echo "Starting Quarkus application..." | |
| for i in {1..30}; do | |
| if curl -s http://localhost:8080/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 | |
| # Test endpoints | |
| BLOCKING_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:8080/chat/blocking) | |
| STREAMING_RESPONSE=$(timeout 10s curl -s -w "%{http_code}" http://localhost:8080/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" |