fix: numpy 2.0 compatibility #68
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 | ||
on: [push, pull_request] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.10', '3.11', '3.12'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -U -r requirements_dev.txt | ||
pip install tox tox-gh-actions | ||
- name: Test with tox numpy>=2 | ||
run: tox -e latestnpy | ||
- name: Install numpy < 2 | ||
run: | | ||
pip uninstall -y numpy | ||
pip install oldest-supported-numpy | ||
- name: Test with tox numpy<2 | ||
run: tox -e oldestnpy | ||
build_wheels: | ||
name: Build wheel for cp${{ matrix.python }}-${{ matrix.arch }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
# Ensure that a wheel builder finishes even if another fails | ||
fail-fast: false | ||
matrix: | ||
os: [windows-latest, ubuntu-latest, macos-latest] | ||
python: [38, 39, 310, 311, 312] | ||
arch: [auto64] | ||
build: ["cp"] | ||
include: | ||
# Run 32 and 64 bit version in parallel for Linux and Windows | ||
- os: ubuntu-latest | ||
arch: auto32 | ||
build: cp | ||
python: 38 | ||
- os: ubuntu-latest | ||
arch: auto32 | ||
build: cp | ||
python: 39 | ||
- os: ubuntu-latest | ||
arch: auto32 | ||
build: cp | ||
python: 310 | ||
- os: ubuntu-latest | ||
arch: auto32 | ||
build: cp | ||
python: 311 | ||
- os: ubuntu-latest | ||
arch: auto32 | ||
build: cp | ||
python: 312 | ||
- os: windows-latest | ||
arch: auto32 | ||
build: cp | ||
python: 38 | ||
- os: windows-latest | ||
arch: auto32 | ||
build: cp | ||
python: 39 | ||
- os: windows-latest | ||
arch: auto32 | ||
build: cp | ||
python: 310 | ||
- os: windows-latest | ||
arch: auto32 | ||
build: cp | ||
python: 311 | ||
- os: windows-latest | ||
arch: auto32 | ||
build: cp | ||
python: 312 | ||
- os: macos-latest | ||
arch: universal2 | ||
build: cp | ||
python: 38 | ||
- os: macos-latest | ||
arch: universal2 | ||
build: cp | ||
python: 39 | ||
- os: macos-latest | ||
arch: universal2 | ||
build: cp | ||
python: 310 | ||
- os: macos-latest | ||
arch: universal2 | ||
build: cp | ||
python: 311 | ||
- os: macos-latest | ||
arch: universal2 | ||
build: cp | ||
python: 312 | ||
steps: | ||
- name: Checkout mt2 | ||
uses: actions/checkout@v4 | ||
# Used to host cibuildwheel | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
- uses: pypa/[email protected] | ||
env: | ||
CIBW_BUILD: "${{ matrix.build }}${{ matrix.python }}-*" | ||
CIBW_ARCHS: ${{ matrix.arch }} | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
name: Install Python | ||
with: | ||
python-version: "3.12" | ||
- name: Install numpy (imported by setup.py) | ||
run: python -m pip install numpy | ||
- name: Build sdist | ||
run: python setup.py sdist | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: dist/*.tar.gz | ||
upload_pypi: | ||
needs: [build_wheels, build_sdist, test] | ||
runs-on: ubuntu-latest | ||
# upload to PyPI on every tag starting with 'v' | ||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | ||
# alternatively, to publish when a GitHub Release is created, use the following rule: | ||
# if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: artifact | ||
path: dist | ||
- uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
# To test: repository_url: https://test.pypi.org/legacy/ |