Skip to content

Prepare 0.20.0

Prepare 0.20.0 #226

name: Pull Request Test
on:
pull_request:
branches:
- main
jobs:
build_manylinux:
name: Build for manylinux2010
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
cp: [cp38-cp38]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
lfs: true
- uses: bab2min/run-on-arch-action@multiple-step
id: runcmd
with:
image: quay.io/pypa/manylinux2010_x86_64
githubToken: ${{ github.token }}
multipleRun: |
- name: Build
run: |
mv Kiwi/models/base/sj.* model/kiwipiepy_model/
mv Kiwi/models/base/extract.mdl model/kiwipiepy_model/
mv Kiwi/models/base/*.dict model/kiwipiepy_model/
mv Kiwi/models/base/combiningRule.txt model/kiwipiepy_model/
mv Kiwi/models/base/skipbigram.mdl model/kiwipiepy_model/
/opt/python/${{ matrix.cp }}/bin/python -m pip install setuptools 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
- name: Test kiwipiepy
run: |
/opt/python/${{ matrix.cp }}/bin/python -m pip install pytest
/opt/python/${{ matrix.cp }}/bin/python -m pytest -svv test/test_kiwipiepy.py
- name: Test transformers_addon
run: |
/opt/python/${{ matrix.cp }}/bin/python -m pip install -U pip
for v in {12..42}
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
- run: tar -zcvf build.tgz build
- name: Archive binary
uses: actions/upload-artifact@v3
with:
name: Linux Binary ${{ matrix.cp }}
path: build.tgz
build_manylinux2014:
name: Build for manylinux2014
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
cp: [cp39-cp39, cp310-cp310, cp311-cp311, cp312-cp312, cp313-cp313]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
lfs: true
- uses: bab2min/run-on-arch-action@multiple-step
id: runcmd
with:
image: quay.io/pypa/manylinux2014_x86_64
githubToken: ${{ github.token }}
multipleRun: |
- name: Build
run: |
mv Kiwi/models/base/sj.* model/kiwipiepy_model/
mv Kiwi/models/base/extract.mdl model/kiwipiepy_model/
mv Kiwi/models/base/*.dict model/kiwipiepy_model/
mv Kiwi/models/base/combiningRule.txt model/kiwipiepy_model/
mv Kiwi/models/base/skipbigram.mdl model/kiwipiepy_model/
/opt/python/${{ matrix.cp }}/bin/python -m pip install setuptools 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
/opt/python/${{ matrix.cp }}/bin/python -m pip install numpy==`/opt/python/${{ matrix.cp }}/bin/python .github/workflows/numpy_version.py v1` || true
- name: Test kiwipiepy
run: |
/opt/python/${{ matrix.cp }}/bin/python -m pip install pytest
/opt/python/${{ matrix.cp }}/bin/python -m pytest -svv test/test_kiwipiepy.py
- name: Test transformers_addon
run: |
for v in {12..46}
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
- run: tar -zcvf build.tgz build
- name: Archive binary
uses: actions/upload-artifact@v3
with:
name: Linux Binary ${{ matrix.cp }}
path: build.tgz
build_macos_13:
name: Build for macOS 13
runs-on: macOS-13
strategy:
max-parallel: 4
matrix:
python-version: [3.8, 3.9, "3.10", 3.11, 3.12, 3.13]
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/models/base/sj.* model/kiwipiepy_model/
mv Kiwi/models/base/extract.mdl model/kiwipiepy_model/
mv Kiwi/models/base/*.dict model/kiwipiepy_model/
mv Kiwi/models/base/combiningRule.txt model/kiwipiepy_model/
mv Kiwi/models/base/skipbigram.mdl model/kiwipiepy_model/
python -m pip install numpy==`python .github/workflows/numpy_version.py` setuptools
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
python -m pip install numpy==`python .github/workflows/numpy_version.py v1` || true
- name: Archive binary
uses: actions/upload-artifact@v3
with:
name: macOS Binary ${{ matrix.python-version }}
path: |
build/*
- name: Test kiwipiepy
run: |
python -m pip install pytest
python -m pytest -svv 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/models/base/sj.* model/kiwipiepy_model/
mv Kiwi/models/base/extract.mdl model/kiwipiepy_model/
mv Kiwi/models/base/*.dict model/kiwipiepy_model/
mv Kiwi/models/base/combiningRule.txt model/kiwipiepy_model/
mv Kiwi/models/base/skipbigram.mdl model/kiwipiepy_model/
cd model
python setup.py build install
cd ..
$env:USE_MIMALLOC = 1; python setup.py build install
Try { python -m pip install numpy==$(python .github/workflows/numpy_version.py v1) } Catch {}
- name: Archive binary
uses: actions/upload-artifact@v3
with:
name: Windows Binary ${{ matrix.python-version }} ${{ matrix.architecture }}
path: |
build/*
- name: Test kiwipiepy
run: |
python -m pip install pytest
python -m pytest -svv 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, cp313-cp313]
arch: [aarch64]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
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: |
mv Kiwi/models/base/sj.* model/kiwipiepy_model/
mv Kiwi/models/base/extract.mdl model/kiwipiepy_model/
mv Kiwi/models/base/*.dict model/kiwipiepy_model/
mv Kiwi/models/base/combiningRule.txt model/kiwipiepy_model/
mv Kiwi/models/base/skipbigram.mdl model/kiwipiepy_model/
/opt/python/${{ matrix.cp }}/bin/python -m pip install wheel setuptools 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
/opt/python/${{ matrix.cp }}/bin/python -m pip install numpy==`/opt/python/${{ matrix.cp }}/bin/python .github/workflows/numpy_version.py v1` || true
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 -svv test/test_kiwipiepy.py
- name: Archive binary
uses: actions/upload-artifact@v3
with:
name: Linux ${{ matrix.arch }} Binary ${{ matrix.cp }}
path: artifacts/build.tgz
- name: Archive binary
uses: actions/upload-artifact@v3
with:
name: Linux ${{ matrix.arch }} Wheel ${{ matrix.cp }}
path: artifacts/dist/*.whl