-
-
Notifications
You must be signed in to change notification settings - Fork 50
276 lines (265 loc) · 9.39 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
name: Publish Release assets
on:
release:
types: [created]
jobs:
build-centos7:
name: Centos7
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- uses: bab2min/run-on-arch-action@multiple-step
with:
image: quay.io/pypa/manylinux2014_x86_64
githubToken: ${{ github.token }}
multipleRun: |
- name: Update CMake
run: |
/opt/python/cp310-cp310/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/cp310-cp310/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/
- run: |
mv build/bindings/java/kiwi-java*.jar kiwi-java.jar
- 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_lnx_x86_64_${{ 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: 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@v3
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 models/base/sj.* models/base/extract.mdl models/base/*.dict models/base/combiningRule.txt models/base/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@v3
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@v3
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 ./models/base 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@v3
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