-
Notifications
You must be signed in to change notification settings - Fork 30
333 lines (268 loc) · 9.32 KB
/
build-sdks.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
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
325
326
327
328
329
330
331
332
333
name: Build SDKs
concurrency:
group: "build-mobile-${{ github.ref }}"
cancel-in-progress: true
on:
push:
branches: [ master, staging, qa ]
tags:
- 'v*.*.*'
pull_request:
workflow_dispatch:
env:
GITHUB_TOKEN: ${{ secrets.GOSDK }}
jobs:
build-ios:
name: Build-ios
runs-on: macos-runner
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.20.4
- name: Clean build
run: make clean-mobilesdk
- name: Install GoMobile
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
go install golang.org/x/mobile/cmd/gobind@latest
gomobile init
env:
GO111MODULE: "on"
- name: Setup GoMobile
run: make setup-gomobile
- name: Build iOS
run: |
go version
make build-ios
- name: Compress
run: |
tar -czvf zcncore-ios.tar.gz out/iossdk/ios/zcncore.xcframework
- name: Setup Build
id: setup_build
run: |
tag=$(echo ${GITHUB_REF#refs/tags/})
echo ${tag}
if [[ "${{github.event_name}}" = "workflow_dispatch" ]]; then
echo "> 0Chain: trigger from workflow_dispatch"
echo "::set-output name=RELEASE::false"
echo "::set-output name=TAG::none"
elif [[ ${tag} = v*\.*\.* ]] ; then
echo "> 0Chain: trigger from git event"
# upload output on release
echo "::set-output name=RELEASE::true"
echo "::set-output name=TAG::${tag}"
fi
- name: Upload zcncore-ios to release
if: steps.setup_build.outputs.RELEASE == 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: zcncore-ios.tar.gz
tag: ${{ steps.setup_build.outputs.TAG }}
overwrite: true
file_glob: true
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: zcncore-ios
path: |
zcncore-ios.tar.gz
build-android:
name: Build-android
runs-on: [self-hosted, arc-runner]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.20.4
- name: Install deps
run: |
#codename=$(lsb_release -c | awk '{print $2}')
#echo "deb http://mirror.genesisadaptive.com/ubuntu/ $codename main" > ./gitaction.list
#echo "deb http://mirror.math.princeton.edu/pub/ubuntu/ $codename main" ./gitaction.list
#echo "deb http://mirror.pit.teraswitch.com/ubuntu/ $codename main" >> ./gitaction.list
#sudo mv -f ./gitaction.list /etc/apt/sources.list.d/
sudo apt-get update -y && sudo apt-get install build-essential wget unzip -y
- name: Install Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '8'
- uses: android-actions/setup-android@v2
- name: Install Android Platform
run: |
sdkmanager "platform-tools"
sdkmanager "platforms;android-29"
sdkmanager "build-tools;29.0.2"
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r21d
- name: Clean build
run: make clean-mobilesdk
- name: Install GoMobile
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
go install golang.org/x/mobile/cmd/gobind@latest
gomobile init
env:
GO111MODULE: "on"
- name: Setup GoMobile
run: make setup-gomobile
- name: Build Android
run: |
go version
make build-android
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_NDK_TOOLCHAIN: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin
- name: Compress
run: tar -czvf zcncore-android.tar.gz out/androidsdk/zcncore.aar
- name: Setup Build
id: setup_build
run: |
tag=$(echo ${GITHUB_REF#refs/tags/})
echo ${tag}
if [[ "${{github.event_name}}" = "workflow_dispatch" ]]; then
echo "> 0Chain: trigger from workflow_dispatch"
echo "::set-output name=RELEASE::false"
echo "::set-output name=TAG::none"
elif [[ ${tag} = v*\.*\.* ]] ; then
echo "> 0Chain: trigger from git event"
# upload output on release
echo "::set-output name=RELEASE::true"
echo "::set-output name=TAG::${tag}"
fi
- name: Upload binaries to release
if: steps.setup_build.outputs.RELEASE == 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: zcncore-android.tar.gz
tag: ${{ steps.setup_build.outputs.TAG }}
overwrite: true
file_glob: true
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: zcncore-android
path: zcncore-android.tar.gz
build-macos:
name: Build-macos
runs-on: macos-runner
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.20.4
- name: Clean build
run: make clean-mobilesdk
- name: Install GoMobile
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
go install golang.org/x/mobile/cmd/gobind@latest
gomobile init
env:
GO111MODULE: "on"
- name: Setup GoMobile
run: make setup-gomobile
- name: Build MacOS
run: |
go version
make build-macos
- name: Compress
run: |
tar -czvf zcncore-macos.tar.gz out/macossdk/zcncore.xcframework
- name: Setup Build
id: setup_build
run: |
tag=$(echo ${GITHUB_REF#refs/tags/})
echo ${tag}
if [[ "${{github.event_name}}" = "workflow_dispatch" ]]; then
echo "> 0Chain: trigger from workflow_dispatch"
echo "::set-output name=RELEASE::false"
echo "::set-output name=TAG::none"
elif [[ ${tag} = v*\.*\.* ]] ; then
echo "> 0Chain: trigger from git event"
# upload output on release
echo "::set-output name=RELEASE::true"
echo "::set-output name=TAG::${tag}"
fi
- name: Upload zcncore-macos to release
if: steps.setup_build.outputs.RELEASE == 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: zcncore-macos.tar.gz
tag: ${{ steps.setup_build.outputs.TAG }}
overwrite: true
file_glob: true
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: zcncore-macos
path: |
zcncore-macos.tar.gz
build-windows:
name: Build-windows
runs-on: [self-hosted, arc-runner]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.20.4
- name: Install deps
run: |
#codename=$(lsb_release -c | awk '{print $2}')
#echo "deb http://mirror.genesisadaptive.com/ubuntu/ $codename main" > ./gitaction.list
#echo "deb http://mirror.math.princeton.edu/pub/ubuntu/ $codename main" ./gitaction.list
#echo "deb http://mirror.pit.teraswitch.com/ubuntu/ $codename main" >> ./gitaction.list
#sudo mv -f ./gitaction.list /etc/apt/sources.list.d/
sudo apt-get update -y && sudo apt-get install build-essential wget -y
- name: Build windows
run: |
go version
make build-windows
- name: Compress
run: |
sudo apt install zip -y
zip zcn-windows.zip ./winsdk/zcn.windows.dll ./winsdk/zcn.windows.h
- name: Setup Build
id: setup_build
run: |
tag=$(echo ${GITHUB_REF#refs/tags/})
echo ${tag}
if [[ "${{github.event_name}}" = "workflow_dispatch" ]]; then
echo "> 0Chain: trigger from workflow_dispatch"
echo "::set-output name=RELEASE::false"
echo "::set-output name=TAG::none"
elif [[ ${tag} = v*\.*\.* ]] ; then
echo "> 0Chain: trigger from git event"
# upload output on release
echo "::set-output name=RELEASE::true"
echo "::set-output name=TAG::${tag}"
fi
- name: Upload zcn-windows to release
if: steps.setup_build.outputs.RELEASE == 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: zcn-windows.zip
tag: ${{ steps.setup_build.outputs.TAG }}
overwrite: true
file_glob: true
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: zcn-windows
path: |
zcn-windows.zip