Repository navigation
246 lines (240 loc) · 9.8 KB
/
Copy path_build-android.yml
File metadata and controls
246 lines (240 loc) · 9.8 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
name: "Android"
on:
workflow_call:
env:
GODOT_VERSION: "3.6.3"
jobs:
generate-godot-api:
name: Generate Godot API
runs-on: ubuntu-latest
steps:
- name: Download Godot Headless
run: |
wget --content-disposition "https://downloads.godotengine.org/?version=${{ env.GODOT_VERSION }}&flavor=stable&slug=linux_headless.64.zip&platform=linux_server.headless.64"
unzip Godot_v${{ env.GODOT_VERSION }}-stable_linux_headless.64.zip
sudo mv Godot_v${{ env.GODOT_VERSION }}-stable_linux_headless.64 /usr/local/bin/godot
- name: Generate API file
run: |
timeout 1m godot --no-window --disable-render-loop --video-driver Dummy --gdnative-generate-json-api godot-api.json
- name: Upload binaries
uses: actions/upload-artifact@v7
with:
name: godot-api
path: godot-api.json
if-no-files-found: error
retention-days: 1
android:
name: ${{ matrix.arch }}
runs-on: ubuntu-latest
needs: generate-godot-api
strategy:
matrix:
arch: [x86_64, armeabi-v7a, arm64-v8a]
steps:
- name: Checkout sources
uses: actions/checkout@v6
- name: Dowload Godot API
uses: actions/download-artifact@v8
with:
name: godot-api
path: .
- name: Download SDK
id: download-sdk
uses: suisei-cn/actions-download-file@v1
with:
url: https://github.com/freeorion/freeorion-sdk/releases/download/v19/FreeOrionSDK_19_Android-${{ matrix.arch }}.zip
target: ../
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r24
add-to-path: false
- name: Configure
run: |
unzip -q ../${{ steps.download-sdk.outputs.filename }} -d ..
GODOT_API_JSON=$(realpath godot-api.json)
mkdir build
pushd build
FO_SDK=$(realpath ../..)
cmake -DANDROID_ABI=${{ matrix.arch }} -DANDROID_PLATFORM=24 -DANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }} -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake -DCMAKE_CXX_FLAGS=-std=c++14 -DANDROID_ALLOW_UNDEFINED_SYMBOLS=Off -DBUILD_SERVER=OFF -DBUILD_AI=OFF -DBUILD_CLIENT_GG=OFF -DBoost_INCLUDE_DIR=${FO_SDK}/include/ -DBoost_USE_STATIC_LIBS=On -DBoost_LIBRARY_DIR=${FO_SDK}/lib/ -DBUILD_CLIENT_GODOT=3 -DICUI18N_LIBRARY=${FO_SDK}/lib/libicui18n.a -DICUUC_LIBRARY=${FO_SDK}/lib/libicuuc.a -DICUDATA_LIBRARY=${FO_SDK}/lib/libicudata.a -DICONV_LIBRARY=${FO_SDK}/lib/libiconv.so -DPython3_LIBRARY=${FO_SDK}/lib/libpython3.11.a -DPython3_INCLUDE_DIR=${FO_SDK}/include/python3.11/ -DGODOT_CUSTOM_API_FILE=${GODOT_API_JSON} ..
- name: Build
run: |
pushd build
cmake --build . -- -j5
- name: Extract symbols and strip binaries
run: |
NDK_BIN="${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin"
find godot/bin -name "*.so" | while read -r SO_FILE; do
echo "::group::Process library ${SO_FILE}"
"$NDK_BIN/llvm-strip" --strip-all "$SO_FILE"
echo "::endgroup::"
done
- name: Upload binaries
uses: actions/upload-artifact@v7
with:
name: android-binaries-godot3-${{ matrix.arch }}
path: godot/bin/
if-no-files-found: error
retention-days: 1
merge-binaries:
name: Merge binaries
runs-on: ubuntu-latest
needs: android
steps:
- name: Merge binaries
uses: actions/upload-artifact/merge@v7
with:
name: android-binaries-godot3
pattern: android-binaries-godot3-*
delete-merged: true
retention-days: 1
export-android:
name: Export Android
runs-on: ubuntu-latest
needs: merge-binaries
steps:
- name: Checkout sources
uses: actions/checkout@v6
- name: Download python library
id: download-python-lib
uses: suisei-cn/actions-download-file@v1
with:
url: https://github.com/freeorion/freeorion-sdk/releases/download/v19/python311.zip
target: ../
- name: Place resources
run: |
mkdir -p godot/default/python/lib/
cp ../${{ steps.download-python-lib.outputs.filename }} godot/default/python/lib/python311.zip
unzip -t godot/default/python/lib/python311.zip
mv default/data/art godot/assets/
mv default/data/fonts godot/assets/
mv default/data/sound godot/assets/
mv default/scripting godot/default/
mv default/stringtables godot/default/
- name: Dowload binaries
uses: actions/download-artifact@v8
with:
name: android-binaries-godot3
path: godot/bin/
- name: Install Godot and Templates
run: |
wget --content-disposition "https://downloads.godotengine.org/?version=${{ env.GODOT_VERSION }}&flavor=stable&slug=linux_headless.64.zip&platform=linux_server.headless.64"
wget --content-disposition "https://downloads.godotengine.org/?version=${{ env.GODOT_VERSION }}&flavor=stable&slug=export_templates.tpz&platform=templates"
unzip Godot_v${{ env.GODOT_VERSION }}-stable_linux_headless.64.zip
sudo mv Godot_v${{ env.GODOT_VERSION }}-stable_linux_headless.64 /usr/local/bin/godot
mkdir -p ~/.local/share/godot/templates/${{ env.GODOT_VERSION }}.stable
unzip Godot_v${{ env.GODOT_VERSION }}-stable_export_templates.tpz
mv templates/* ~/.local/share/godot/templates/${{ env.GODOT_VERSION }}.stable/
- name: Set up Java and Android SDK
uses: android-actions/setup-android@v4
with:
packages: platform-tools
- name: Install Android Build Tools
run: |
sdkmanager "platform-tools" "platforms;android-33" "build-tools;33.0.2"
- name: Generate Debug Keystore
run: |
keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US"
- name: Configure Godot Editor Settings
run: |
mkdir -p ~/.config/godot/
cat <<EOF > ~/.config/godot/editor_settings-3.tres
[gd_resource type="EditorSettings" format=2]
[resource]
export/android/android_sdk_path = "${{ env.ANDROID_HOME }}"
export/android/timestamping_authority_url = ""
export/android/shutdown_timestamping = true
EOF
sed -i 's|keystore/debug=""|keystore/debug="${{ github.workspace }}/debug.keystore"|' godot/export_presets.cfg
sed -i 's|keystore/debug_user=""|keystore/debug_user="androiddebugkey"|' godot/export_presets.cfg
sed -i 's|keystore/debug_password=""|keystore/debug_password="android"|' godot/export_presets.cfg
- name: Export APK via Godot CLI
run: |
cd godot
godot -v --export-debug "Android" ../freeorion.apk
- name: Upload APK
uses: actions/upload-artifact@v7
with:
name: android
path: freeorion.apk
if-no-files-found: error
retention-days: 1
run-android:
name: Run Android
runs-on: ubuntu-24.04
needs: export-android
steps:
- uses: actions/cache/restore@v5
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
~/.android/debug.keystore
key: avd-test-godot-v2
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: run emulator to generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 31
target: google_apis
arch: x86_64
profile: Galaxy Nexus
cores: 2
sdcard-path-or-size: 1G
avd-name: test
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
working-directory: ./
channel: beta
script: echo "Generated AVD snapshot for caching."
- uses: actions/cache/save@v5
if: steps.avd-cache.outputs.cache-hit != 'true'
with:
path: |
~/.android/avd/*
~/.android/adb*
~/.android/debug.keystore
key: avd-test-godot-v2
- name: Checkout sources
uses: actions/checkout@v6
with:
sparse-checkout: .github/android-apk-launch.sh
- name: Dowload APK
uses: actions/download-artifact@v8
with:
name: android
path: .
- name: run game on emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 31
target: google_apis
arch: x86_64
profile: Galaxy Nexus
cores: 2
sdcard-path-or-size: 1G
avd-name: test
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
working-directory: ./
channel: beta
script: bash .github/android-apk-launch.sh 3
- name: Upload logs
if: always()
uses: actions/upload-artifact@v7
with:
name: android-test-logs-${{ github.run_number }}
path: |
freeorion-godot.log
logcat.log
tombstone-*.log
if-no-files-found: error
retention-days: 1