Skip to content

Implement Stable ABI & Modernize build system #167

Implement Stable ABI & Modernize build system

Implement Stable ABI & Modernize build system #167

name: Pull Request Test
on:
pull_request:
branches:
- main
jobs:
build_manylinux:
name: Build for manylinux
runs-on: ubuntu-latest
container:
image: docker://quay.io/pypa/manylinux_2_28_x86_64
steps:
- uses: actions/checkout@v4
- name: Build wheel
run: |
/opt/python/cp39-cp39/bin/python -m pip install scikit-build-core numpy
/opt/python/cp39-cp39/bin/python -m pip wheel . -w dist --no-build-isolation
auditwheel repair dist/*.whl -w wheelhouse
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel-manylinux-x86_64
path: wheelhouse/*.whl
test_manylinux:
name: Test manylinux (${{ matrix.cp }})
needs: build_manylinux
runs-on: ubuntu-latest
container:
image: docker://quay.io/pypa/manylinux_2_28_x86_64
strategy:
matrix:
cp: [cp39-cp39, cp310-cp310, cp311-cp311, cp312-cp312]
steps:
- uses: actions/checkout@v4
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: wheel-manylinux-x86_64
path: wheelhouse
- name: Install and test
run: |
/opt/python/${{ matrix.cp }}/bin/python -m pip install wheelhouse/*.whl
/opt/python/${{ matrix.cp }}/bin/python -m pip install pytest nltk
/opt/python/${{ matrix.cp }}/bin/python -m nltk.downloader stopwords
/opt/python/${{ matrix.cp }}/bin/python -m pytest --verbose -s test/unit_test.py
build_linux_arm64:
name: Build for linux arm64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
lfs: true
- uses: bab2min/run-on-arch-action@use-custom-image
id: runcmd
with:
image: quay.io/pypa/manylinux_2_28_aarch64
githubToken: ${{ github.token }}
setup: |
mkdir -p "${PWD}/artifacts"
dockerRunArgs: |
--volume "${PWD}/artifacts:/artifacts"
run: |
/opt/python/cp39-cp39/bin/python -m pip install scikit-build-core numpy
/opt/python/cp39-cp39/bin/python -m pip wheel . -w dist --no-build-isolation
auditwheel repair dist/*.whl -w /artifacts
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel-manylinux-aarch64
path: artifacts/*.whl
build_macos:
name: Build for macOS (${{ matrix.cpu-arch }})
runs-on: macOS-13
strategy:
matrix:
cpu-arch: [x86_64, arm64]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Build wheel
run: |
export MACOSX_DEPLOYMENT_TARGET=10.14
python -m pip install --upgrade pip
python -m pip install scikit-build-core numpy
if [ "${{ matrix.cpu-arch }}" = "arm64" ]; then
export CMAKE_OSX_ARCHITECTURES=arm64
export _PYTHON_HOST_PLATFORM="macosx-11.0-arm64"
export ARCHFLAGS="-arch arm64"
python -m pip wheel . -w dist --no-build-isolation \
-C cmake.define.TARGET_ARCH=arm64 \
-C cmake.define.TOMOTOPY_ISA=arm64 \
-C cmake.define.BUILD_MULTI_ARCH=OFF
else
export AUDITWHEEL_PLAT=many
python -m pip wheel . -w dist --no-build-isolation
fi
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel-macos-${{ matrix.cpu-arch }}
path: dist/*.whl
test_macos:
name: Test macOS (py${{ matrix.python-version }})
needs: build_macos
runs-on: macOS-13
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: wheel-macos-x86_64
path: wheelhouse
- name: Install and test
run: |
python -m pip install wheelhouse/*.whl
python -m pip install pytest nltk
python -m nltk.downloader stopwords
python -m pytest --verbose -s test/unit_test.py
build_windows:
name: Build for Windows (${{ matrix.architecture }})
runs-on: windows-latest
strategy:
matrix:
architecture: [x86, x64]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9 ${{ matrix.architecture }}
uses: actions/setup-python@v5
with:
python-version: "3.9"
architecture: ${{ matrix.architecture }}
- name: Build wheel
run: |
python -m pip install --upgrade pip
python -m pip install scikit-build-core numpy
python -m pip wheel . -w dist --no-build-isolation
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel-windows-${{ matrix.architecture }}
path: dist/*.whl
test_windows:
name: Test Windows (py${{ matrix.python-version }}, ${{ matrix.architecture }})
needs: build_windows
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
architecture: [x86, x64]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} ${{ matrix.architecture }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: wheel-windows-${{ matrix.architecture }}
path: wheelhouse
- name: Install and test
run: |
python -m pip install (Get-ChildItem wheelhouse\*.whl)
python -m pip install pytest nltk
python -m nltk.downloader stopwords
python -m pytest --verbose -s test/unit_test.py