GH-729: Support Python 3.12 #264
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
on: | |
pull_request: | |
branches: [ main ] | |
types: | |
- labeled | |
- synchronize | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_UNDERTHESEA_CORE_API_TOKEN }} | |
jobs: | |
source_distribute: | |
name: "Source Distribute" | |
if: ${{ github.event.label.name == 'release-pypi-core' }} | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/undertheseanlp/underthesea/build_rust:2.0.0a0 | |
env: | |
HOME: /root | |
PYTHON: python${{ matrix.python-version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Create environment and install package dependencies | |
working-directory: ./extensions/underthesea_core | |
env: | |
LC_ALL: en_US.UTF-8 # Known issue: https://github.com/python-poetry/poetry/issues/221#issuecomment-723652470 | |
run: | | |
cargo --version | |
$PYTHON -m poetry --version | |
$PYTHON -m poetry install | |
$PYTHON -m poetry show | |
- name: Build and publish | |
working-directory: ./extensions/underthesea_core | |
env: | |
MATURIN_PASSWORD: ${{ secrets.PYPI_UNDERTHESEA_CORE_API_TOKEN }} | |
run: | | |
$PYTHON -m poetry run maturin sdist | |
pip install twine | |
twine upload ./target/wheels/* -u __token__ -p "$PYPI_TOKEN" | |
linux: | |
name: "Linux" | |
if: ${{ github.event.label.name == 'release-pypi-core' }} | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/undertheseanlp/underthesea/build_rust:2.0.0a0 | |
env: | |
HOME: /root | |
PYTHON: python${{ matrix.python-version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Create environment and install package dependencies | |
working-directory: ./extensions/underthesea_core | |
env: | |
LC_ALL: en_US.UTF-8 # Known issue: https://github.com/python-poetry/poetry/issues/221#issuecomment-723652470 | |
run: | | |
cargo --version | |
$PYTHON -m poetry --version | |
$PYTHON -m poetry install | |
$PYTHON -m poetry show | |
- name: Build and publish | |
working-directory: ./extensions/underthesea_core | |
env: | |
MATURIN_PASSWORD: ${{ secrets.PYPI_UNDERTHESEA_CORE_API_TOKEN }} | |
run: | | |
$PYTHON -m poetry run maturin build --release --no-sdist --strip --interpreter python${{ matrix.python-version }} | |
find ./target/wheels/ | |
$PYTHON -m poetry run maturin publish --username __token__ --no-sdist --interpreter python${{ matrix.python-version }} | |
windows: | |
name: "Windows" | |
if: ${{ github.event.label.name == 'release-pypi-core' }} | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install latest nightly | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- name: Create environment | |
run: | | |
python -m pip install --upgrade pip | |
mkdir "${HOME}/poetry" | |
curl -sSL https://install.python-poetry.org | python - | |
echo "C:\Users\runneradmin\AppData\Roaming\Python\Scripts\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Install package dependencies | |
working-directory: ./extensions/underthesea_core | |
run: poetry install | |
- name: Build and publish | |
working-directory: ./extensions/underthesea_core | |
env: | |
MATURIN_PASSWORD: ${{ secrets.PYPI_UNDERTHESEA_CORE_API_TOKEN }} | |
run: | | |
poetry run maturin build --release --no-sdist --strip --interpreter python | |
dir target\wheels\ | |
poetry run maturin publish --username __token__ --no-sdist --interpreter python | |
macos-x64: | |
name: "MacOS x64" | |
if: ${{ github.event.label.name == 'release-pypi-core' }} | |
runs-on: macos-13 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install latest nightly | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
override: true | |
- name: Create environment | |
working-directory: ./extensions/underthesea_core | |
run: | | |
python -m pip install --upgrade pip | |
mkdir "${HOME}/poetry" | |
curl -sSL https://install.python-poetry.org | POETRY_HOME=${HOME}/poetry python - | |
echo "${HOME}/poetry/bin" >> $GITHUB_PATH | |
- name: Install package dependencies | |
working-directory: ./extensions/underthesea_core | |
run: poetry install | |
- name: Build and publish | |
working-directory: ./extensions/underthesea_core | |
env: | |
MATURIN_PASSWORD: ${{ secrets.PYPI_UNDERTHESEA_CORE_API_TOKEN }} | |
run: | | |
poetry run maturin build --release --no-sdist --strip --interpreter python${{ matrix.python-version }} | |
find ./target/wheels/ | |
pip install target/wheels/underthesea_core*.whl | |
poetry run maturin publish --username __token__ --no-sdist --interpreter python${{ matrix.python-version }} | |
macos-arm: | |
name: "MacOS ARM" | |
if: ${{ github.event.label.name == 'release-pypi-core' }} | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Create environment and install package dependencies | |
working-directory: ./extensions/underthesea_core | |
run: | | |
mkdir "${PWD}/poetry" | |
curl -sSL https://install.python-poetry.org | POETRY_HOME=${PWD}/poetry python - | |
export PATH="${PWD}/poetry/bin:${PATH}" | |
poetry install | |
- name: Build and publish | |
working-directory: ./extensions/underthesea_core | |
env: | |
PYTHON: /Users/anhv/anaconda3/envs/python${{ matrix.python-version }}/bin/python${{ matrix.python-version }} | |
MATURIN_PASSWORD: ${{ secrets.PYPI_UNDERTHESEA_CORE_API_TOKEN }} | |
run: | | |
export PATH="${PWD}/poetry/bin:${PATH}" | |
$PYTHON --version | |
poetry run maturin build --release --no-sdist --strip --interpreter $PYTHON | |
find ./target/wheels/ | |
poetry run maturin publish --username __token__ --no-sdist --interpreter $PYTHON |