forked from Haroldwonder/AnchorKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate_all.sh
More file actions
executable file
·68 lines (58 loc) · 1.66 KB
/
validate_all.sh
File metadata and controls
executable file
·68 lines (58 loc) · 1.66 KB
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
60
61
62
63
64
65
66
67
68
#!/bin/bash
set -e
echo "🔍 AnchorKit Pre-Deployment Validation"
echo "========================================"
echo ""
# Check if Python is available
if ! command -v python3 &> /dev/null; then
echo "❌ Python3 is required but not installed"
exit 1
fi
# Check if required Python packages are installed
echo "📦 Checking Python dependencies..."
python3 -c "import jsonschema, toml" 2>/dev/null || {
echo "❌ Missing Python dependencies. Installing..."
pip3 install jsonschema toml --quiet
}
echo "✅ Python dependencies OK"
echo ""
# Validate all configuration files
echo "📋 Validating configuration files..."
CONFIG_DIR="configs"
SCHEMA_FILE="config_schema.json"
FAILED=0
if [ ! -f "$SCHEMA_FILE" ]; then
echo "❌ Schema file not found: $SCHEMA_FILE"
exit 1
fi
for config_file in "$CONFIG_DIR"/*.json "$CONFIG_DIR"/*.toml; do
if [ -f "$config_file" ]; then
echo -n " Validating $(basename "$config_file")... "
if python3 validate_config_strict.py "$config_file" "$SCHEMA_FILE" > /dev/null 2>&1; then
echo "✅"
else
echo "❌"
python3 validate_config_strict.py "$config_file" "$SCHEMA_FILE"
FAILED=1
fi
fi
done
if [ $FAILED -eq 1 ]; then
echo ""
echo "❌ Configuration validation failed"
exit 1
fi
echo ""
echo "✅ All configurations valid"
echo ""
# Run Rust tests
echo "🧪 Running Rust validation tests..."
if cargo test --quiet config 2>&1 | grep -q "test result: ok"; then
echo "✅ Rust tests passed"
else
echo "❌ Rust tests failed"
cargo test config
exit 1
fi
echo ""
echo "🎉 All validations passed! Ready for deployment."