Build Python Windows wheels #101
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: Build Python Windows wheels | |
on: [push] | |
jobs: | |
build: | |
runs-on: windows-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"] | |
include: | |
- 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@v3 | |
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 | |
- 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 | |
ls -la dist | |
VERSION=$(python setup.py --version) | |
pip install "dist/mecab_python3-${VERSION}-cp${{ matrix.py-short }}-cp${{ matrix.py-short2 }}-win_amd64.whl" | |
- name: Publish to PyPI if tagged | |
if: startsWith(github.ref, 'refs/tags') && github.repository_owner == 'polm' | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
python --version | |
pip --version | |
python -m pip install --upgrade pip | |
pip install twine setuptools-scm | |
twine upload dist/mecab*whl | |