-
Notifications
You must be signed in to change notification settings - Fork 1
211 lines (207 loc) · 8.23 KB
/
unity-plugin-zip.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
name: Build Unity Plugin Zip
on:
workflow_dispatch: {}
label:
types:
- created
jobs:
linux_shared_library:
name: Linux Shared Library
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Rust toolchain x86_64-unknown-linux-gnu
uses: actions-rs/toolchain@v1
with:
target: x86_64-unknown-linux-gnu
- name: Compile
run: |
docker build -f ./script/reddio-linux/Dockerfile -t reddio-native-library:latest .
docker container create --name extract-reddio reddio-native-library:latest
mkdir -p ./reddio/target/x86_64-unknown-linux-gnu/release
docker container cp extract-reddio:/workspace/reddio/target/x86_64-unknown-linux-gnu/release/libreddio.a ./reddio/target/x86_64-unknown-linux-gnu/release/libreddio.a
docker container cp extract-reddio:/workspace/reddio/target/x86_64-unknown-linux-gnu/release/libreddio.so ./reddio/target/x86_64-unknown-linux-gnu/release/libreddio.so
docker container rm -f extract-reddio
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: libreddio-x86_64-unknown-linux-gnu
path: |
reddio/target/x86_64-unknown-linux-gnu/release/libreddio.a
reddio/target/x86_64-unknown-linux-gnu/release/libreddio.so
android_share_library:
name: Android Shared Library
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup cargo-ndk
run: |
cargo install cargo-ndk
- name: Setup Rust toolchain aarch64-linux-android
uses: actions-rs/toolchain@v1
with:
target: aarch64-linux-android
- name: Setup Rust toolchain armv7-linux-androideabi
uses: actions-rs/toolchain@v1
with:
target: armv7-linux-androideabi
- name: Setup Rust toolchain x86_64-linux-android
uses: actions-rs/toolchain@v1
with:
target: x86_64-linux-android
- name: Setup NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: r25
- name: Build Android Shared Library
run: |
cd reddio && cargo ndk -t armeabi-v7a -t arm64-v8a -t x86_64 build --release
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: libreddio-aarch64-linux-android
path: |
reddio/target/aarch64-linux-android/release/libreddio.a
reddio/target/aarch64-linux-android/release/libreddio.so
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: libreddio-armv7-linux-androideabi
path: |
reddio/target/armv7-linux-androideabi/release/libreddio.a
reddio/target/armv7-linux-androideabi/release/libreddio.so
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: libreddio-x86_64-linux-android
path: |
reddio/target/x86_64-linux-android/release/libreddio.a
reddio/target/x86_64-linux-android/release/libreddio.so
windows_shared_library:
name: Windows Shared Library
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Rust toolchain x86_64-pc-windows-msvc
uses: actions-rs/toolchain@v1
with:
target: x86_64-pc-windows-msvc
- name: Compile
run: |
cd reddio && cargo build --release --target x86_64-pc-windows-msvc
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: libreddio-x86_64-pc-windows-msvc
path: |
reddio/target/x86_64-pc-windows-msvc/release/reddio.lib
reddio/target/x86_64-pc-windows-msvc/release/reddio.dll
macos_shared_library:
name: macOS Shared Library
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Rust toolchain aarch64-apple-darwin
uses: actions-rs/toolchain@v1
with:
target: aarch64-apple-darwin
- name: Setup Rust toolchain x86_64-apple-darwin
uses: actions-rs/toolchain@v1
with:
target: x86_64-apple-darwin
- name: Build macOS shared Library
run: |
cd reddio && cargo build --target x86_64-apple-darwin --target aarch64-apple-darwin --release
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: libreddio-aarch64-apple-darwin
path: |
reddio/target/aarch64-apple-darwin/release/libreddio.a
reddio/target/aarch64-apple-darwin/release/libreddio.dylib
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: libreddio-x86_64-apple-darwin
path: |
reddio/target/x86_64-apple-darwin/release/libreddio.a
reddio/target/x86_64-apple-darwin/release/libreddio.dylib
ios_static_library:
name: iOS Static Library
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup cargo-lipo
run: |
cargo install cargo-lipo
- name: Setup Rust toolchain aarch64-apple-ios
uses: actions-rs/toolchain@v1
with:
target: aarch64-apple-ios
- name: Setup Rust toolchain x86_64-apple-ios
uses: actions-rs/toolchain@v1
with:
target: x86_64-apple-ios
- name: Build iOS Static Library
run: |
cd reddio && cargo lipo --release
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: libreddio-universal-apple-ios
path: |
reddio/target/universal/release/libreddio.a
unity_plugin_zip:
name: Package Unity Plugin Zip
runs-on: ubuntu-20.04
needs:
- linux_shared_library
- android_share_library
- windows_shared_library
- macos_shared_library
- ios_static_library
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare Playground
run: mkdir -p artifacts
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -R
working-directory: artifacts
- name: Restructure Libraries
run: |
mkdir -p unity/Plugins/reddio-sdk-unity/iOS
mkdir -p unity/Plugins/reddio-sdk-unity/Android/arm64
mkdir -p unity/Plugins/reddio-sdk-unity/Android/armeabi-v7a
mkdir -p unity/Plugins/reddio-sdk-unity/Android/x86_64
mkdir -p unity/Plugins/reddio-sdk-unity/Editor/aarch64
mkdir -p unity/Plugins/reddio-sdk-unity/Editor/x86_64
# iOS
cp artifacts/libreddio-universal-apple-ios/libreddio.a unity/Plugins/reddio-sdk-unity/iOS/libreddio.a
# Android
cp artifacts/libreddio-aarch64-linux-android/libreddio.so unity/Plugins/reddio-sdk-unity/Android/arm64/libreddio.so
cp artifacts/libreddio-armv7-linux-androideabi/libreddio.so unity/Plugins/reddio-sdk-unity/Android/armeabi-v7a/libreddio.so
cp artifacts/libreddio-x86_64-linux-android/libreddio.so unity/Plugins/reddio-sdk-unity/Android/x86_64/libreddio.so
# Editor / Standalone
cp artifacts/libreddio-aarch64-apple-darwin/libreddio.dylib unity/Plugins/reddio-sdk-unity/Editor/aarch64/libreddio.dylib
cp artifacts/libreddio-x86_64-pc-windows-msvc/reddio.dll unity/Plugins/reddio-sdk-unity/Editor/x86_64/reddio.dll
cp artifacts/libreddio-x86_64-apple-darwin/libreddio.dylib unity/Plugins/reddio-sdk-unity/Editor/x86_64/libreddio.dylib
cp artifacts/libreddio-x86_64-unknown-linux-gnu/libreddio.so unity/Plugins/reddio-sdk-unity/Editor/x86_64/libreddio.so
# Script
cp -r reddio-csharp/reddio.crypto unity/Plugins/reddio-sdk-unity/reddio.crypto
cp -r reddio-csharp/reddio.api unity/Plugins/reddio-sdk-unity/reddio.api
cp -r reddio-unity/Assets/Plugins/reddio-sdk-unity/reddio.unity unity/Plugins/reddio-sdk-unity/reddio.unity
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: unity-plugin-zip
path: unity