Skip to content

Commit e3243ab

Browse files
samvelkochclaude
andcommitted
ci: add GitHub Actions workflow to build Android APK on Ubuntu
Builds APK using buildozer on Ubuntu 22.04 (Linux) to avoid macOS-specific SDL2_image cross-compilation issue where libSDL2_image.so cannot load PNG files on Android. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4288b01 commit e3243ab

2 files changed

Lines changed: 65 additions & 8 deletions

File tree

.github/workflows/build-apk.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build Android APK
2+
3+
on:
4+
push:
5+
branches: [ feature/material-design ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-22.04
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.11'
20+
21+
- name: Install system dependencies
22+
run: |
23+
sudo apt-get update
24+
sudo apt-get install -y \
25+
git zip unzip openjdk-17-jdk \
26+
autoconf libtool pkg-config \
27+
zlib1g-dev libncurses5-dev libncursesw5-dev \
28+
cmake libffi-dev libssl-dev \
29+
python3-pip
30+
31+
- name: Install buildozer and dependencies
32+
run: |
33+
pip install buildozer cython
34+
35+
- name: Cache buildozer global dir
36+
uses: actions/cache@v4
37+
with:
38+
path: ~/.buildozer
39+
key: buildozer-${{ hashFiles('android_app/buildozer.spec') }}
40+
restore-keys: |
41+
buildozer-
42+
43+
- name: Build APK
44+
working-directory: android_app
45+
run: |
46+
buildozer android debug 2>&1 | tee build.log
47+
48+
- name: Upload APK
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: dungeonblackcastle-debug-apk
52+
path: android_app/bin/*.apk
53+
retention-days: 7
54+
55+
- name: Upload build log (on failure)
56+
if: failure()
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: build-log
60+
path: android_app/build.log

android_app/buildozer.spec

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
[app]
2-
title = Подземелья Чёрного замка
3-
package.name = dungeonblackcastle
2+
title = Подземелья Чёрного замка (MD)
3+
package.name = dungeonblackcastlemd
44
package.domain = org.braslavsky
55

66
source.dir = .
7+
source.main = main_md.py
78
source.include_exts = py,json,ttf,png
89
source.include_patterns = assets/*,icons/*,sections.json,TwemojiMozilla.ttf,ArialUnicode.ttf
910

10-
version = 1.0
11+
version = 2.0
1112

13+
# kivymd уже присутствует в requirements
1214
requirements = python3,kivy==2.3.0,kivymd,pyjnius==1.6.1
1315

14-
1516
# Иконка (добавь файл icon.png 512x512 в android_app/)
1617
# icon.filename = %(source.dir)s/icon.png
1718
# presplash.filename = %(source.dir)s/presplash.png
@@ -25,14 +26,10 @@ android.minapi = 24
2526
android.ndk = 25b
2627
android.archs = arm64-v8a, armeabi-v7a
2728

28-
# Разрешить установку из неизвестных источников не нужно — это сторона пользователя
2929
android.allow_backup = True
3030

31-
# Логи при отладке
3231
log_level = 2
3332

3433
[buildozer]
35-
# Директория для кэша buildozer (SDK, NDK, etc.)
36-
# Занимает ~4 GB — убедитесь что места достаточно
3734
build_dir = ./.buildozer
3835
bin_dir = ./bin

0 commit comments

Comments
 (0)