apkfast 2.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. apkfast-2.7.0/.github/workflows/ci.yml +75 -0
  2. apkfast-2.7.0/.github/workflows/device-real.yml +226 -0
  3. apkfast-2.7.0/.github/workflows/device.yml +112 -0
  4. apkfast-2.7.0/.github/workflows/publish.yml +136 -0
  5. apkfast-2.7.0/CHANGELOG.md +406 -0
  6. apkfast-2.7.0/CODE_OF_CONDUCT.md +34 -0
  7. apkfast-2.7.0/CONTRIBUTING.md +46 -0
  8. apkfast-2.7.0/LICENSE +31 -0
  9. apkfast-2.7.0/MANIFEST.in +10 -0
  10. apkfast-2.7.0/PKG-INFO +518 -0
  11. apkfast-2.7.0/README.md +456 -0
  12. apkfast-2.7.0/RELEASE.md +49 -0
  13. apkfast-2.7.0/SECURITY.md +58 -0
  14. apkfast-2.7.0/THIRD_PARTY_NOTICES.md +26 -0
  15. apkfast-2.7.0/apkfast/__init__.py +3 -0
  16. apkfast-2.7.0/apkfast/builder.py +1936 -0
  17. apkfast-2.7.0/apkfast/bundle.py +572 -0
  18. apkfast-2.7.0/apkfast/cache.py +818 -0
  19. apkfast-2.7.0/apkfast/cache_transport.py +403 -0
  20. apkfast-2.7.0/apkfast/cli.py +1072 -0
  21. apkfast-2.7.0/apkfast/completions.py +144 -0
  22. apkfast-2.7.0/apkfast/config_schema.py +146 -0
  23. apkfast-2.7.0/apkfast/device.py +236 -0
  24. apkfast-2.7.0/apkfast/lockfile.py +240 -0
  25. apkfast-2.7.0/apkfast/lunasvg.py +150 -0
  26. apkfast-2.7.0/apkfast/manifest.py +152 -0
  27. apkfast-2.7.0/apkfast/publish.py +462 -0
  28. apkfast-2.7.0/apkfast/raylib.py +274 -0
  29. apkfast-2.7.0/apkfast/resource_cache.py +966 -0
  30. apkfast-2.7.0/apkfast/scaffold.py +549 -0
  31. apkfast-2.7.0/apkfast/sdk_setup.py +436 -0
  32. apkfast-2.7.0/apkfast/sdl.py +309 -0
  33. apkfast-2.7.0/apkfast/signing.py +402 -0
  34. apkfast-2.7.0/apkfast/toolchain.py +352 -0
  35. apkfast-2.7.0/apkfast/webp.py +175 -0
  36. apkfast-2.7.0/apkfast.egg-info/PKG-INFO +518 -0
  37. apkfast-2.7.0/apkfast.egg-info/SOURCES.txt +193 -0
  38. apkfast-2.7.0/apkfast.egg-info/dependency_links.txt +1 -0
  39. apkfast-2.7.0/apkfast.egg-info/entry_points.txt +2 -0
  40. apkfast-2.7.0/apkfast.egg-info/requires.txt +4 -0
  41. apkfast-2.7.0/apkfast.egg-info/top_level.txt +5 -0
  42. apkfast-2.7.0/apkfast.py +22 -0
  43. apkfast-2.7.0/docs/README.md +73 -0
  44. apkfast-2.7.0/docs/aab.md +112 -0
  45. apkfast-2.7.0/docs/animated-svg.md +130 -0
  46. apkfast-2.7.0/docs/app.md +901 -0
  47. apkfast-2.7.0/docs/assets.md +573 -0
  48. apkfast-2.7.0/docs/audio-codecs.md +51 -0
  49. apkfast-2.7.0/docs/audio.md +748 -0
  50. apkfast-2.7.0/docs/build-cache.md +225 -0
  51. apkfast-2.7.0/docs/cache-remote.md +83 -0
  52. apkfast-2.7.0/docs/cache-transport.md +139 -0
  53. apkfast-2.7.0/docs/compatibility.md +62 -0
  54. apkfast-2.7.0/docs/device-ci.md +129 -0
  55. apkfast-2.7.0/docs/device.md +770 -0
  56. apkfast-2.7.0/docs/fonts.md +116 -0
  57. apkfast-2.7.0/docs/graphics-opengl.md +1300 -0
  58. apkfast-2.7.0/docs/graphics-types.md +550 -0
  59. apkfast-2.7.0/docs/graphics-vulkan.md +1078 -0
  60. apkfast-2.7.0/docs/image-formats.md +123 -0
  61. apkfast-2.7.0/docs/incremental.md +98 -0
  62. apkfast-2.7.0/docs/input-helpers.md +717 -0
  63. apkfast-2.7.0/docs/libraries.md +88 -0
  64. apkfast-2.7.0/docs/math.md +607 -0
  65. apkfast-2.7.0/docs/migration.md +55 -0
  66. apkfast-2.7.0/docs/permissions.md +634 -0
  67. apkfast-2.7.0/docs/publishing.md +112 -0
  68. apkfast-2.7.0/docs/sensors.md +654 -0
  69. apkfast-2.7.0/docs/signing.md +167 -0
  70. apkfast-2.7.0/docs/text-input.md +560 -0
  71. apkfast-2.7.0/examples/device-demo/AndroidManifest.xml +20 -0
  72. apkfast-2.7.0/examples/device-demo/jni/main.cpp +99 -0
  73. apkfast-2.7.0/examples/image-demo/AndroidManifest.xml +20 -0
  74. apkfast-2.7.0/examples/image-demo/assets/animated.webp +0 -0
  75. apkfast-2.7.0/examples/image-demo/assets/font.ttf +0 -0
  76. apkfast-2.7.0/examples/image-demo/assets/logo.svg +32 -0
  77. apkfast-2.7.0/examples/image-demo/assets/pulse.svg +6 -0
  78. apkfast-2.7.0/examples/image-demo/assets/sprite.png +0 -0
  79. apkfast-2.7.0/examples/image-demo/assets/sprite.webp +0 -0
  80. apkfast-2.7.0/examples/image-demo/jni/main.cpp +111 -0
  81. apkfast-2.7.0/examples/media-demo/AndroidManifest.xml +19 -0
  82. apkfast-2.7.0/examples/media-demo/assets/beep.wav +0 -0
  83. apkfast-2.7.0/examples/media-demo/assets/font.ttf +0 -0
  84. apkfast-2.7.0/examples/media-demo/assets/sprite.png +0 -0
  85. apkfast-2.7.0/examples/media-demo/assets/tone.mp3 +0 -0
  86. apkfast-2.7.0/examples/media-demo/assets/tone.ogg +0 -0
  87. apkfast-2.7.0/examples/media-demo/jni/main.cpp +97 -0
  88. apkfast-2.7.0/examples/native-hello/AndroidManifest.xml +20 -0
  89. apkfast-2.7.0/examples/native-hello/CMakeLists.txt +4 -0
  90. apkfast-2.7.0/examples/native-hello/apkfast.json +3 -0
  91. apkfast-2.7.0/examples/native-hello/jni/main.cpp +49 -0
  92. apkfast-2.7.0/examples/nativeapp-advanced/AndroidManifest.xml +19 -0
  93. apkfast-2.7.0/examples/nativeapp-advanced/jni/main.cpp +79 -0
  94. apkfast-2.7.0/examples/nativeapp-gl/AndroidManifest.xml +20 -0
  95. apkfast-2.7.0/examples/nativeapp-gl/jni/main.cpp +69 -0
  96. apkfast-2.7.0/examples/nativeapp-vulkan/AndroidManifest.xml +20 -0
  97. apkfast-2.7.0/examples/nativeapp-vulkan/jni/main.cpp +61 -0
  98. apkfast-2.7.0/examples/permissions-test/AndroidManifest.xml +22 -0
  99. apkfast-2.7.0/examples/permissions-test/jni/main.cpp +59 -0
  100. apkfast-2.7.0/examples/raylib-hello/AndroidManifest.xml +19 -0
  101. apkfast-2.7.0/examples/raylib-hello/jni/main.cpp +38 -0
  102. apkfast-2.7.0/examples/raylib-permissions/AndroidManifest.xml +21 -0
  103. apkfast-2.7.0/examples/raylib-permissions/jni/main.cpp +42 -0
  104. apkfast-2.7.0/examples/sdl2-hello/AndroidManifest.xml +19 -0
  105. apkfast-2.7.0/examples/sdl2-hello/java/HIDDevice.java +22 -0
  106. apkfast-2.7.0/examples/sdl2-hello/java/HIDDeviceBLESteamController.java +650 -0
  107. apkfast-2.7.0/examples/sdl2-hello/java/HIDDeviceManager.java +698 -0
  108. apkfast-2.7.0/examples/sdl2-hello/java/HIDDeviceUSB.java +309 -0
  109. apkfast-2.7.0/examples/sdl2-hello/java/SDL.java +90 -0
  110. apkfast-2.7.0/examples/sdl2-hello/java/SDLActivity.java +2120 -0
  111. apkfast-2.7.0/examples/sdl2-hello/java/SDLAudioManager.java +514 -0
  112. apkfast-2.7.0/examples/sdl2-hello/java/SDLControllerManager.java +856 -0
  113. apkfast-2.7.0/examples/sdl2-hello/java/SDLSurface.java +405 -0
  114. apkfast-2.7.0/examples/sdl2-hello/java/com/apkfast/sdl2hello/MainActivity.java +11 -0
  115. apkfast-2.7.0/examples/sdl2-hello/jni/main.cpp +54 -0
  116. apkfast-2.7.0/examples/sdl3-hello/AndroidManifest.xml +19 -0
  117. apkfast-2.7.0/examples/sdl3-hello/java/HIDDevice.java +21 -0
  118. apkfast-2.7.0/examples/sdl3-hello/java/HIDDeviceBLESteamController.java +834 -0
  119. apkfast-2.7.0/examples/sdl3-hello/java/HIDDeviceManager.java +707 -0
  120. apkfast-2.7.0/examples/sdl3-hello/java/HIDDeviceUSB.java +379 -0
  121. apkfast-2.7.0/examples/sdl3-hello/java/SDL.java +142 -0
  122. apkfast-2.7.0/examples/sdl3-hello/java/SDLActivity.java +2556 -0
  123. apkfast-2.7.0/examples/sdl3-hello/java/SDLAudioManager.java +128 -0
  124. apkfast-2.7.0/examples/sdl3-hello/java/SDLControllerManager.java +1266 -0
  125. apkfast-2.7.0/examples/sdl3-hello/java/SDLDummyEdit.java +66 -0
  126. apkfast-2.7.0/examples/sdl3-hello/java/SDLInputConnection.java +136 -0
  127. apkfast-2.7.0/examples/sdl3-hello/java/SDLSensorManager.java +73 -0
  128. apkfast-2.7.0/examples/sdl3-hello/java/SDLSurface.java +623 -0
  129. apkfast-2.7.0/examples/sdl3-hello/java/com/apkfast/sdl3hello/MainActivity.java +12 -0
  130. apkfast-2.7.0/examples/sdl3-hello/jni/main.cpp +62 -0
  131. apkfast-2.7.0/examples/sdl3-permissions/AndroidManifest.xml +19 -0
  132. apkfast-2.7.0/examples/sdl3-permissions/java/HIDDevice.java +21 -0
  133. apkfast-2.7.0/examples/sdl3-permissions/java/HIDDeviceBLESteamController.java +834 -0
  134. apkfast-2.7.0/examples/sdl3-permissions/java/HIDDeviceManager.java +707 -0
  135. apkfast-2.7.0/examples/sdl3-permissions/java/HIDDeviceUSB.java +379 -0
  136. apkfast-2.7.0/examples/sdl3-permissions/java/SDL.java +142 -0
  137. apkfast-2.7.0/examples/sdl3-permissions/java/SDLActivity.java +2556 -0
  138. apkfast-2.7.0/examples/sdl3-permissions/java/SDLAudioManager.java +128 -0
  139. apkfast-2.7.0/examples/sdl3-permissions/java/SDLControllerManager.java +1266 -0
  140. apkfast-2.7.0/examples/sdl3-permissions/java/SDLDummyEdit.java +66 -0
  141. apkfast-2.7.0/examples/sdl3-permissions/java/SDLInputConnection.java +136 -0
  142. apkfast-2.7.0/examples/sdl3-permissions/java/SDLSensorManager.java +73 -0
  143. apkfast-2.7.0/examples/sdl3-permissions/java/SDLSurface.java +623 -0
  144. apkfast-2.7.0/examples/sdl3-permissions/java/com/apkfast/sdl3perms/MainActivity.java +10 -0
  145. apkfast-2.7.0/examples/sdl3-permissions/jni/main.cpp +60 -0
  146. apkfast-2.7.0/examples/text-input-hello/AndroidManifest.xml +20 -0
  147. apkfast-2.7.0/examples/text-input-hello/jni/main.cpp +67 -0
  148. apkfast-2.7.0/include/nativeapp/README.md +230 -0
  149. apkfast-2.7.0/include/nativeapp/animated_image.hpp +71 -0
  150. apkfast-2.7.0/include/nativeapp/animated_svg.hpp +59 -0
  151. apkfast-2.7.0/include/nativeapp/app.hpp +460 -0
  152. apkfast-2.7.0/include/nativeapp/assets.hpp +91 -0
  153. apkfast-2.7.0/include/nativeapp/audio.hpp +341 -0
  154. apkfast-2.7.0/include/nativeapp/codecs.hpp +99 -0
  155. apkfast-2.7.0/include/nativeapp/device.hpp +310 -0
  156. apkfast-2.7.0/include/nativeapp/font.hpp +120 -0
  157. apkfast-2.7.0/include/nativeapp/gl.hpp +991 -0
  158. apkfast-2.7.0/include/nativeapp/graphics_types.hpp +118 -0
  159. apkfast-2.7.0/include/nativeapp/image_codecs.hpp +137 -0
  160. apkfast-2.7.0/include/nativeapp/image_impl.hpp +1191 -0
  161. apkfast-2.7.0/include/nativeapp/input_helpers.hpp +146 -0
  162. apkfast-2.7.0/include/nativeapp/jni_bitmap.hpp +62 -0
  163. apkfast-2.7.0/include/nativeapp/math.hpp +189 -0
  164. apkfast-2.7.0/include/nativeapp/music.hpp +272 -0
  165. apkfast-2.7.0/include/nativeapp/nativeapp.hpp +60 -0
  166. apkfast-2.7.0/include/nativeapp/permission_types.hpp +27 -0
  167. apkfast-2.7.0/include/nativeapp/permissions.hpp +430 -0
  168. apkfast-2.7.0/include/nativeapp/permissions_jni.hpp +359 -0
  169. apkfast-2.7.0/include/nativeapp/sensor.hpp +155 -0
  170. apkfast-2.7.0/include/nativeapp/text_input.hpp +329 -0
  171. apkfast-2.7.0/include/nativeapp/third_party/NANOSVG-LICENSE +18 -0
  172. apkfast-2.7.0/include/nativeapp/third_party/dr_mp3.h +5241 -0
  173. apkfast-2.7.0/include/nativeapp/third_party/nanosvg.h +3278 -0
  174. apkfast-2.7.0/include/nativeapp/third_party/nanosvgrast.h +1472 -0
  175. apkfast-2.7.0/include/nativeapp/third_party/stb_image.h +7812 -0
  176. apkfast-2.7.0/include/nativeapp/third_party/stb_truetype.h +5321 -0
  177. apkfast-2.7.0/include/nativeapp/third_party/stb_vorbis.c +5720 -0
  178. apkfast-2.7.0/include/nativeapp/third_party/stb_vorbis.h +14 -0
  179. apkfast-2.7.0/include/nativeapp/version.hpp +42 -0
  180. apkfast-2.7.0/include/nativeapp/vk.hpp +1110 -0
  181. apkfast-2.7.0/patches/lunasvg-filters.diff +3905 -0
  182. apkfast-2.7.0/pyproject.toml +70 -0
  183. apkfast-2.7.0/setup.cfg +4 -0
  184. apkfast-2.7.0/src/nativeapp_impl.cpp +32 -0
  185. apkfast-2.7.0/src/nativeapp_impl_no_image.cpp +20 -0
  186. apkfast-2.7.0/tests/test_builder_lock.py +74 -0
  187. apkfast-2.7.0/tests/test_bundle.py +227 -0
  188. apkfast-2.7.0/tests/test_cache_remote.py +139 -0
  189. apkfast-2.7.0/tests/test_completions.py +131 -0
  190. apkfast-2.7.0/tests/test_config_schema.py +85 -0
  191. apkfast-2.7.0/tests/test_lockfile.py +101 -0
  192. apkfast-2.7.0/tests/test_publish.py +263 -0
  193. apkfast-2.7.0/tests/test_resource_cache.py +520 -0
  194. apkfast-2.7.0/tests/test_signing.py +404 -0
  195. apkfast-2.7.0/tests/test_version_header.py +67 -0
