-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-optimizations.sh
More file actions
executable file
·142 lines (125 loc) · 4.17 KB
/
test-optimizations.sh
File metadata and controls
executable file
·142 lines (125 loc) · 4.17 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/bash
# Test script for Docker caching optimizations
# This script validates the changes made to improve CI build times
set -euo pipefail
echo "🧪 Testing Docker Caching Optimizations"
echo "========================================"
# Check if we're in the right directory
if [ ! -f "build_context/Dockerfile.haskell" ]; then
echo "❌ Error: Must run from haskell-tex-dev root directory"
exit 1
fi
echo "✅ Found Dockerfile.haskell"
# Test 1: Verify Python dev libraries are included
echo ""
echo "🔍 Test 1: Checking Python development libraries..."
if grep -q "python3-dev" build_context/Dockerfile.haskell; then
echo "✅ python3-dev found in Dockerfile"
else
echo "❌ python3-dev missing from Dockerfile"
exit 1
fi
if grep -q "libpython3-dev" build_context/Dockerfile.haskell; then
echo "✅ libpython3-dev found in Dockerfile"
else
echo "❌ libpython3-dev missing from Dockerfile"
exit 1
fi
if grep -q "libpython3.12-dev" build_context/Dockerfile.haskell; then
echo "✅ libpython3.12-dev found in Dockerfile"
else
echo "❌ libpython3.12-dev missing from Dockerfile"
exit 1
fi
# Test 2: Verify index state synchronization
echo ""
echo "🔍 Test 2: Checking Cabal index state synchronization..."
if grep -q "index-state: 2025-09-23T01:29:59Z" build_context/Dockerfile.haskell; then
echo "✅ Index state synchronized to 2025-09-23T01:29:59Z"
else
echo "❌ Index state not synchronized"
exit 1
fi
# Test 3: Verify critical packages in deps-list.txt
echo ""
echo "🔍 Test 3: Checking critical packages in deps-list.txt..."
critical_packages=(
"wreq"
"xml"
"xml-conduit"
"html-conduit"
"websockets"
"wai"
"warp"
"miso"
"pandoc-types"
"lens"
)
for package in "${critical_packages[@]}"; do
if grep -q "^${package}$" build_context/deps-list.txt; then
echo "✅ $package found in deps-list.txt"
else
echo "❌ $package missing from deps-list.txt"
exit 1
fi
done
# Test 4: Verify direct package installation section
echo ""
echo "🔍 Test 4: Checking direct package installation section..."
if grep -q "DIRECT PACKAGE INSTALLATION FOR CRITICAL DEPENDENCIES" build_context/Dockerfile.haskell; then
echo "✅ Direct package installation section found"
else
echo "❌ Direct package installation section missing"
exit 1
fi
if grep -q "cabal install --lib" build_context/Dockerfile.haskell; then
echo "✅ Direct cabal install command found"
else
echo "❌ Direct cabal install command missing"
exit 1
fi
# Test 5: Verify optimization labels
echo ""
echo "🔍 Test 5: Checking optimization labels..."
if grep -q "python-ffi-support" build_context/Dockerfile.haskell; then
echo "✅ Python FFI support label found"
else
echo "❌ Python FFI support label missing"
exit 1
fi
if grep -q "web-frameworks-cached" build_context/Dockerfile.haskell; then
echo "✅ Web frameworks cached label found"
else
echo "❌ Web frameworks cached label missing"
exit 1
fi
# Test 6: Count total packages in deps-list.txt
echo ""
echo "🔍 Test 6: Counting packages in deps-list.txt..."
total_packages=$(grep -v '^#' build_context/deps-list.txt | grep -v '^$' | wc -l)
echo "📊 Total packages in deps-list.txt: $total_packages"
if [ "$total_packages" -ge 50 ]; then
echo "✅ Sufficient packages for comprehensive caching"
else
echo "⚠️ Consider adding more packages for better caching"
fi
echo ""
echo "🎉 All optimization tests passed!"
echo ""
echo "📋 Summary of optimizations applied:"
echo " ✅ Python development libraries added"
echo " ✅ Cabal index states synchronized"
echo " ✅ Critical packages added to deps-list.txt"
echo " ✅ Direct package installation implemented"
echo " ✅ Optimization labels updated"
echo ""
echo "🚀 Expected improvements:"
echo " • 60-80% reduction in dependency build time"
echo " • Python FFI builds working without system installation"
echo " • Better Docker layer caching"
echo " • Consistent package versions across builds"
echo ""
echo "💡 Next steps:"
echo " 1. Build the updated Docker image"
echo " 2. Test with your downstream CI pipeline"
echo " 3. Monitor build time improvements"