Skip to content

Specify NumPy 2.1 as a build dependency under Python 3.13. #282

Specify NumPy 2.1 as a build dependency under Python 3.13.

Specify NumPy 2.1 as a build dependency under Python 3.13. #282

Workflow file for this run

name: Build
on:
workflow_dispatch: {} # allows triggering this workflow manually
push:
branches: # trigger on commits to main branch
- main
pull_request: # trigger on pull requests affecting relevant files
branches:
- main
paths:
- '**workflows/wheels.yml'
- 'pyproject.toml'
release: # trigger on published release
types:
- published
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-12, windows-2019]
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
submodules: true
# Used to host cibuildwheel
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "3.9"
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: all
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.20.0
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
# TODO(jakevdp): re-add 313t & free-threading support
CIBW_ARCHS_LINUX: auto aarch64
CIBW_ARCHS_MACOS: universal2
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* cp313-* # cp313t-*
# CIBW_FREE_THREADED_SUPPORT: True
CIBW_PRERELEASE_PYTHONS: True
CIBW_SKIP: "*musllinux* *i686* *win32* *t-win*"
CIBW_TEST_REQUIRES: absl-py pytest pytest-xdist
CIBW_TEST_COMMAND: pytest -n auto {project}
CIBW_BUILD_VERBOSITY: 1
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
submodules: true
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: cibw-sdist
path: dist/*.tar.gz
download_and_list_artifacts:
# Helps debug issues like https://github.com/jax-ml/ml_dtypes/issues/196
name: Download and list artifacts
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- name: List files
run: ls -l dist/
upload_pypi:
name: Release & Upload to PyPI
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
# Only publish release to PyPI when a github release is created.
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- name: List files
run: ls -l dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@897895f1e160c830e369f9779632ebc134688e1b # v1.10.2