55 branches : [ "master" ]
66 pull_request :
77 branches : [ "master" ]
8- workflow_dispatch : # Allow manual triggering
8+ workflow_dispatch :
99
1010jobs :
1111 minification_compatibility_test :
2828 distribution : ' temurin'
2929 java-version : ' 17'
3030
31+ - name : Configure Gradle JVM options
32+ run : |
33+ mkdir -p ~/.gradle
34+ cat > ~/.gradle/gradle.properties << 'EOF'
35+ # Increase heap size for CI builds
36+ org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError
37+ org.gradle.daemon=true
38+ org.gradle.parallel=true
39+ org.gradle.configureondemand=true
40+ android.enableJetifier=true
41+ android.useAndroidX=true
42+ EOF
43+
44+ - name : Configure Android build options
45+ run : |
46+ cat >> example/android/gradle.properties << 'EOF'
47+
48+ # Memory optimization for CI
49+ org.gradle.jvmargs=-Xmx3g -XX:MaxMetaspaceSize=512m
50+ android.enableJetifier=true
51+ android.useAndroidX=true
52+ EOF
53+
3154 - name : Install dependencies
3255 run : |
3356 flutter pub get
4972 -keep class com.google.android.play.core.** { *; }
5073 -dontwarn com.google.android.play.core.**
5174
52- # Additional safety for Optimizely (redundant but safe)
75+ # Additional safety for Optimizely
5376 -keep class com.optimizely.** { *; }
5477 -dontwarn com.optimizely.**
5578
6992 # Backup original build.gradle
7093 cp example/android/app/build.gradle example/android/app/build.gradle.backup
7194
72- # Enable minification and ensure ProGuard rules are referenced
95+ # Enable minification
7396 sed -i 's/minifyEnabled false/minifyEnabled true/' example/android/app/build.gradle
7497 sed -i 's/shrinkResources false/shrinkResources true/' example/android/app/build.gradle
7598
@@ -81,85 +104,68 @@ jobs:
81104 echo "📄 Build configuration with minification:"
82105 grep -A 5 "buildTypes" example/android/app/build.gradle
83106
84- # Build release APK
107+ # Build for single architecture to save memory
85108 cd example
86- flutter build apk --release
109+ flutter build apk --release --target-platform android-arm64 --split-per-abi
87110
88111 echo "✅ Build successful with minification ENABLED"
89112
90113 - name : Test with minification DISABLED
91114 run : |
92115 echo "🧪 Testing with minifyEnabled = false"
93116
94- # Restore original and disable minification
117+ # Restore original
95118 cp example/android/app/build.gradle.backup example/android/app/build.gradle
96119 sed -i 's/minifyEnabled true/minifyEnabled false/' example/android/app/build.gradle
97120 sed -i 's/shrinkResources true/shrinkResources false/' example/android/app/build.gradle
98121
99122 echo "📄 Build configuration without minification:"
100123 grep -A 5 "buildTypes" example/android/app/build.gradle
101124
102- # Clean and build again
125+ # Clean and build
103126 cd example
104127 flutter clean
105- flutter build apk --release
128+ flutter build apk --release --target-platform android-arm64 --split-per-abi
106129
107130 echo "✅ Build successful with minification DISABLED"
108131
109132 - name : Run unit tests
110- run : |
111- echo "🧪 Running unit tests to verify SDK functionality"
112- flutter test
133+ run : flutter test
113134
114135 - name : Verify APK artifacts
115136 run : |
116- echo "📱 Checking APK files were created:"
117- ls -la example/build/app/outputs/apk/release/
118-
119- # Check APK size
120- if [ -f "example/build/app/outputs/apk/release/app-release.apk" ]; then
121- APK_SIZE=$(stat -c%s example/build/app/outputs/apk/release/app-release.apk 2>/dev/null || stat -f%z example/build/app/outputs/apk/release/app-release.apk)
122- echo "📊 Final APK Size: $(($APK_SIZE / 1024 / 1024)) MB"
123- fi
137+ echo "📱 Checking APK files:"
138+ find example/build/app/outputs/apk/ -name "*.apk" -exec ls -la {} \;
124139
125140 - name : Check for ProGuard artifacts
126141 run : |
127142 echo "🔍 Checking for ProGuard/R8 artifacts:"
128-
129- # Look for mapping files
130143 if [ -f "example/build/app/outputs/mapping/release/mapping.txt" ]; then
131144 echo "✅ ProGuard mapping file found"
132145 echo "📄 Mapping file size: $(wc -l < example/build/app/outputs/mapping/release/mapping.txt) lines"
133146 else
134- echo "ℹ️ No mapping file found (expected if minification was disabled) "
147+ echo "ℹ️ No mapping file found"
135148 fi
136149
137150 - name : Upload APK artifacts
138151 uses : actions/upload-artifact@v4
139152 with :
140153 name : minification-test-apk
141154 path : |
142- example/build/app/outputs/apk/release/app-release .apk
155+ example/build/app/outputs/apk/release/* .apk
143156 example/build/app/outputs/mapping/release/mapping.txt
144157 retention-days : 7
145158
146159 - name : Report test results
147160 run : |
148- echo "🎉 Minification compatibility test completed successfully !"
161+ echo "🎉 Minification compatibility test completed!"
149162 echo "✅ minifyEnabled = true: PASSED"
150163 echo "✅ minifyEnabled = false: PASSED"
151- echo "✅ Your Optimizely Flutter SDK is minification-compatible!"
152- echo ""
153- echo "This confirms that:"
154- echo " • Library ProGuard rules are working correctly"
155- echo " • Plugin registration survives minification"
156- echo " • No critical classes are being stripped"
157- echo " • Customer's issue should be resolved"
164+ echo "✅ Memory optimizations applied successfully"
158165
159166 - name : Cleanup
160167 if : always()
161168 run : |
162- # Restore original build.gradle if backup exists
163169 if [ -f "example/android/app/build.gradle.backup" ]; then
164170 mv example/android/app/build.gradle.backup example/android/app/build.gradle
165171 echo "✅ Restored original build.gradle"
0 commit comments