-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate-android-build.sh
More file actions
executable file
Β·141 lines (117 loc) Β· 5.27 KB
/
Copy pathvalidate-android-build.sh
File metadata and controls
executable file
Β·141 lines (117 loc) Β· 5.27 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
#!/bin/bash
# APK Build System Validation Script
# Tests the Android build structure without requiring network access
echo "π Android APK Build System Validation"
echo "======================================"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Test counters
TESTS_PASSED=0
TESTS_TOTAL=0
# Helper function to run tests
test_item() {
local description="$1"
local test_command="$2"
TESTS_TOTAL=$((TESTS_TOTAL + 1))
if eval "$test_command" >/dev/null 2>&1; then
echo -e "β
${GREEN}PASS${NC}: $description"
TESTS_PASSED=$((TESTS_PASSED + 1))
else
echo -e "β ${RED}FAIL${NC}: $description"
fi
}
echo ""
echo "π Project Structure Tests"
echo "--------------------------"
test_item "Root settings.gradle exists" "[ -f settings.gradle ]"
test_item "Root build.gradle exists" "[ -f build.gradle ]"
test_item "Gradle wrapper script exists" "[ -f gradlew ]"
test_item "Gradle wrapper executable" "[ -x gradlew ]"
test_item "Gradle wrapper properties exist" "[ -f gradle/wrapper/gradle-wrapper.properties ]"
test_item "Gradle wrapper JAR exists" "[ -f gradle/wrapper/gradle-wrapper.jar ]"
echo ""
echo "π± Android Module Tests"
echo "----------------------"
test_item "Android directory exists" "[ -d android ]"
test_item "Android build.gradle exists" "[ -f android/build.gradle ]"
test_item "Android manifest exists" "[ -f android/src/main/AndroidManifest.xml ]"
test_item "MainActivity.kt exists" "[ -f android/src/main/java/com/pokermon/android/MainActivity.kt ]"
test_item "Theme files exist" "[ -f android/src/main/java/com/pokermon/android/ui/theme/Theme.kt ]"
echo ""
echo "π§ Configuration Content Tests"
echo "------------------------------"
test_item "settings.gradle includes android module" "grep -q ':android' settings.gradle"
test_item "Root build.gradle has Android plugin" "grep -q 'com.android.tools.build:gradle' build.gradle"
test_item "Android build.gradle has correct namespace" "grep -q 'com.pokermon.android' android/build.gradle"
test_item "Android build.gradle has dynamic version" "grep -q 'versionName.*rootProject.version' android/build.gradle"
test_item "MainActivity has correct package" "grep -q 'package com.pokermon.android' android/src/main/java/com/pokermon/android/MainActivity.kt"
echo ""
echo "π CI/CD Integration Tests"
echo "--------------------------"
test_item "CI workflow exists" "[ -f .github/workflows/ci.yml ]"
test_item "CI includes android-build job" "grep -q 'android-build:' .github/workflows/ci.yml"
test_item "CI has Android SDK setup" "grep -q 'setup-android' .github/workflows/ci.yml"
test_item "CI builds APK" "grep -q 'assembleDebug' .github/workflows/ci.yml"
test_item "CI uploads APK artifacts" "grep -q 'artifact-name: pokermon-android' .github/workflows/ci.yml"
echo ""
echo "π Build File Analysis"
echo "----------------------"
# Check Gradle versions
if [ -f gradle/wrapper/gradle-wrapper.properties ]; then
GRADLE_VERSION=$(grep "gradle-.*-bin.zip" gradle/wrapper/gradle-wrapper.properties | sed -n 's/.*gradle-\([0-9.]*\)-bin.zip/\1/p')
echo "π¦ Gradle Version: $GRADLE_VERSION"
fi
# Check Android versions
if [ -f android/build.gradle ]; then
COMPILE_SDK=$(grep "compileSdk" android/build.gradle | sed -n 's/.*compileSdk \([0-9]*\)/\1/p')
MIN_SDK=$(grep "minSdk" android/build.gradle | sed -n 's/.*minSdk \([0-9]*\)/\1/p')
TARGET_SDK=$(grep "targetSdk" android/build.gradle | sed -n 's/.*targetSdk \([0-9]*\)/\1/p')
VERSION_NAME=$(grep "versionName" android/build.gradle | sed -n 's/.*versionName "\([^"]*\)"/\1/p')
echo "π± Android Compile SDK: $COMPILE_SDK"
echo "π± Android Min SDK: $MIN_SDK (Android 9.0+)"
echo "π± Android Target SDK: $TARGET_SDK"
echo "π± App Version: $VERSION_NAME"
fi
echo ""
echo "π― Expected Build Outputs"
echo "-------------------------"
echo "π¦ JAR Output: shared/build/libs/shared-*-fat.jar"
echo "π± APK Output: android/build/outputs/apk/debug/android-debug.apk"
echo ""
echo "π Network Connectivity Test"
echo "----------------------------"
# Test if we can resolve Google's Maven repo (this will fail in sandbox)
if ping -c 1 dl.google.com >/dev/null 2>&1; then
echo -e "β
${GREEN}Network access available${NC} - APK build should work"
# If network is available, try a quick build test
echo ""
echo "π¨ Quick Build Test"
echo "------------------"
if ./gradlew tasks --no-daemon >/dev/null 2>&1; then
echo -e "β
${GREEN}Gradle execution successful${NC}"
else
echo -e "β ${RED}Gradle execution failed${NC}"
fi
else
echo -e "β οΈ ${YELLOW}Network limited (sandbox environment)${NC}"
echo " This is expected in sandboxed environments"
echo " APK build will work in GitHub Actions with full internet access"
fi
echo ""
echo "π Test Results Summary"
echo "======================"
echo "Tests Passed: $TESTS_PASSED/$TESTS_TOTAL"
if [ $TESTS_PASSED -eq $TESTS_TOTAL ]; then
echo -e "π ${GREEN}ALL TESTS PASSED${NC}"
echo "β
Android APK build system is properly configured"
echo "β
CI/CD integration is complete"
echo "β
Ready for production deployment"
exit 0
else
FAILED=$((TESTS_TOTAL - TESTS_PASSED))
echo -e "β οΈ ${YELLOW}$FAILED test(s) failed${NC}"
exit 1
fi