@@ -0,0 +1,75 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ pull_request:
7
+
8
+ jobs:
9
+ syntax:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v5
13
+ - uses: actions/setup-python@v6
14
+ with:
15
+ python-version: "3.11"
16
+ - name: Check Python syntax
17
+ run: python3 -m compileall -q apkfast apkfast.py
18
+ - name: Check CLI help
19
+ run: |
20
+ python3 apkfast.py --help
21
+ python3 apkfast.py build --help
22
+ python3 apkfast.py setup-libs --help
23
+ python3 apkfast.py cache-export --help
24
+ python3 apkfast.py cache-import --help
25
+ python3 apkfast.py webp-install --help
26
+ python3 apkfast.py lunasvg-install --help
27
+ python3 apkfast.py config show --help
28
+ python3 apkfast.py completions --help
29
+ python3 apkfast.py doctor --help
30
+ python3 apkfast.py --completions bash >/dev/null
31
+ python3 apkfast.py --completions zsh >/dev/null
32
+ python3 apkfast.py --completions fish >/dev/null
33
+ - name: Validate project config
34
+ run: python3 apkfast.py config show examples/native-hello
35
+ - name: Validate lockfile round-trip (no SDK required)
36
+ run: |
37
+ python3 - <<'PY'
38
+ import tempfile
39
+ from pathlib import Path
40
+ from types import SimpleNamespace
41
+ from apkfast import config_schema, lockfile
42
+
43
+ project = Path(tempfile.mkdtemp())
44
+ (project / "apkfast.json").write_text('{"incremental": true, "cacheMode": "verify"}')
45
+ config_schema.validate(config_schema.load(project / "apkfast.json"))
46
+ tc = SimpleNamespace(
47
+ ndk_dir=Path("/sdk/android-ndk-r30"),
48
+ build_tools_dir=Path("/sdk/build-tools/36.0.0"),
49
+ platform_dir=Path("/sdk/platforms/android-36"),
50
+ api=36,
51
+ )
52
+ doc = lockfile.generate(project, tc, api=36)
53
+ target = lockfile.write(project, doc)
54
+ loaded = lockfile.load(project)
55
+ assert loaded["lockVersion"] == 1
56
+ assert lockfile.compare(loaded, lockfile.facts(tc, api=36)) == []
57
+ assert lockfile.compare(loaded, lockfile.facts(tc, api=28))
58
+ print("OK", target)
59
+ PY
60
+ - name: Unit tests
61
+ run: python3 -m unittest discover -s tests -v
62
+
63
+ examples:
64
+ runs-on: ubuntu-latest
65
+ steps:
66
+ - uses: actions/checkout@v5
67
+ - name: Verify example manifests are well-formed XML
68
+ run: |
69
+ python3 - <<'PY'
70
+ import xml.etree.ElementTree as ET
71
+ from pathlib import Path
72
+ for manifest in Path("examples").glob("*/AndroidManifest.xml"):
73
+ ET.parse(manifest)
74
+ print("OK", manifest)
75
+ PY
@@ -0,0 +1,226 @@
1
+ name: Device validation (real)
2
+
3
+ # ATENÇÃO: workflow ADITIVO e NÃO executado nesta entrega. Ele NÃO substitui a
4
+ # "Build matrix" (.github/workflows/device.yml), que continua intacta.
5
+ #
6
+ # Modos (configuráveis sem editar este arquivo):
7
+ # 1. self-hosted: vars.DEVICE_RUNNER_LABEL (label do runner com KVM/aparelho)
8
+ # 2. Firebase Test Lab: secrets.GCLOUD_PROJECT (+ GCLOUD_SERVICE_ACCOUNT_JSON)
9
+ #
10
+ # Se nenhum dos dois estiver configurado, o job "skip" apenas avisa e a execução
11
+ # termina com sucesso (não falha).
12
+
13
+ on:
14
+ workflow_dispatch:
15
+ inputs:
16
+ abi:
17
+ description: "ABI do APK de exemplo (quando apk_url estiver vazio)"
18
+ required: true
19
+ default: x86_64
20
+ type: choice
21
+ options:
22
+ - arm64-v8a
23
+ - armeabi-v7a
24
+ - x86_64
25
+ package:
26
+ description: "Package do APK validado"
27
+ required: false
28
+ default: com.example.nativehello
29
+ type: string
30
+ apk_url:
31
+ description: "URL de um APK pronto (opcional); vazio = compila native-hello"
32
+ required: false
33
+ type: string
34
+ schedule:
35
+ - cron: "0 6 * * 1"
36
+
37
+ permissions:
38
+ contents: read
39
+
40
+ jobs:
41
+ config:
42
+ name: Resolve device mode
43
+ runs-on: ubuntu-latest
44
+ outputs:
45
+ self_hosted: ${{ steps.decide.outputs.self_hosted }}
46
+ firebase: ${{ steps.decide.outputs.firebase }}
47
+ none: ${{ steps.decide.outputs.none }}
48
+ label: ${{ steps.decide.outputs.label }}
49
+ env:
50
+ # Secrets não podem ser usados em jobs.<job_id>.if; por isso viram env.
51
+ DEVICE_RUNNER_LABEL: ${{ vars.DEVICE_RUNNER_LABEL }}
52
+ GCLOUD_PROJECT: ${{ secrets.GCLOUD_PROJECT }}
53
+ steps:
54
+ - id: decide
55
+ run: |
56
+ set -eu
57
+ echo "self_hosted=false" >> "$GITHUB_OUTPUT"
58
+ echo "firebase=false" >> "$GITHUB_OUTPUT"
59
+ echo "none=false" >> "$GITHUB_OUTPUT"
60
+ if [ -n "${DEVICE_RUNNER_LABEL:-}" ]; then
61
+ echo "self_hosted=true" >> "$GITHUB_OUTPUT"
62
+ printf 'label=%s\n' "$DEVICE_RUNNER_LABEL" >> "$GITHUB_OUTPUT"
63
+ fi
64
+ if [ -n "${GCLOUD_PROJECT:-}" ]; then
65
+ echo "firebase=true" >> "$GITHUB_OUTPUT"
66
+ fi
67
+ if [ -z "${DEVICE_RUNNER_LABEL:-}" ] && [ -z "${GCLOUD_PROJECT:-}" ]; then
68
+ echo "none=true" >> "$GITHUB_OUTPUT"
69
+ echo "::notice::device-real: nenhum modo configurado. Defina vars.DEVICE_RUNNER_LABEL e/ou secrets.GCLOUD_PROJECT."
70
+ fi
71
+
72
+ skip:
73
+ name: No device mode configured
74
+ needs: config
75
+ if: needs.config.outputs.none == 'true'
76
+ runs-on: ubuntu-latest
77
+ steps:
78
+ - name: Explain skip
79
+ run: |
80
+ echo "device-real: SKIPPED (sem modo configurado)"
81
+ echo "Configure vars.DEVICE_RUNNER_LABEL (runner self-hosted) ou secrets.GCLOUD_PROJECT (Firebase Test Lab)."
82
+
83
+ self-hosted:
84
+ name: Self-hosted (KVM / dispositivo)
85
+ needs: config
86
+ if: needs.config.outputs.self_hosted == 'true'
87
+ runs-on: ${{ needs.config.outputs.label }}
88
+ timeout-minutes: 60
89
+ env:
90
+ PACKAGE: ${{ inputs.package || 'com.example.nativehello' }}
91
+ ABI: ${{ inputs.abi || 'x86_64' }}
92
+ APK_URL: ${{ inputs.apk_url || '' }}
93
+ DEVICE_SERIAL: ${{ vars.DEVICE_SERIAL || '' }}
94
+ APKFAST_ANDROID_ROOT: ${{ vars.APKFAST_ANDROID_ROOT || '' }}
95
+ steps:
96
+ - uses: actions/checkout@v5
97
+
98
+ - uses: actions/setup-python@v6
99
+ with:
100
+ python-version: "3.11"
101
+
102
+ - name: Prepare APK
103
+ run: |
104
+ set -eu
105
+ mkdir -p dist
106
+ if [ -n "${APK_URL:-}" ]; then
107
+ curl -fL --retry 3 -o dist/app.apk "$APK_URL"
108
+ else
109
+ python3 apkfast.py build examples/native-hello \
110
+ --abi "$ABI" -o "$PWD/dist/app.apk"
111
+ fi
112
+ test -s dist/app.apk
113
+
114
+ - name: Validate on real device
115
+ run: |
116
+ set -eu
117
+ extra=()
118
+ if [ -n "${DEVICE_SERIAL:-}" ]; then extra+=(--serial "$DEVICE_SERIAL"); fi
119
+ sh scripts/device-check.sh "${extra[@]}" \
120
+ --log-file device-check.log dist/app.apk "$PACKAGE"
121
+
122
+ - name: Upload device log
123
+ if: always()
124
+ uses: actions/upload-artifact@v4
125
+ with:
126
+ name: device-check-self-hosted
127
+ path: device-check.log
128
+ if-no-files-found: ignore
129
+
130
+ firebase-test-lab:
131
+ name: Firebase Test Lab (robo)
132
+ needs: config
133
+ if: needs.config.outputs.firebase == 'true'
134
+ runs-on: ubuntu-latest
135
+ timeout-minutes: 60
136
+ env:
137
+ GCLOUD_PROJECT: ${{ secrets.GCLOUD_PROJECT }}
138
+ GCLOUD_SERVICE_ACCOUNT_JSON: ${{ secrets.GCLOUD_SERVICE_ACCOUNT_JSON }}
139
+ PACKAGE: ${{ inputs.package || 'com.example.nativehello' }}
140
+ ABI: ${{ inputs.abi || 'x86_64' }}
141
+ APK_URL: ${{ inputs.apk_url || '' }}
142
+ RESULTS_BUCKET: ${{ vars.FIREBASE_RESULTS_BUCKET || '' }}
143
+ steps:
144
+ - uses: actions/checkout@v5
145
+
146
+ - uses: actions/setup-python@v6
147
+ with:
148
+ python-version: "3.11"
149
+
150
+ - name: Prepare APK
151
+ run: |
152
+ set -eu
153
+ mkdir -p dist testlab-results
154
+ if [ -n "${APK_URL:-}" ]; then
155
+ curl -fL --retry 3 -o dist/app.apk "$APK_URL"
156
+ else
157
+ python3 apkfast.py build examples/native-hello \
158
+ --abi "$ABI" -o "$PWD/dist/app.apk"
159
+ fi
160
+ test -s dist/app.apk
161
+
162
+ - name: Authenticate gcloud
163
+ run: |
164
+ set -eu
165
+ command -v gcloud >/dev/null || { echo "::error::gcloud CLI não disponível no runner"; exit 1; }
166
+ test -n "${GCLOUD_SERVICE_ACCOUNT_JSON:-}" || {
167
+ echo "::error::GCLOUD_SERVICE_ACCOUNT_JSON não configurado"; exit 1;
168
+ }
169
+ key="$RUNNER_TEMP/gcloud-sa.json"
170
+ printf '%s' "$GCLOUD_SERVICE_ACCOUNT_JSON" > "$key"
171
+ chmod 600 "$key"
172
+ gcloud auth activate-service-account --key-file="$key"
173
+ gcloud config set project "$GCLOUD_PROJECT"
174
+
175
+ - name: Run Firebase Test Lab
176
+ id: testlab
177
+ run: |
178
+ set -eu
179
+ results_dir="apkfast-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
180
+ args=(
181
+ firebase test android run --type robo
182
+ --app dist/app.apk
183
+ --device model=Pixel2,version=28,locale=en,orientation=portrait
184
+ --project "$GCLOUD_PROJECT"
185
+ --results-dir "$results_dir"
186
+ --timeout 5m
187
+ )
188
+ if [ -n "${RESULTS_BUCKET:-}" ]; then
189
+ args+=(--results-bucket "$RESULTS_BUCKET")
190
+ fi
191
+ gcloud "${args[@]}" 2>&1 | tee "$RUNNER_TEMP/testlab.out"
192
+ echo "results_dir=$results_dir" >> "$GITHUB_OUTPUT"
193
+ if [ -n "${RESULTS_BUCKET:-}" ]; then
194
+ echo "results_bucket=$RESULTS_BUCKET" >> "$GITHUB_OUTPUT"
195
+ fi
196
+
197
+ - name: Fetch and check Test Lab logcat
198
+ if: steps.testlab.outputs.results_bucket != ''
199
+ env:
200
+ RESULTS_BUCKET: ${{ steps.testlab.outputs.results_bucket }}
201
+ RESULTS_DIR: ${{ steps.testlab.outputs.results_dir }}
202
+ run: |
203
+ set -eu
204
+ if ! command -v gsutil >/dev/null; then
205
+ echo "::warning::gsutil indisponível; pulando verificação do logcat do Test Lab"
206
+ exit 0
207
+ fi
208
+ if ! gsutil -m cp -r "gs://${RESULTS_BUCKET}/${RESULTS_DIR}/*" testlab-results/; then
209
+ echo "::warning::não foi possível baixar os logs do Test Lab"
210
+ exit 0
211
+ fi
212
+ matches="$(grep -REI 'FATAL|dlopen failed|AndroidRuntime.*Exception' testlab-results || true)"
213
+ if [ -n "$matches" ]; then
214
+ printf '%s\n' "$matches" | head -n 20 >&2
215
+ echo "::error::logcat do Test Lab contém padrão de crash"
216
+ exit 1
217
+ fi
218
+ echo "OK: logcat do Test Lab sem FATAL/dlopen failed/AndroidRuntime exceptions"
219
+
220
+ - name: Upload Test Lab results
221
+ if: always()
222
+ uses: actions/upload-artifact@v4
223
+ with:
224
+ name: testlab-results
225
+ path: testlab-results
226
+ if-no-files-found: ignore
@@ -0,0 +1,112 @@
1
+ name: Build matrix
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ # GitHub-hosted runners não conseguem bootar emuladores ARM (nem x86_64 de
10
+ # forma confiável neste ambiente). Esta matriz valida compilação, link,
11
+ # empacotamento e assinatura dos APKs em várias ABIs/APIs. A validação em
12
+ # dispositivo é feita localmente com `apkfast install` + `apkfast logs`.
13
+ jobs:
14
+ build:
15
+ name: API ${{ matrix.api }} / ${{ matrix.abi }}
16
+ runs-on: ubuntu-latest
17
+ timeout-minutes: 90
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ include:
22
+ - api: 21
23
+ abi: x86_64
24
+ - api: 28
25
+ abi: x86_64
26
+ - api: 35
27
+ abi: x86_64
28
+ - api: 35
29
+ abi: arm64-v8a
30
+ - api: 35
31
+ abi: armeabi-v7a
32
+ env:
33
+ NDK_VERSION: 27.2.12479018
34
+ BUILD_TOOLS: 37.0.0
35
+ steps:
36
+ - uses: actions/checkout@v5
37
+
38
+ - uses: actions/setup-python@v6
39
+ with:
40
+ python-version: "3.11"
41
+
42
+ - name: Resolve preinstalled sdkmanager
43
+ run: |
44
+ set -e
45
+ test -n "$ANDROID_HOME"
46
+ sdkmgr="$(find "$ANDROID_HOME/cmdline-tools" -type f -path '*/bin/sdkmanager' | sort | tail -1)"
47
+ test -n "$sdkmgr"
48
+ echo "SDKMGR=$sdkmgr" >> "$GITHUB_ENV"
49
+
50
+ - name: Install SDK platforms and NDK
51
+ run: |
52
+ set -e
53
+ yes | "$SDKMGR" --licenses >/dev/null 2>&1 || true
54
+ "$SDKMGR" --install \
55
+ "platform-tools" \
56
+ "platforms;android-21" \
57
+ "platforms;android-28" \
58
+ "platforms;android-35" \
59
+ "platforms;android-36" \
60
+ "build-tools;${BUILD_TOOLS}" \
61
+ "ndk;${NDK_VERSION}"
62
+
63
+ - name: Expose SDK/NDK to apkfast discovery
64
+ run: |
65
+ set -e
66
+ root="$RUNNER_TEMP/android-root"
67
+ mkdir -p "$root"
68
+ ln -s "$ANDROID_HOME" "$root/android-sdk"
69
+ ln -s "$ANDROID_HOME/ndk/$NDK_VERSION" "$root/android-ndk"
70
+ echo "APKFAST_ANDROID_ROOT=$root" >> "$GITHUB_ENV"
71
+
72
+ - name: Prepare native libraries (libwebp, LunaSVG, raylib, SDL)
73
+ run: python3 apkfast.py setup-libs --abis "${{ matrix.abi }}"
74
+
75
+ - name: Generate and verify toolchain lockfile
76
+ run: |
77
+ set -e
78
+ python3 apkfast.py build --generate-lock \
79
+ --api 35 --min-sdk 21 --target-sdk 36 \
80
+ --sdk-dir "$ANDROID_HOME" \
81
+ --ndk-dir "$ANDROID_HOME/ndk/$NDK_VERSION" \
82
+ --build-tools "$BUILD_TOOLS"
83
+ python3 -m json.tool apkfast.lock.json >/dev/null
84
+ python3 apkfast.py doctor --json > doctor.json
85
+ python3 -m json.tool doctor.json >/dev/null
86
+ grep -q '"ok": true' doctor.json
87
+
88
+ - name: Build native-hello, image-demo and permissions-test
89
+ run: |
90
+ set -e
91
+ mkdir -p dist
92
+ for example in native-hello image-demo permissions-test; do
93
+ python3 apkfast.py build "examples/$example" \
94
+ --abi "${{ matrix.abi }}" \
95
+ --api 35 --min-sdk 21 --target-sdk 36 \
96
+ --sdk-dir "$ANDROID_HOME" \
97
+ --ndk-dir "$ANDROID_HOME/ndk/$NDK_VERSION" \
98
+ --build-tools "$BUILD_TOOLS" \
99
+ --lock-file "$GITHUB_WORKSPACE/apkfast.lock.json" \
100
+ --report \
101
+ -o "$GITHUB_WORKSPACE/dist/${example}-${{ matrix.abi }}.apk"
102
+ done
103
+
104
+ - name: Upload build reports
105
+ if: always()
106
+ uses: actions/upload-artifact@v4
107
+ with:
108
+ name: build-api${{ matrix.api }}-${{ matrix.abi }}
109
+ path: |
110
+ doctor.json
111
+ examples/*/build/apkfast-report.json
112
+ if-no-files-found: ignore
@@ -0,0 +1,136 @@
1
+ name: Publish to PyPI
2
+
3
+ # ATENÇÃO: este workflow NÃO foi executado nesta entrega. É apenas a automação
4
+ # que dispara quando o maintainer publicar uma GitHub Release (ou acionar
5
+ # workflow_dispatch manualmente). Nenhum upload foi feito aqui.
6
+ #
7
+ # OIDC (Trusted Publishing) requer cadastro do publisher no PyPI:
8
+ # PyPI -> seu projeto -> Settings -> Publishing -> Add a trusted publisher
9
+ # Owner: <dono>, Repository: apkfast, Workflow: publish.yml, Environment: pypi
10
+ # Repita no TestPyPI se for publicar lá. Alternativamente, defina o secret
11
+ # PYPI_API_TOKEN (necessário apenas se não usar OIDC).
12
+
13
+ on:
14
+ release:
15
+ types: [published]
16
+ workflow_dispatch:
17
+ inputs:
18
+ repository:
19
+ description: "Destino do upload"
20
+ required: true
21
+ default: pypi
22
+ type: choice
23
+ options:
24
+ - pypi
25
+ - testpypi
26
+ dry_run:
27
+ description: "Apenas validar (sem upload)"
28
+ required: false
29
+ default: true
30
+ type: boolean
31
+
32
+ permissions:
33
+ contents: read
34
+
35
+ env:
36
+ # Release publicada => PyPI real. Dispatch => respeita os inputs acima.
37
+ REPOSITORY_URL: ${{ github.event_name == 'workflow_dispatch' && inputs.repository == 'testpypi' && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }}
38
+ DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run && 'true' || 'false' }}
39
+
40
+ jobs:
41
+ config:
42
+ name: Resolve publish mode
43
+ runs-on: ubuntu-latest
44
+ # Necessário para enxergar secrets do environment (ex.: PYPI_API_TOKEN).
45
+ environment:
46
+ name: pypi
47
+ outputs:
48
+ enabled: ${{ steps.decide.outputs.enabled }}
49
+ env:
50
+ PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
51
+ PYPI_PUBLISH_ENABLED: ${{ vars.PYPI_PUBLISH_ENABLED }}
52
+ steps:
53
+ - id: decide
54
+ run: |
55
+ set -eu
56
+ if [ "${PYPI_PUBLISH_ENABLED:-}" = "true" ] || [ -n "${PYPI_API_TOKEN:-}" ]; then
57
+ echo "enabled=true" >> "$GITHUB_OUTPUT"
58
+ echo "PyPI publish habilitado."
59
+ else
60
+ echo "enabled=false" >> "$GITHUB_OUTPUT"
61
+ echo "::notice::PyPI publish desabilitado (defina vars.PYPI_PUBLISH_ENABLED=true, configure o Trusted Publisher ou o secret PYPI_API_TOKEN). O build/check das distribuições ainda roda."
62
+ fi
63
+
64
+ build:
65
+ name: Build and check distributions
66
+ runs-on: ubuntu-latest
67
+ steps:
68
+ - uses: actions/checkout@v5
69
+
70
+ - uses: actions/setup-python@v6
71
+ with:
72
+ python-version: "3.11"
73
+
74
+ - name: Install build tools
75
+ run: python3 -m pip install --upgrade build twine
76
+
77
+ - name: Build sdist + wheel
78
+ run: python3 -m build
79
+
80
+ - name: Validate metadata
81
+ run: python3 -m twine check dist/*
82
+
83
+ - name: Upload distributions as artifact
84
+ uses: actions/upload-artifact@v4
85
+ with:
86
+ name: python-dist
87
+ path: dist/*
88
+ if-no-files-found: error
89
+
90
+ skip-publish:
91
+ name: Publish disabled (no credentials configured)
92
+ needs: [config, build]
93
+ if: needs.config.outputs.enabled != 'true'
94
+ runs-on: ubuntu-latest
95
+ steps:
96
+ - name: Explain skip
97
+ run: |
98
+ echo "publish.yml: SKIPPED (nenhuma credencial PyPI configurada)"
99
+ echo "As distribuições foram construídas e validadas no job build."
100
+
101
+ publish:
102
+ name: Publish validated distributions
103
+ needs: [config, build]
104
+ if: needs.config.outputs.enabled == 'true'
105
+ runs-on: ubuntu-latest
106
+ environment:
107
+ name: pypi
108
+ permissions:
109
+ contents: read
110
+ id-token: write
111
+ env:
112
+ PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
113
+ steps:
114
+ - uses: actions/download-artifact@v4
115
+ with:
116
+ name: python-dist
117
+ path: dist
118
+
119
+ - name: Dry run (no upload)
120
+ if: env.DRY_RUN == 'true'
121
+ run: |
122
+ echo "::notice::dry-run: sdist/wheel validados; nenhum upload foi realizado"
123
+ ls -l dist
124
+
125
+ - name: Publish via OIDC (Trusted Publishing)
126
+ if: env.DRY_RUN != 'true' && env.PYPI_API_TOKEN == ''
127
+ uses: pypa/gh-action-pypi-publish@release/v1
128
+ with:
129
+ repository-url: ${{ env.REPOSITORY_URL }}
130
+
131
+ - name: Publish via PYPI_API_TOKEN
132
+ if: env.DRY_RUN != 'true' && env.PYPI_API_TOKEN != ''
133
+ uses: pypa/gh-action-pypi-publish@release/v1
134
+ with:
135
+ repository-url: ${{ env.REPOSITORY_URL }}
136
+ password: ${{ secrets.PYPI_API_TOKEN }}