-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathtest-all-packages.sh
More file actions
executable file
Β·106 lines (84 loc) Β· 2.57 KB
/
test-all-packages.sh
File metadata and controls
executable file
Β·106 lines (84 loc) Β· 2.57 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
#!/bin/bash
# Comprehensive linter test script for all mobile packages and apps
# This script runs flutter analyze on all packages and apps to catch issues before CI
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
total_packages=0
failed_packages=0
total_warnings=0
total_errors=0
failed_list=()
echo "================================================"
echo "Testing Mobile Packages Linter"
echo "================================================"
echo ""
# Function to test a package
test_package() {
local pkg_path=$1
local pkg_name=$(basename "$pkg_path")
echo -n "Testing $pkg_name... "
cd "$pkg_path"
# Run pub get silently
flutter pub get > /dev/null 2>&1
# Run analyze and capture output
output=$(flutter analyze --no-fatal-infos 2>&1)
warnings=$(echo "$output" | grep -c "warning β’" || true)
errors=$(echo "$output" | grep -c "error β’" || true)
total_packages=$((total_packages + 1))
total_warnings=$((total_warnings + warnings))
total_errors=$((total_errors + errors))
if [ "$warnings" -gt 0 ] || [ "$errors" -gt 0 ]; then
echo -e "${RED}FAILED${NC} ($errors errors, $warnings warnings)"
failed_packages=$((failed_packages + 1))
failed_list+=("$pkg_name")
echo "$output" | grep -E "warning β’|error β’"
echo ""
else
echo -e "${GREEN}PASSED${NC}"
fi
cd - > /dev/null
}
# Test all packages
echo "=== Testing Packages ==="
for pkg in mobile/packages/*/; do
# Skip if not a directory or if it's a hidden directory
if [ ! -d "$pkg" ] || [[ $(basename "$pkg") == .* ]]; then
continue
fi
# Skip rust package (tested separately)
if [[ $(basename "$pkg") == "rust" ]]; then
continue
fi
test_package "$pkg"
done
echo ""
echo "=== Testing Apps ==="
# Test photos app
test_package "mobile/apps/photos"
# Test auth app
test_package "mobile/apps/auth"
# Test locker app
test_package "mobile/apps/locker"
echo ""
echo "================================================"
echo "Summary"
echo "================================================"
echo "Total packages/apps tested: $total_packages"
echo "Total errors: $total_errors"
echo "Total warnings: $total_warnings"
if [ "$failed_packages" -gt 0 ]; then
echo -e "${RED}Failed packages/apps: $failed_packages${NC}"
echo "Failed list:"
for pkg in "${failed_list[@]}"; do
echo " - $pkg"
done
echo ""
echo -e "${RED}β LINTER CHECKS FAILED${NC}"
exit 1
else
echo -e "${GREEN}β
ALL LINTER CHECKS PASSED${NC}"
exit 0
fi