-
Notifications
You must be signed in to change notification settings - Fork 38
163 lines (137 loc) · 5.45 KB
/
android.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
name: 'Android'
on:
push:
branches:
- '*'
pull_request:
types: [ opened, synchronize ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Build:
strategy:
fail-fast: false
matrix:
include:
- BuildType: Release
Platform: ARM
- BuildType: Release
Platform: x64
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Create Build Environment'
run: |
sudo apt-get update -y
sudo apt-get install -y cmake curl g++ libgl1-mesa-dev libopenmpt-dev
- name: 'Configure CMake'
run: |
case "${{ matrix.Platform }}" in
ARM ) architecture="arm64-v8a;armeabi-v7a"
universalApk="ON" ;;
x64 ) architecture="x86_64"
universalApk="OFF" ;;
* ) exit 1 ;;
esac
rm -f ./Content/Translations/*.po
export JAVA_HOME=$JAVA_HOME_17_X64
cmake -B ./_build/ -D CMAKE_BUILD_TYPE=${{ matrix.BuildType }} -D NCINE_BUILD_ANDROID=ON -D NCINE_UNIVERSAL_APK="$universalApk" -D NCINE_NDK_ARCHITECTURES="$architecture"
- name: 'Build'
run: |
export JAVA_HOME=$JAVA_HOME_17_X64
make -j $(nproc) -C ./_build/
cd ./_build/android/
gradle assemble${{ matrix.BuildType }}
- name: 'Create Package'
run: |
case "${{ matrix.BuildType }}" in
Debug ) buildDir="debug"
fileSuffix="debug" ;;
* ) buildDir="release"
fileSuffix="release-unsigned" ;;
esac
case "${{ matrix.Platform }}" in
ARM ) filename="app-universal-$fileSuffix.apk" ;;
x64 ) filename="app-x86_64-$fileSuffix.apk" ;;
* ) exit 1 ;;
esac
echo '${{ secrets.ANDROID_KEYSTORE_FILE }}' | base64 --decode > ./_keystore.jks
mkdir ./_package/
$ANDROID_HOME/build-tools/34.0.0/zipalign -p 4 "./_build/android/app/build/outputs/apk/$buildDir/$filename" "./_package/Jazz2.apk"
$ANDROID_HOME/build-tools/34.0.0/apksigner sign --ks-key-alias Main --ks "./_keystore.jks" --ks-pass "pass:${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" --key-pass "pass:${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" "./_package/Jazz2.apk"
cp -f ./LICENSE ./_package/LICENSE
- name: 'Upload Package'
uses: actions/upload-artifact@v4
with:
name: Jazz2_Android_${{ matrix.Platform }}
path: ./_package/
# Testing builds with workarounds
Workarounds:
if: ${{ false }} # Temporarily disabled, it will be removed in the future as it's no longer needed.
strategy:
fail-fast: false
matrix:
include:
- BuildType: Release
Platform: ARM
WorkaroundSwitch: WITH_FIXED_BATCH_SIZE
- BuildType: Release
Platform: x64
WorkaroundSwitch: WITH_FIXED_BATCH_SIZE
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Create Build Environment'
run: |
sudo apt-get update -y
sudo apt-get install -y cmake curl g++ libgl1-mesa-dev libopenmpt-dev
- name: 'Configure CMake'
run: |
case "${{ matrix.Platform }}" in
ARM ) architecture="arm64-v8a;armeabi-v7a"
universalApk="ON" ;;
x64 ) architecture="x86_64"
universalApk="OFF" ;;
* ) exit 1 ;;
esac
rm -f ./Content/Translations/*.po
export JAVA_HOME=$JAVA_HOME_17_X64
#cmake -B ./_build/ -D CMAKE_BUILD_TYPE=${{ matrix.BuildType }} -D NCINE_BUILD_ANDROID=ON -D NCINE_UNIVERSAL_APK="$universalApk" -D NCINE_NDK_ARCHITECTURES="$architecture" -D DEATH_DEBUG=ON -D NCINE_WITH_FIXED_BATCH_SIZE=10
cmake -B ./_build/ -D CMAKE_BUILD_TYPE=${{ matrix.BuildType }} -D NCINE_BUILD_ANDROID=ON -D NCINE_UNIVERSAL_APK="$universalApk" -D NCINE_NDK_ARCHITECTURES="$architecture" -D DEATH_DEBUG=ON -D NCINE_INPUT_DEBUGGING=ON
- name: 'Build'
run: |
export JAVA_HOME=$JAVA_HOME_17_X64
make -j $(nproc) -C ./_build/
cd ./_build/android/
gradle assemble${{ matrix.BuildType }}
- name: 'Create Package'
run: |
case "${{ matrix.BuildType }}" in
Debug ) buildDir="debug"
fileSuffix="debug" ;;
* ) buildDir="release"
fileSuffix="release-unsigned" ;;
esac
case "${{ matrix.Platform }}" in
ARM ) filename="app-universal-$fileSuffix.apk" ;;
x64 ) filename="app-x86_64-$fileSuffix.apk" ;;
* ) exit 1 ;;
esac
echo '${{ secrets.ANDROID_KEYSTORE_FILE }}' | base64 --decode > ./_keystore.jks
mkdir ./_package/
$ANDROID_HOME/build-tools/34.0.0/zipalign -p 4 "./_build/android/app/build/outputs/apk/$buildDir/$filename" "./_package/Jazz2d.apk"
$ANDROID_HOME/build-tools/34.0.0/apksigner sign --ks-key-alias Main --ks "./_keystore.jks" --ks-pass "pass:${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" --key-pass "pass:${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" "./_package/Jazz2d.apk"
cp -f ./LICENSE ./_package/LICENSE
- name: 'Upload Package'
uses: actions/upload-artifact@v4
with:
name: Jazz2_Android_DEBUG_${{ matrix.Platform }}
path: ./_package/