-
-
Notifications
You must be signed in to change notification settings - Fork 50
356 lines (339 loc) · 11.6 KB
/
release.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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
name: Publish Release assets
on:
release:
types: [created]
jobs:
build-centos:
name: Centos5
runs-on: ubuntu-latest
container:
image: docker://hoshizora/manylinux1-clang_x86_64
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Checkout Old Version googletest
run: cd third_party/googletest && git checkout v1.8.x && cd ../..
- name: Update CMake
run: /opt/python/cp36-cp36m/bin/pip install "cmake<3.20"
- name: Configure Build
run: mkdir build && cd build && /opt/python/cp36-cp36m/bin/cmake -DCMAKE_BUILD_TYPE=Release -DKIWI_USE_MIMALLOC=0 -DKIWI_USE_CPUINFO=0 ..
- name: Build
run: cd build && make -j2
- run: |
mkdir result
cd result
mkdir include && mkdir lib && mkdir bin
mv ../build/libkiwi* lib/
mv ../build/kiwi-* bin/
mv ../build/test/kiwi-* bin/
cp -r ../include/kiwi include/
tar -zcvf ../asset.tgz include/ lib/ bin/
- name: Archive binaries
uses: actions/upload-artifact@v1
with:
name: asset_Centos5
path: asset.tgz
upload-asset-from-centos:
name: Upload asset from Centos5
needs: build-centos
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: asset_Centos5
path: arts
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Upload release binary
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: arts/asset.tgz
asset_name: kiwi_lnx_centos5_x86_64_${{ steps.get_release.outputs.tag_name }}.tgz
asset_content_type: application/octet-stream
build-centos6:
name: Centos6
runs-on: ubuntu-latest
container:
image: docker://quay.io/pypa/manylinux2010_x86_64
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Update CMake
run: |
/opt/python/cp36-cp36m/bin/pip install cmake
yum install java-1.8.0-openjdk-devel.x86_64 -y
- name: Configure Build
run: mkdir build && cd build && /opt/python/cp36-cp36m/bin/cmake -DCMAKE_BUILD_TYPE=Release -DKIWI_JAVA_BINDING=1 ..
- name: Build
run: cd build && make -j2
- run: |
mkdir result
cd result
mkdir include && mkdir lib && mkdir bin
mv ../build/libkiwi* lib/
mv ../build/kiwi-* bin/
mv ../build/test/kiwi-* bin/
cp -r ../include/kiwi include/
tar -zcvf ../asset.tgz include/ lib/ bin/
- name: Archive binaries
uses: actions/upload-artifact@v1
with:
name: asset_Centos6
path: asset.tgz
- run: |
mv build/bindings/java/kiwi-java*.jar kiwi-java.jar
- name: Archive jar binaries
uses: actions/upload-artifact@v1
with:
name: jar_Centos6
path: kiwi-java.jar
upload-asset-from-centos6:
name: Upload asset from Centos6
needs: build-centos6
runs-on: ubuntu-latest
steps:
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- uses: actions/download-artifact@v2
with:
name: asset_Centos6
path: arts
- name: Upload release binary
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: arts/asset.tgz
asset_name: kiwi_lnx_x86_64_${{ steps.get_release.outputs.tag_name }}.tgz
asset_content_type: application/octet-stream
- uses: actions/download-artifact@v2
with:
name: jar_Centos6
path: arts
- name: Upload release jar
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: arts/kiwi-java.jar
asset_name: kiwi-java-${{ steps.get_release.outputs.tag_name }}-lnx-x86-64.jar
asset_content_type: application/octet-stream
build-macos:
strategy:
matrix:
os: [macos-13]
arch: [x86_64, arm64]
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} - ${{ matrix.arch }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
lfs: true
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Configure Build
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 -DKIWI_CPU_ARCH=${{ matrix.arch }} -DKIWI_JAVA_BINDING=1 ..
- name: Build
run: cd build && make -j2
- run: |
mkdir result
cd result
mkdir include && mkdir lib && mkdir bin
mv ../build/libkiwi* lib/
mv ../build/kiwi-* bin/
mv ../build/test/kiwi-* bin/
cp -r ../include/kiwi include/
tar -zcvf ../asset.tgz include/ lib/ bin/
- name: Upload release binary
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: asset.tgz
asset_name: kiwi_mac_${{ matrix.arch }}_${{ steps.get_release.outputs.tag_name }}.tgz
asset_content_type: application/octet-stream
- run: |
mv build/bindings/java/kiwi-java*.jar kiwi-java.jar
- name: Upload release jar
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: kiwi-java.jar
asset_name: kiwi-java-${{ steps.get_release.outputs.tag_name }}-mac-${{ matrix.arch }}.jar
asset_content_type: application/octet-stream
- if: matrix.arch == 'arm64'
run: tar -zcvf model.tgz ModelGenerator/sj.* ModelGenerator/extract.mdl ModelGenerator/*.dict ModelGenerator/combiningRule.txt ModelGenerator/skipbigram.mdl
- name: Upload release binary
if: matrix.arch == 'arm64'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: model.tgz
asset_name: kiwi_model_${{ steps.get_release.outputs.tag_name }}_base.tgz
asset_content_type: application/octet-stream
build-windows:
strategy:
matrix:
os: [windows-2019]
arch: [Win32, x64]
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} ${{ matrix.arch }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
lfs: true
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Init
run: |
mkdir build
- name: Build
uses: lukka/run-cmake@v3
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeBuildType: Release
buildWithCMake: true
cmakeAppendedArgs: -G"Visual Studio 16 2019" -A${{ matrix.arch }} -DKIWI_JAVA_BINDING=1
buildWithCMakeArgs: --config Release
buildDirectory: build
- run: |
mkdir result
cd result
mkdir include; mkdir lib; mkdir bin
mv ..\build\Release\*.dll lib\
mv ..\build\Release\*.exp lib\
mv ..\build\Release\*.lib lib\
mv ..\build\Release\*.exe bin\
mv ..\build\test\Release\*.exe bin\
cp -r ..\include\kiwi include\
Compress-Archive -Path 'include', 'lib', 'bin' -DestinationPath ..\asset.zip
- name: Upload release binary
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: asset.zip
asset_name: kiwi_win_${{ matrix.arch }}_${{ steps.get_release.outputs.tag_name }}.zip
asset_content_type: application/octet-stream
- run: |
mv build/bindings/java/kiwi-java*.jar kiwi-java.jar
- name: Upload release jar
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: kiwi-java.jar
asset_name: kiwi-java-${{ steps.get_release.outputs.tag_name }}-win-${{ matrix.arch }}.jar
asset_content_type: application/octet-stream
build-other-arch:
strategy:
matrix:
arch: [aarch64, ppc64le]
name: Centos7-${{ matrix.arch }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
lfs: true
- uses: bab2min/run-on-arch-action@use-custom-image
id: runcmd
with:
image: quay.io/pypa/manylinux2014_${{ matrix.arch }}
githubToken: ${{ github.token }}
setup: |
mkdir -p "${PWD}/artifacts"
dockerRunArgs: |
--volume "${PWD}/artifacts:/artifacts"
run: |
yum install java-1.8.0-openjdk-devel -y
mkdir build && pushd build && cmake -DCMAKE_BUILD_TYPE=Release -DKIWI_USE_MIMALLOC=0 -DKIWI_JAVA_BINDING=1 ..
make -j2 && popd
./build/test/kiwi-test
mkdir eval_results && ./build/kiwi-evaluator -m ./ModelGenerator eval_data/*.txt -o eval_results/
cd build
mkdir include && mkdir lib && mkdir bin
mv libkiwi* lib/
mv kiwi-* bin/
mv test/kiwi-* bin/
cp -r ../include/kiwi include/
tar -zcvf /artifacts/asset.tgz include/ lib/ bin/
mv bindings/java/kiwi-java*.jar /artifacts/kiwi-java.jar
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Upload release binary
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: artifacts/asset.tgz
asset_name: kiwi_lnx_${{ matrix.arch }}_${{ steps.get_release.outputs.tag_name }}.tgz
asset_content_type: application/octet-stream
- name: Upload release jar
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: artifacts/kiwi-java.jar
asset_name: kiwi-java-${{ steps.get_release.outputs.tag_name }}-lnx-${{ matrix.arch }}.jar
asset_content_type: application/octet-stream
build-emscripten:
name: Emscripten
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
lfs: true
- uses: mymindstorm/setup-emsdk@v14
- name: Build
run: |
cd bindings/wasm
./build.sh
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
package: bindings/wasm/package
- name: Build documenation
run: |
cd bindings/wasm/package
npm run doc
- name: Publish documenation
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: bindings/wasm/package/doc
destination_dir: ./kiwi-nlp