-
-
Notifications
You must be signed in to change notification settings - Fork 30
265 lines (238 loc) · 9.21 KB
/
pull_request_test.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
name: Pull Request Test
on:
pull_request:
branches:
- main
jobs:
build_manylinux:
name: Build for manylinux2010
runs-on: ubuntu-latest
container:
image: docker://quay.io/pypa/manylinux2010_x86_64
strategy:
max-parallel: 4
matrix:
cp: [cp38-cp38, cp39-cp39, cp310-cp310]
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Install Git LFS
run: |
mkdir gitlfs && pushd gitlfs
curl -L https://github.com/git-lfs/git-lfs/releases/download/v2.13.2/git-lfs-linux-amd64-v2.13.2.tar.gz | tar -zxv
./install.sh
popd
- name: Pull LFS files
run: cd Kiwi && git config --global --add safe.directory /__w/kiwipiepy/kiwipiepy/Kiwi && git lfs pull
- name: Build
run: |
mv Kiwi/ModelGenerator/sj.* model/kiwipiepy_model/
mv Kiwi/ModelGenerator/extract.mdl model/kiwipiepy_model/
mv Kiwi/ModelGenerator/*.dict model/kiwipiepy_model/
mv Kiwi/ModelGenerator/combiningRule.txt model/kiwipiepy_model/
mv Kiwi/ModelGenerator/skipbigram.mdl model/kiwipiepy_model/
/opt/python/${{ matrix.cp }}/bin/python -m pip install numpy==`/opt/python/${{ matrix.cp }}/bin/python .github/workflows/numpy_version.py`
cd model
/opt/python/${{ matrix.cp }}/bin/python setup.py build install
cd ..
/opt/python/${{ matrix.cp }}/bin/python setup.py build install
- run: tar -zcvf build.tgz build
- name: Archive binary
uses: actions/upload-artifact@v1
with:
name: Linux Binary ${{ matrix.cp }}
path: build.tgz
- name: Test kiwipiepy
run: |
/opt/python/${{ matrix.cp }}/bin/python -m pip install pytest
/opt/python/${{ matrix.cp }}/bin/python -m pytest --verbose test/test_kiwipiepy.py
- name: Test transformers_addon
run: |
for v in {12..28}
do
echo "Test with transformers 4.$v ..."
if /opt/python/${{ matrix.cp }}/bin/python -m pip install -U "transformers<4.$(($v+1))"; then
/opt/python/${{ matrix.cp }}/bin/python -m pytest --verbose test/test_transformers_addon.py
fi
done
build_manylinux2014:
name: Build for manylinux2014
runs-on: ubuntu-latest
container:
image: docker://quay.io/pypa/manylinux2014_x86_64
strategy:
max-parallel: 4
matrix:
cp: [cp311-cp311, cp312-cp312]
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Install Git LFS
run: |
mkdir gitlfs && pushd gitlfs
curl -L https://github.com/git-lfs/git-lfs/releases/download/v2.13.2/git-lfs-linux-amd64-v2.13.2.tar.gz | tar -zxv
./install.sh
popd
- name: Pull LFS files
run: cd Kiwi && git config --global --add safe.directory /__w/kiwipiepy/kiwipiepy/Kiwi && git lfs pull
- name: Build
run: |
mv Kiwi/ModelGenerator/sj.* model/kiwipiepy_model/
mv Kiwi/ModelGenerator/extract.mdl model/kiwipiepy_model/
mv Kiwi/ModelGenerator/*.dict model/kiwipiepy_model/
mv Kiwi/ModelGenerator/combiningRule.txt model/kiwipiepy_model/
mv Kiwi/ModelGenerator/skipbigram.mdl model/kiwipiepy_model/
/opt/python/${{ matrix.cp }}/bin/python -m pip install numpy==`/opt/python/${{ matrix.cp }}/bin/python .github/workflows/numpy_version.py`
cd model
/opt/python/${{ matrix.cp }}/bin/python setup.py build install
cd ..
/opt/python/${{ matrix.cp }}/bin/python setup.py build install
- run: tar -zcvf build.tgz build
- name: Archive binary
uses: actions/upload-artifact@v1
with:
name: Linux Binary ${{ matrix.cp }}
path: build.tgz
- name: Test kiwipiepy
run: |
/opt/python/${{ matrix.cp }}/bin/python -m pip install pytest
/opt/python/${{ matrix.cp }}/bin/python -m pytest --verbose test/test_kiwipiepy.py
- name: Test transformers_addon
run: |
for v in {12..28}
do
echo "Test with transformers 4.$v ..."
if /opt/python/${{ matrix.cp }}/bin/python -m pip install -U "transformers<4.$(($v+1))"; then
/opt/python/${{ matrix.cp }}/bin/python -m pytest --verbose test/test_transformers_addon.py
fi
done
build_macos_11:
name: Build for macOS 11
runs-on: macOS-11
strategy:
max-parallel: 4
matrix:
python-version: [3.8, 3.9, "3.10", 3.11] # 3.12 isn't supported by GitHub Actions yet
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
lfs: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Build
run: |
mv Kiwi/ModelGenerator/sj.* model/kiwipiepy_model/
mv Kiwi/ModelGenerator/extract.mdl model/kiwipiepy_model/
mv Kiwi/ModelGenerator/*.dict model/kiwipiepy_model/
mv Kiwi/ModelGenerator/combiningRule.txt model/kiwipiepy_model/
mv Kiwi/ModelGenerator/skipbigram.mdl model/kiwipiepy_model/
python -m pip install numpy==`python .github/workflows/numpy_version.py`
cd model
python setup.py build install
cd ..
MACOSX_DEPLOYMENT_TARGET=10.14 KIWI_CPU_ARCH=arm64 USE_MIMALLOC=1 python setup.py build
MACOSX_DEPLOYMENT_TARGET=10.14 KIWI_CPU_ARCH=x86_64 USE_MIMALLOC=1 python setup.py build install
- name: Archive binary
uses: actions/upload-artifact@v2
with:
name: macOS Binary ${{ matrix.python-version }} ${{ matrix.architecture }}
path: |
build/*
- name: Test kiwipiepy
run: |
python -m pip install pytest
python -m pytest -s --verbose test/test_kiwipiepy.py
build_windows:
name: Build for Windows
runs-on: windows-2019
strategy:
max-parallel: 5
matrix:
python-version: [3.8, 3.9, "3.10", 3.11, 3.12]
architecture: [x86, x64]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
lfs: true
- name: Set up Python ${{ matrix.python-version }} ${{ matrix.architecture }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Build
run: |
python -m pip install --upgrade pip setuptools
python -m pip install numpy==$(python .github/workflows/numpy_version.py)
mv Kiwi/ModelGenerator/sj.* model/kiwipiepy_model/
mv Kiwi/ModelGenerator/extract.mdl model/kiwipiepy_model/
mv Kiwi/ModelGenerator/*.dict model/kiwipiepy_model/
mv Kiwi/ModelGenerator/combiningRule.txt model/kiwipiepy_model/
mv Kiwi/ModelGenerator/skipbigram.mdl model/kiwipiepy_model/
cd model
python setup.py build install
cd ..
$env:USE_MIMALLOC = 1; python setup.py build install
- name: Archive binary
uses: actions/upload-artifact@v2
with:
name: Windows Binary ${{ matrix.python-version }} ${{ matrix.architecture }}
path: |
build/*
- name: Test kiwipiepy
run: |
python -m pip install pytest
python -m pytest --verbose test/test_kiwipiepy.py
build_other_arch:
name: Build for manylinux (other arch)
runs-on: ubuntu-latest
strategy:
max-parallel: 8
matrix:
cp: [cp39-cp39, cp310-cp310, cp311-cp311, cp312-cp312]
arch: [aarch64, ppc64le]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
lfs: true
- if: matrix.arch == 'aarch64' || matrix.cp != 'cp312-cp312'
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: |
mv Kiwi/ModelGenerator/sj.* model/kiwipiepy_model/
mv Kiwi/ModelGenerator/extract.mdl model/kiwipiepy_model/
mv Kiwi/ModelGenerator/*.dict model/kiwipiepy_model/
mv Kiwi/ModelGenerator/combiningRule.txt model/kiwipiepy_model/
mv Kiwi/ModelGenerator/skipbigram.mdl model/kiwipiepy_model/
/opt/python/${{ matrix.cp }}/bin/python -m pip install wheel numpy==`/opt/python/${{ matrix.cp }}/bin/python .github/workflows/numpy_version.py`
cd model
/opt/python/${{ matrix.cp }}/bin/python setup.py build install
cd ..
/opt/python/${{ matrix.cp }}/bin/python setup.py build install bdist_wheel
tar -zcvf /artifacts/build.tgz build/*
cp -r dist /artifacts/
/opt/python/${{ matrix.cp }}/bin/python -m pip install pytest
/opt/python/${{ matrix.cp }}/bin/python -m pytest -s --verbose test/test_kiwipiepy.py
- name: Archive binary
uses: actions/upload-artifact@v2
with:
name: Linux ${{ matrix.arch }} Binary ${{ matrix.cp }}
path: artifacts/build.tgz
- name: Archive binary
uses: actions/upload-artifact@v2
with:
name: Linux ${{ matrix.arch }} Wheel ${{ matrix.cp }}
path: artifacts/dist/*.whl