Build Python Windows wheels #234
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: Build Python Windows wheels | |
on: | |
push: | |
branches: | |
- master | |
create: | |
jobs: | |
build_windows: | |
runs-on: windows-latest | |
strategy: | |
max-parallel: 5 | |
matrix: | |
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] | |
include: | |
- python-version: '3.7' | |
py-short: '37' | |
py-short2: '37m' | |
- python-version: '3.8' | |
py-short: '38' | |
py-short2: '38' | |
- python-version: '3.9' | |
py-short: '39' | |
py-short2: '39' | |
- python-version: '3.10' | |
py-short: '310' | |
py-short2: '310' | |
- python-version: '3.11' | |
py-short: 311 | |
py-short2: 311 | |
- python-version: '3.12' | |
py-short: 312 | |
py-short2: 312 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache mecab | |
id: cache-mecab | |
uses: actions/cache@v1 | |
with: | |
path: C:/mecab | |
key: mecab-win-build | |
- name: Download MeCab Win and Unzip it | |
if: steps.cache-mecab.outputs.cache-hit != 'true' | |
shell: bash | |
run: | | |
curl -LO "https://github.com/chezou/mecab/releases/download/mecab-0.996-msvc-5/mecab-msvc-x64.zip" | |
unzip -o "mecab-msvc-x64.zip" -d c:/mecab | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade setuptools wheel pip setuptools-scm | |
pip install -r requirements.txt | |
- name: Build wheel | |
run: | | |
python setup.py bdist_wheel | |
- name: Upload Wheel | |
uses: actions/upload-artifact@v1 | |
with: | |
name: win-wheels | |
path: dist | |
- name: Check wheels | |
shell: bash | |
run: | | |
ls -la | |
VERSION=$(python setup.py --version) | |
pip install "dist/fugashi-${VERSION}-cp${{ matrix.py-short }}-cp${{ matrix.py-short2 }}-win_amd64.whl" | |
- name: Publish to PyPI if tagged | |
if: startsWith(github.ref, 'refs/tags') | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
shell: bash | |
run: | | |
pip install twine | |
twine upload dist/fugashi* | |