|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Store the root directory (where mvnw is located) |
| 4 | +ROOT_DIR="$(pwd)" |
| 5 | + |
| 6 | +# Check if we're in the correct directory |
| 7 | +if [ ! -f "./mvnw" ]; then |
| 8 | + echo "Error: Must be run from directory containing mvnw" |
| 9 | + exit 1 |
| 10 | +fi |
| 11 | + |
| 12 | +# Check if vector-store directory exists |
| 13 | +if [ ! -d "./vector-stores" ]; then |
| 14 | + echo "Error: vector-stores directory not found" |
| 15 | + exit 1 |
| 16 | +fi |
| 17 | + |
| 18 | +# Function to log with timestamp |
| 19 | +log() { |
| 20 | + echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" |
| 21 | +} |
| 22 | + |
| 23 | +# Get list of directories |
| 24 | +log "Finding directories under ./vector-store" |
| 25 | +directories=$(find ./vector-stores -type d -mindepth 1) |
| 26 | + |
| 27 | +if [ -z "$directories" ]; then |
| 28 | + log "No directories found under ./vector-stores" |
| 29 | + exit 1 |
| 30 | +fi |
| 31 | + |
| 32 | +# Print found directories |
| 33 | +log "Found directories:" |
| 34 | +echo "$directories" | sed 's/^/ /' |
| 35 | + |
| 36 | +# Process each directory |
| 37 | +while IFS= read -r dir; do |
| 38 | + log "Processing directory: $dir" |
| 39 | + cd "$dir" || continue |
| 40 | + |
| 41 | + log "Running Maven integration tests for $dir" |
| 42 | + # Use the mvnw from the root directory |
| 43 | + "$ROOT_DIR/mvnw" package -Pintegration-tests |
| 44 | + |
| 45 | + build_status=$? |
| 46 | + if [ $build_status -eq 0 ]; then |
| 47 | + log "Maven build completed successfully for $dir" |
| 48 | + else |
| 49 | + log "Maven build failed for $dir" |
| 50 | + # Return to root directory before exiting |
| 51 | + cd "$ROOT_DIR" |
| 52 | + exit 1 |
| 53 | + fi |
| 54 | + |
| 55 | + # Return to root directory for next iteration |
| 56 | + cd "$ROOT_DIR" |
| 57 | +done <<< "$directories" |
| 58 | + |
| 59 | +log "All directories processed successfully" |
0 commit comments