-
Notifications
You must be signed in to change notification settings - Fork 0
346 lines (298 loc) Β· 10.2 KB
/
build.yml
File metadata and controls
346 lines (298 loc) Β· 10.2 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
name: Build Manim Android APK (Full Dependencies)
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: false
dotnet: true
haskell: true
large-packages: true
swap-storage: true
- name: Set up Java JDK
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
# ============================================
# SYSTEM DEPENDENCIES FOR BUILDING
# These are needed on the BUILD MACHINE (Linux runner)
# They enable buildozer and p4a to cross-compile for Android
# ============================================
- name: Install Build Tools
run: |
sudo apt-get update
# Essential compiler and build tools
sudo apt-get install -y \
build-essential \
git \
curl \
wget \
pkg-config \
autoconf \
automake \
libtool \
cmake \
ninja-build
print "β Build tools installed"
# ============================================
# GRAPHICS LIBRARY DEVELOPMENT HEADERS
# Needed by p4a for building Cairo/Pango recipes
# ============================================
- name: Install Graphics Libraries (for cross-compilation)
run: |
sudo apt-get install -y \
libcairo2-dev \
libpango1.0-dev \
libpangocairo-1.0-0 \
libfreetype6-dev \
libfreetype-dev \
libharfbuzz-dev \
libharfbuzz0b \
libfribidi-dev \
libfribidi0 \
libpng-dev \
zlib1g-dev \
libjpeg-dev
echo "β Graphics libraries installed"
# ============================================
# VIDEO PROCESSING LIBRARIES
# For building FFmpeg recipes on Android
# ============================================
- name: Install Video Libraries
run: |
sudo apt-get install -y \
ffmpeg \
libavformat-dev \
libavcodec-dev \
libavdevice-dev \
libswscale-dev \
libswresample-dev \
libavutil-dev \
libavfilter-dev
echo "β FFmpeg libraries installed"
# ============================================
# FONT AND TEXT SUPPORT
# ============================================
- name: Install Font Support
run: |
sudo apt-get install -y \
fonts-liberation \
fonts-dejavu-core \
libglib2.0-dev \
libgobject-2.0-dev
echo "β Font support installed"
# ============================================
# LATEX (Optional - comment out to reduce build time)
# ~500MB - used for mathematical equation rendering
# ============================================
- name: Install LaTeX Dependencies
run: |
sudo apt-get install -y \
texlive \
texlive-latex-base \
texlive-latex-extra \
texlive-fonts-extra \
texlive-fonts-recommended \
texlive-science \
cm-super \
dvipng \
dvisvgm
echo "β LaTeX installed"
latex --version | head -2
# ============================================
# ANDROID SDK AND NDK
# ============================================
- name: Set up Android SDK/NDK
uses: android-actions/setup-android@v2
with:
api-level: 33
ndk-version: r25b
cmake-version: 3.22.1
# ============================================
# PYTHON BUILD DEPENDENCIES
# ============================================
- name: Install Python Build Tools
run: |
python -m pip install --upgrade pip setuptools wheel
# Core build tools - CRITICAL versions
pip install \
Cython==0.29.33 \
setuptools-scm \
buildozer \
p4a
echo "β Python build tools installed"
buildozer --version
# ============================================
# PYTHON RUNTIME DEPENDENCIES
# These are for development environment
# (buildozer will package them for Android)
# ============================================
- name: Install Python Runtime Dependencies
run: |
# Main Manim stack
pip install \
numpy \
scipy \
matplotlib \
pillow \
sympy \
pydub \
requests \
watchdog
# Image/video processing
pip install \
opencv-python \
scikit-image \
imageio \
imageio-ffmpeg
# Graphics
pip install \
pycairo \
kivy==2.3.0
echo "β Python runtime dependencies installed"
# ============================================
# VERIFY BUILD ENVIRONMENT
# ============================================
- name: Verify Build Environment
run: |
echo "=== System Libraries ==="
pkg-config --modversion cairo 2>/dev/null && echo "β Cairo" || echo "β Cairo"
pkg-config --modversion pango 2>/dev/null && echo "β Pango" || echo "β Pango"
pkg-config --modversion freetype2 2>/dev/null && echo "β FreeType2" || echo "β FreeType2"
echo ""
echo "=== Development Tools ==="
java -version 2>&1 | head -1
python --version
buildozer --version
echo ""
echo "=== Python Packages (buildozer env) ==="
pip list | grep -E "(numpy|kivy|cython|buildozer|matplotlib)"
# ============================================
# PREPARE BUILDOZER SPEC
# Copy spec file to repo root if needed
# ============================================
- name: Verify buildozer.spec
run: |
if [ ! -f "buildozer.spec" ]; then
echo "ERROR: buildozer.spec not found in repo root!"
exit 1
fi
# Show key configuration
echo "=== buildozer.spec Configuration ==="
grep "^title\|^package.name\|^version\|^android.api\|^android.minapi\|^android.archs" buildozer.spec
# Show requirements
echo ""
echo "=== Requirements ==="
grep -A 20 "^requirements" buildozer.spec
# ============================================
# BUILD APK WITH BUILDOZER
# This creates the final Android APK
# ============================================
- name: Build APK with Buildozer
run: |
echo "Starting Buildozer build..."
echo "This may take 30-90 minutes on first run"
echo ""
# Accept licenses and build
# Use 'yes' to automatically accept Android SDK licenses
yes | buildozer android debug 2>&1 | tee buildozer.log
BUILD_RESULT=$?
echo ""
echo "=== Build Result ==="
if [ $BUILD_RESULT -eq 0 ]; then
echo "β Build successful"
else
echo "β Build failed with code $BUILD_RESULT"
echo ""
echo "=== Last 50 lines of buildozer.log ==="
tail -50 buildozer.log
exit $BUILD_RESULT
fi
# ============================================
# LOCATE AND VERIFY APK
# ============================================
- name: Verify APK Output
if: success()
run: |
echo "=== Searching for APK files ==="
find . -name "*.apk" -type f
APK_COUNT=$(find . -name "*.apk" -type f | wc -l)
echo ""
echo "Found $APK_COUNT APK file(s)"
if [ "$APK_COUNT" -eq 0 ]; then
echo "ERROR: No APK file found!"
echo ""
echo "Checking bin directory:"
ls -lah bin/ 2>/dev/null || echo "bin directory not found"
exit 1
fi
# Show APK details
for apk in $(find . -name "*.apk" -type f); do
echo ""
echo "APK: $apk"
ls -lh "$apk"
echo "Contents (first 30 files):"
unzip -l "$apk" | head -35
done
# ============================================
# UPLOAD ARTIFACTS FOR DOWNLOAD
# ============================================
- name: Upload APK Artifact
if: success()
uses: actions/upload-artifact@v4
with:
name: manim-android-apk
path: bin/*.apk
retention-days: 30
compression-level: 0 # APK already compressed
- name: Upload Build Log
if: always()
uses: actions/upload-artifact@v4
with:
name: buildozer-log
path: buildozer.log
retention-days: 7
# ============================================
# BUILD SUMMARY
# ============================================
- name: Build Summary
if: always()
run: |
echo ""
echo "ββββββββββββββββββββββββββββββββββββββ"
echo "β MANIM ANDROID BUILD COMPLETE β"
echo "ββββββββββββββββββββββββββββββββββββββ"
echo ""
if [ -f "buildozer.log" ]; then
echo "Build log: buildozer.log"
# Count build steps
COMPILE_STEPS=$(grep -c "compile" buildozer.log || true)
LINK_STEPS=$(grep -c "linking" buildozer.log || true)
echo "Compilation steps: $COMPILE_STEPS"
echo "Linking steps: $LINK_STEPS"
# Show final status
echo ""
if grep -q "Building done" buildozer.log; then
echo "β Build completed successfully"
elif grep -q "error\|Error\|ERROR" buildozer.log; then
echo "β Build had errors - check log"
fi
fi
echo ""
echo "π¦ APK Artifacts available for download in Actions"