drop py3.8 and add py3.13 support #40
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: Python Packages Test | |
on: | |
push: | |
branches: [ pre/v* ] | |
jobs: | |
build-sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade setuptools setuptools-rust build | |
- name: Make .devXX version | |
run: python ./python/latest_dev_version.py | |
- name: Build sdist | |
working-directory: ./python | |
run: bash build-sdist.sh | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-sdist | |
path: python/dist/* | |
build-linux-wheels: | |
name: Build Linux Python Wheels (+PGO) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download dictionary | |
run: bash fetch_dictionary.sh "20220519" "core" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Make .devXX version | |
run: python ./python/latest_dev_version.py | |
- uses: eiennohito/gha-manylinux-build@master | |
with: | |
script: python/build-wheels-manylinux-pgo.sh | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-manylinux | |
path: python/dist/*manylinux* | |
build-non-linux-wheels: | |
name: Build wheels on ${{ matrix.os }} / ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, macOS-latest] | |
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Make .devXX version | |
run: python ./python/latest_dev_version.py | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
python -m pip install -U setuptools setuptools_rust build | |
- name: Add aarch64/x86 target for Rust | |
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin | |
if: startsWith(matrix.os, 'macOS') | |
- name: Build wheel | |
working-directory: ./python | |
run: python -m build --wheel | |
env: | |
ARCHFLAGS: -arch x86_64 -arch arm64 | |
MACOSX_DEPLOYMENT_TARGET: 10.12 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-${{ matrix.os }}-${{ matrix.python-version }} | |
path: python/dist/*.whl | |
upload-to-testpypi: # run only if all have succeeded | |
needs: [ build-sdist, build-non-linux-wheels, build-linux-wheels ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: artifact-* | |
path: dist/ | |
merge-multiple: true | |
- name: List files to upload | |
run: ls -R dist/ | |
- name: Publish distribution to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: ${{ secrets.PYPI_TEST_USERNAME }} | |
password: ${{ secrets.PYPI_TEST_PASSWORD }} | |
repository_url: https://test.pypi.org/legacy/ | |
verbose: true | |
install-and-test: | |
needs: [ upload-to-testpypi ] | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macOS-latest ] | |
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip | |
- name: Show compatible tags | |
run: python -m pip debug --verbose | |
- name: Install our module from TestPyPi | |
run: python -m pip -vvvv install --pre -U -i https://test.pypi.org/simple/ SudachiPy | |
- name: Install dependencies | |
run: python -m pip install sudachidict_core tokenizers | |
- name: Run test | |
working-directory: ./python | |
run: python -m unittest | |
- name: Check that binary works (C mode) | |
run: | | |
sudachipy .github/data/input.txt -o result-c.txt | |
git diff --color=always --no-index -- result-c.txt .github/data/expected-c.txt | |
- name: Check that binary works (A mode) | |
run: | | |
sudachipy .github/data/input.txt -m A -o result-a.txt | |
git diff --color=always --no-index -- result-a.txt .github/data/expected-a.txt |