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