-
Notifications
You must be signed in to change notification settings - Fork 11
176 lines (161 loc) · 6.89 KB
/
android-macos-python.yml
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
name: "Build Python for Android wth MacOS emulator"
on:
push:
paths:
- '.github/workflows/android-macos-python.yml'
- '.github/workflows/adb-emu.sh'
tags:
- v*
pull_request:
paths:
- '.github/workflows/android-macos-python.yml'
- '.github/workflows/adb-emu.sh'
jobs:
build-android:
name: ${{ matrix.ndk-arch }} on ${{ matrix.arch }} Android
runs-on: macos-13
strategy:
matrix:
ndk-arch: [x86_64]
arch: [x86_64]
api-level: [21]
target: [default]
include:
- ndk-arch: arm64-v8a
arch: x86_64
api-level: 30
target: google_apis
- ndk-arch: x86
arch: x86
api-level: 21
target: default
- ndk-arch: armeabi-v7a
arch: x86_64
api-level: 30
target: google_apis
steps:
- name: checkout
uses: actions/checkout@v3
- name: create directories
run: |
mkdir -p build-python/python-cmake-buildsystem
mkdir -p build-boost/Boost-for-Android
mkdir -p build-godot
- name: Prepare dist version
id: cmake-dist-version
shell: cmake -P {0}
run: |
include(Version.cmake)
file(APPEND "$ENV{GITHUB_OUTPUT}" "dist-version=${DIST_VERSION}")
- uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
~/.android/debug.keystore
key: avd-${{ matrix.api-level }}-${{ matrix.target }}-${{ matrix.arch }}
- 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: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
profile: Galaxy Nexus
cores: 2
sdcard-path-or-size: 100M
emulator-build: 7425822 # https://github.com/ReactiveCircus/android-emulator-runner/issues/160
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: ./
ndk: 23.0.7421159
cmake: 3.10.2.4988404
channel: beta
script: echo "Generated AVD snapshot for caching."
- uses: actions/checkout@v3
with:
repository: 'o01eg/python-cmake-buildsystem'
ref: 'android-initial-support'
path: 'build-python/python-cmake-buildsystem'
- name: run action
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
profile: Galaxy Nexus
cores: 2
ram-size: 2048M
sdcard-path-or-size: 100M
emulator-build: 7425822 # https://github.com/ReactiveCircus/android-emulator-runner/issues/160
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: true
working-directory: build-python/python-cmake-buildsystem
ndk: 23.0.7421159
cmake: 3.10.2.4988404
channel: beta
script: |
# ls -lR /Users/runner/Library/Android/sdk
adb devices
mkdir ../python-build
mkdir ../python-install-prefix
cd ../python-build
# ls -lR /Users/runner/Library/Android/sdk/ndk/23.0.7421159/
cmake -DANDROID_NDK=/Users/runner/Library/Android/sdk/ndk/23.0.7421159/ -DCMAKE_INSTALL_PREFIX:PATH=../python-install-prefix -DCMAKE_TOOLCHAIN_FILE=/Users/runner/Library/Android/sdk/ndk/23.0.7421159/build/cmake/android.toolchain.cmake -DANDROID_ABI=${{ matrix.ndk-arch }} -DCMAKE_CROSSCOMPILING_EMULATOR=/Users/runner/work/freeorion-sdk/freeorion-sdk/.github/workflows/adb-emu.sh -DANDROID_ALLOW_UNDEFINED_SYMBOLS=On -DENABLE_DECIMAL=Off -DENABLE_CTYPES=Off -DENABLE_CODECS_JP=OFF -DENABLE_CODECS_KR=OFF -DENABLE_CODECS_TW=OFF -DENABLE_MULTIBYTECODEC=OFF -DENABLE_CODECS_CN=OFF -DENABLE_CODECS_HK=OFF -DENABLE_CODECS_ISO2022=OFF -DBUILD_EXTENSIONS_AS_BUILTIN=On -DANDROID_PLATFORM=android-21 ../python-cmake-buildsystem/
cmake --build . -- VERBOSE=1
cmake --build . --target install
- name: Pack Python SDK
shell: bash
run: |
cd build-python/python-install-prefix/lib/python3.9
zip -r -9 -q --exclude=*.pyc --exclude=*.a --exclude=*.so ../../../../python39.zip .
cd ../..
zip -r -9 -q ../../FreeOrionSDK_${{ steps.cmake-dist-version.outputs.dist-version }}_Android-${{ matrix.ndk-arch }}.zip include/ lib/libpython3.9.a bin/python
cd ..
- uses: actions/checkout@v3
with:
repository: 'moritz-wundke/Boost-for-Android'
ref: '529027ab2f1253f17797d364fb6f456d57dc9d5e'
path: 'build-boost/Boost-for-Android'
- name: Build Boost
shell: bash
run: |
export PYTHON_PATH=$(cd build-python/python-install-prefix/ ; pwd)
cd build-boost/Boost-for-Android
CXXFLAGS="-std=c++14" ./build-android.sh --boost=1.78.0 --arch=${{ matrix.ndk-arch }} --with-iconv --with-python=${PYTHON_PATH} --layout=system /Users/runner/Library/Android/sdk/ndk/23.0.7421159/
- name: Pack Boost
shell: bash
run: |
pushd build-boost/Boost-for-Android/build/out/${{ matrix.ndk-arch }}/
zip -r -9 -q ../../../../../FreeOrionSDK_${{ steps.cmake-dist-version.outputs.dist-version }}_Android-${{ matrix.ndk-arch }}.zip include/ lib/
popd
pushd build-boost/Boost-for-Android/libiconv-libicu-android/${{ matrix.ndk-arch }}/
zip -r -9 -q ../../../../FreeOrionSDK_${{ steps.cmake-dist-version.outputs.dist-version }}_Android-${{ matrix.ndk-arch }}.zip lib/libicui18n.a lib/libicuuc.a lib/libicudata.a lib/libiconv.so
- uses: actions/upload-artifact@v4
name: Artifacts
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
with:
name: python ${{ matrix.ndk-arch }} SDK
path: |
${{ matrix.ndk-arch == 'x86_64' && 'python39.zip' || '' }}
FreeOrionSDK_${{ steps.cmake-dist-version.outputs.dist-version }}_Android-${{ matrix.ndk-arch }}.zip
- name: Prepare Release
if: startsWith(github.ref, 'refs/tags/v')
id: prepare-release-options
run: |
echo "release-name=$(git tag -ln --format '%(subject)' ${{ github.ref_name }})" >> $GITHUB_OUTPUT
- uses: softprops/action-gh-release@v1
name: Release
if: startsWith(github.ref, 'refs/tags/v')
with:
name: ${{ steps.prepare-release-options.outputs.release-name }}
draft: true
files: |
python39.zip
FreeOrionSDK_${{ steps.cmake-dist-version.outputs.dist-version }}_Android-${{ matrix.ndk-arch }}.zip
token: ${{ secrets.RELEASE_TOKEN }}