Fix issue176 #207
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | | |
/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 | |
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..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 | |
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] | |
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` 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 | |
- name: Archive binary | |
uses: actions/upload-artifact@v2 | |
with: | |
name: macOS Binary ${{ matrix.python-version }} | |
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 |