-
Notifications
You must be signed in to change notification settings - Fork 27
325 lines (282 loc) · 11.3 KB
/
build_native_libraries.yaml
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
name: Build and Test
on:
push:
branches:
- dev
paths:
- 'dependency/**'
- 'projects/**'
- 'src/**'
pull_request:
branches:
- dev
jobs:
build_windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build
run: |
cd projects/CMake
cmake -S . -B ./build_x86 -A Win32
cmake -S . -B ./build_x86_64 -A x64
cmake --build ./build_x86 --config Release
cmake --build ./build_x86_64 --config Release
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: LottiePluginWindowsArtifacts
path: |
out/Release/Plugins/Windows/x86/LottiePlugin.dll
out/Release/Plugins/Windows/x86_64/LottiePlugin.dll
build_android:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Setup CMake
uses: jwlawson/[email protected]
with:
cmake-version: '3.25.2'
- name: Set execution permissions for gradlew
run: chmod +x projects/AndroidStudio/gradlew
- name: Build Gradle project
run: |
echo $ANDROID_NDK_HOME
result=$(find $ANDROID_NDK_HOME -name aarch64-linux-android-strip)
echo $result
cd projects/AndroidStudio
./gradlew assembleRelease
tree ../../out
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: LottiePluginAndroidArtifacts
path: |
out/RelWithDebInfo/Plugins/Android/arm64-v8a/libLottiePlugin.so
out/RelWithDebInfo/Plugins/Android/armeabi-v7a/libLottiePlugin.so
out/RelWithDebInfo/Plugins/Android/x86/libLottiePlugin.so
out/RelWithDebInfo/Plugins/Android/x86_64/libLottiePlugin.so
build_macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install CMake
run: brew install cmake
- name: Build
run: |
cd projects/CMake
cmake -S . -B ./buildOSX -G Xcode -DRLOTTIE_OSX=1 -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
cmake --build ./buildOSX --config Release
brew install tree
tree ../../out
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: LottiePluginMacOSArtifacts
path: |
out/Release/Plugins/Darwin/x86_64/libLottiePlugin.dylib
build_ios:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install CMake
run: brew install cmake
- name: Build
run: |
cd projects/CMake
cmake -S . -B ./buildIOS -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../dependency/cmake-ios-toolchain/ios.toolchain.cmake -DPLATFORM=OS64 -DRLOTTIE_IOS=1
cmake --build ./buildIOS --config Release --target LottiePlugin
brew install tree
tree ../../out
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: LottiePluginIOSArtifacts
path: |
out/Release/Plugins/iOS/aarch64/libLottiePlugin.a
out/Release/Plugins/iOS/aarch64/librlottie.a
build_linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install CMake
run: sudo apt-get install cmake
- name: Build
run: |
cd projects/CMake
cmake -S . -B ./buildLinux -G "Unix Makefiles" -DRLOTTIE_LINUX=1
cmake --build ./buildLinux --config Release
tree ../../out
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: LottiePluginLinuxArtifacts
path: |
out/Plugins/Linux/x86_64/libLottiePlugin.so
build_webgl:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Modify rlottie CMakeLists.txt
run: sed -i '/add_subdirectory(example)/d' dependency/rlottie/CMakeLists.txt
- name: Install Emscripten and Build
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
cd ../projects/CMake
emcmake cmake -S . -B ./buildWebGL -DRLOTTIE_WEB_ASSEMBLY=1 -DLOTTIE_MODULE=OFF -DBUILD_SHARED_LIBS=OFF
emmake cmake --build ./buildWebGL --config Release
cd ../..
mkdir -p out/Release/Plugins/WebGL
emcc -O3 -flto -o out/Release/Plugins/WebGL/LottiePlugin.bc out/Plugins/Emscripten/x86/libLottiePlugin.a out/Plugins/Emscripten/x86/librlottie.a
tree out
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: LottiePluginWebGLArtifacts
path: |
out/Release/Plugins/WebGL/LottiePlugin.bc
out/Release/Plugins/WebGL/LottiePlugin.wasm
out/Plugins/Emscripten/x86/libLottiePlugin.a
out/Plugins/Emscripten/x86/librlottie.a
# run_tests_and_build_unity_ubuntulatest:
# needs: [build_windows, build_android, build_macos, build_ios, build_linux, build_webgl]
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# submodules: recursive
# - name: Download artifacts
# uses: actions/download-artifact@v3
# with:
# name: LottiePluginLinuxArtifacts
# path: out/Plugins/Linux
# - name: Force replace the native libraries
# run: |
# tree out
# cp -f out/Plugins/Linux/libLottiePlugin.so unity/RLottieUnity/Assets/LottiePlugin/Plugins/Linux/x86_64/libLottiePlugin.so
# tree unity/RLottieUnity/Assets/LottiePlugin/Plugins/Linux
# - name: Run Tests in Unity
# uses: game-ci/unity-test-runner@v3
# env:
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
# with:
# projectPath: unity/RLottieUnity
# githubToken: ${{ secrets.GITHUB_TOKEN }}
# customParameters: -logFile -
# run_tests_and_build_unity_windows:
# needs: [build_windows, build_android, build_macos, build_ios, build_linux, build_webgl]
# runs-on: windows-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# submodules: recursive
# - name: Download artifacts
# uses: actions/download-artifact@v3
# with:
# name: LottiePluginWindowsArtifacts
# path: out/Plugins/Windows
# - name: Force replace the native libraries
# run: |
# Copy-Item -Force out/Plugins/Windows/x86/LottiePlugin.dll -Destination unity/RLottieUnity/Assets/LottiePlugin/Plugins/Windows/x86/LottiePlugin.dll
# Copy-Item -Force out/Plugins/Windows/x86_64/LottiePlugin.dll -Destination unity/RLottieUnity/Assets/LottiePlugin/Plugins/Windows/x86_64/LottiePlugin.dll
# - name: Run Tests in Unity
# uses: game-ci/unity-test-runner@v4
# env:
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
# with:
# projectPath: unity/RLottieUnity
# githubToken: ${{ secrets.GITHUB_TOKEN }}
# customParameters: -logFile -
commit_and_push_native_libraries:
needs: [build_windows, build_android, build_macos, build_ios, build_linux, build_webgl]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: dev
submodules: recursive
- name: Download artifacts windows
uses: actions/download-artifact@v3
with:
name: LottiePluginWindowsArtifacts
path: out/Plugins/Windows
- name: Download artifacts android
uses: actions/download-artifact@v3
with:
name: LottiePluginAndroidArtifacts
path: out/Plugins/Android
- name: Download artifacts macos
uses: actions/download-artifact@v3
with:
name: LottiePluginMacOSArtifacts
path: out/Plugins/Darwin
- name: Download artifacts ios
uses: actions/download-artifact@v3
with:
name: LottiePluginIOSArtifacts
path: out/Plugins/iOS
- name: Download artifacts linux
uses: actions/download-artifact@v3
with:
name: LottiePluginLinuxArtifacts
path: out/Plugins/Linux
# - name: Download artifacts webgl
# uses: actions/download-artifact@v3
# with:
# name: LottiePluginWebGLArtifacts
# path: out/Plugins/WebGL
- name: Commit and push native libraries
env:
MY_SECRET: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
cp -f out/Plugins/Windows/x86/LottiePlugin.dll unity/RLottieUnity/Assets/LottiePlugin/Plugins/Windows/x86/LottiePlugin.dll
cp -f out/Plugins/Windows/x86_64/LottiePlugin.dll unity/RLottieUnity/Assets/LottiePlugin/Plugins/Windows/x86_64/LottiePlugin.dll
cp -f out/Plugins/Android/arm64-v8a/libLottiePlugin.so unity/RLottieUnity/Assets/LottiePlugin/Plugins/Android/arm64-v8a/libLottiePlugin.so
cp -f out/Plugins/Android/armeabi-v7a/libLottiePlugin.so unity/RLottieUnity/Assets/LottiePlugin/Plugins/Android/armeabi-v7a/libLottiePlugin.so
cp -f out/Plugins/Android/x86/libLottiePlugin.so unity/RLottieUnity/Assets/LottiePlugin/Plugins/Android/x86/libLottiePlugin.so
cp -f out/Plugins/Android/x86_64/libLottiePlugin.so unity/RLottieUnity/Assets/LottiePlugin/Plugins/Android/x86_64/libLottiePlugin.so
cp -f out/Plugins/Darwin/libLottiePlugin.dylib unity/RLottieUnity/Assets/LottiePlugin/Plugins/OSX/libLottiePlugin.dylib
cp -f out/Plugins/iOS/libLottiePlugin.a unity/RLottieUnity/Assets/LottiePlugin/Plugins/iOS/libLottiePlugin.a
cp -f out/Plugins/iOS/librlottie.a unity/RLottieUnity/Assets/LottiePlugin/Plugins/iOS/librlottie.a
cp -f out/Plugins/Linux/libLottiePlugin.so unity/RLottieUnity/Assets/LottiePlugin/Plugins/Linux/x86_64/libLottiePlugin.so
git add .
git status
git config --global user.email "[email protected]"
git config --global user.name "Konstantin Gindemit"
git remote -v
git commit --allow-empty -m "New native libraries version: 0.3.0-dev.${{ github.run_number }}"
git tag -a 0.3.0-dev.${{ github.run_number }} -m "New native libraries version: 0.3.0-dev.${{ github.run_number }}"
git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | xargs -L1 git config --unset-all
echo "Trying to push..."
git push --set-upstream https://token:[email protected]/gindemit/unity-rlottie.git
git push --tags --set-upstream https://token:[email protected]/gindemit/unity-rlottie.git