Skip to content

Created a AI module to test different AI providers #561

Created a AI module to test different AI providers

Created a AI module to test different AI providers #561

Workflow file for this run

name: "CI - e2e tests"
on:
push:
branches: [ main ]
paths-ignore:
- '.github/project.yml'
- 'README.md'
- 'docs/**'
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
analysis_tool:
description: 'Preferred scanner technology to use'
required: true
default: 'openrewrite'
type: choice
options:
- jdtls
- openrewrite
jobs:
setup:
name: "Setup, build the migration tool and install the spring todo application"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21
- name: Setup JBang
uses: jbangdev/setup-jbang@main
- name: Build the project with Maven
run: |
mvn clean install -ntp -B -DskipTests
echo "Maven build exit code: $?"
echo "Install the runner application using jbang"
jbang app install --name mtool migration-cli/target/migration-cli-*-runner.jar
- name: Install konveyor jdt-ls
if: ${{ inputs.analysis_tool == 'jdtls' || github.event_name != 'workflow_dispatch' }}
run: |
export VERSION=latest
ID=$(docker create --name kantra-download quay.io/konveyor/kantra:$VERSION)
mkdir -p ./jdt
docker cp $ID:/jdtls ./jdt/konveyor-jdtls
docker rm $ID
- name: Run analysis
run: |
echo "🔍 Starting scanner analysis..."
# Determine analysis tool to use
if [[ "${{ inputs.analysis_tool }}" == "openrewrite" ]]; then
SCANNER="openrewrite"
REPORT_PATTERN="*analysing-openrewrite-report*"
else
SCANNER="jdtls"
REPORT_PATTERN="*analysing-jdtls-report*"
fi
# For non-workflow_dispatch events, default to openrewrite
if [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then
SCANNER="openrewrite"
REPORT_PATTERN="*analysing-openrewrite-report*"
fi
echo "Using scanner: $SCANNER"
# Set environment variables for the analysis
export ANALYZER_RULES_PATH="$(pwd)/cookbook/rules/quarkus-spring"
# Set JDT-LS specific environment variables only if using jdtls
if [[ "$SCANNER" == "jdtls" ]]; then
export ANALYZER_JDT_LS_PATH="$(pwd)/jdt/konveyor-jdtls"
export ANALYZER_JDT_WORKSPACE_PATH="$(pwd)/jdt"
# Create jdt workspace directory if it doesn't exist
mkdir -p ./jdt
fi
# Run analysis using the uber jar
timeout 300 mtool analyze ./applications/spring-boot-todo-app -r $ANALYZER_RULES_PATH --scanner $SCANNER|| {
echo "❌ $SCANNER analysis failed or timed out"
echo "Checking for any generated files..."
find ./applications/spring-boot-todo-app -name "$REPORT_PATTERN" -type f 2>/dev/null || true
exit 1
}
- name: Upload analysis results
uses: actions/upload-artifact@v6
if: always()
with:
name: analysis-results
path: ./applications/spring-boot-todo-app/analysing-*-report_*.json
retention-days: 1
- name: Run transformation
run: |
echo "🔄 Starting transformation with quarkus-spring rules..."
# Switch to transform branch
cd ./applications/spring-boot-todo-app
# Run transformation using the uber jar
timeout 300 mtool transform -p openrewrite -v . || {
echo "❌ Transformation failed or timed out"
echo "Current directory contents:"
ls -la
exit 1
}
- name: Build and run Quarkus application
run: |
echo "🚀 Building and starting Quarkus application..."
cd ./applications/spring-boot-todo-app
# Package the application
mvn -ntp -B package -DskipTests || {
echo "❌ Maven package failed"
echo "Build logs:"
cat target/maven-archiver/pom.properties 2>/dev/null || echo "No build info available"
exit 1
}
# Start Quarkus in dev mode in the background
echo "Starting Quarkus application in dev mode..."
timeout 120 mvn quarkus:dev -Dquarkus.http.host=0.0.0.0 &
QUARKUS_PID=$!
# Wait for application to start
echo "Waiting for Quarkus to start..."
for i in {1..30}; do
if [ "$(curl -s http://localhost:8080/q/health | jq -r '.status | . == "UP"')" = "true" ]; then
echo "✅ Quarkus application is running"
break
fi
if [ $i -eq 30 ]; then
echo "❌ Quarkus application failed to start within timeout"
kill $QUARKUS_PID 2>/dev/null || true
exit 1
fi
echo "Attempt $i/30: Waiting for Quarkus to start..."
sleep 4
done
# Health check passed, application is ready
echo "✅ Quarkus transformation test PASSED"
# Clean up
kill $QUARKUS_PID 2>/dev/null || true
wait $QUARKUS_PID 2>/dev/null || true
reporting:
name: "Tests result summary"
if: always()
runs-on: ubuntu-latest
steps:
- name: Download analysis results
uses: actions/download-artifact@v7
with:
name: analysis-results
continue-on-error: true
- name: Upload analysis reports
uses: actions/upload-artifact@v6
with:
name: e2e-analysis-results
path: |
./applications/spring-boot-todo-app/analysing-*-report_*.json
retention-days: 7