Build Python Windows wheels #267
Workflow file for this run
This file contains hidden or 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.9', '3.10', '3.11', '3.12', '3.13'] | |
include: | |
- 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 | |
- python-version: '3.13' | |
py-short: 313 | |
py-short2: 313 | |
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@v4 | |
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 pip setuptools | |
pip install build delvewheel setuptools-scm | |
- name: Build wheel | |
run: | | |
python -m build --wheel | |
env: | |
FUGASHI_NO_BUNDLE_DLL: 1 | |
- name: Repair wheel | |
run: | | |
python -m delvewheel repair --add-path=C:/mecab ./dist/fugashi-*.whl | |
- name: Upload Wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: win-wheels-${{ matrix.python-version }} | |
path: wheelhouse | |
- name: Check wheels | |
shell: bash | |
run: | | |
ls -la | |
VERSION=$(python -m setuptools_scm) | |
pip install "wheelhouse/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: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
shell: bash | |
run: | | |
pip install twine | |
twine upload wheelhouse/fugashi* | |