bump to cibuildwheel 3.1.0 #27
This file contains hidden or 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: Publish sdist and wheels | |
on: | |
schedule: | |
# ┌───────────── minute (0 - 59) | |
# │ ┌───────────── hour (0 - 23) | |
# │ │ ┌───────────── day of the month (1 - 31) | |
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | |
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | |
# │ │ │ │ │ | |
- cron: "42 2 * * SUN,WED" | |
pull_request: | |
branches: | |
- main | |
- maintenance/** | |
push: | |
branches: | |
- main # FOR TESTING | |
tags: | |
- v* | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
jobs: | |
build_wheels: | |
name: Build wheel ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }} | |
runs-on: ${{ matrix.buildplat[0] }} | |
strategy: | |
# Ensure that a wheel builder finishes even if another fails | |
fail-fast: false | |
matrix: | |
# Github Actions doesn't support pairing matrix values together, let's improvise | |
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026 | |
buildplat: | |
- [ubuntu-22.04, manylinux_x86_64, ""] | |
- [ubuntu-22.04, musllinux_x86_64, ""] | |
- [ubuntu-22.04-arm, manylinux_aarch64, ""] | |
- [ubuntu-22.04-arm, musllinux_aarch64, ""] | |
- [macos-13, macosx_x86_64, openblas] | |
# targeting macos >= 14. Could probably build on macos-14, but it would be a cross-compile | |
- [macos-13, macosx_x86_64, accelerate] | |
- [macos-14, macosx_arm64, openblas] | |
- [macos-14, macosx_arm64, accelerate] | |
- [windows-2022, win_amd64, ""] | |
- [windows-2022, win32, ""] | |
- [windows-11-arm, win_arm64, ""] | |
#python: ["cp311", "cp312", "cp313", "cp313t", "cp314", "cp314t", "pp311"] | |
python: ["cp311"] | |
exclude: | |
# Don't build PyPy 32-bit windows | |
- buildplat: [windows-2022, win32, ""] | |
python: "pp311" | |
# Don't build PyPy arm64 windows | |
- buildplat: [windows-11-arm, win_arm64, ""] | |
python: "pp311" | |
# No PyPy on musllinux images | |
- buildplat: [ ubuntu-22.04, musllinux_x86_64, "" ] | |
python: "pp311" | |
- buildplat: [ ubuntu-22.04-arm, musllinux_aarch64, "" ] | |
python: "pp311" | |
- buildplat: [ macos13, macosx_x86_64, openblas ] | |
python: "cp313t" | |
- buildplat: [ macos13, macosx_x86_64, openblas ] | |
python: "cp314t" | |
env: | |
IS_32_BIT: ${{ matrix.buildplat[1] == 'win32' }} | |
steps: | |
- name: Checkout numpy-release | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Checkout numpy | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
repository: numpy/numpy | |
path: numpy-src | |
submodules: true | |
persist-credentials: false | |
- name: Setup MSVC (32-bit) | |
if: ${{ matrix.buildplat[1] == 'win32' }} | |
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1 | |
with: | |
architecture: 'x86' | |
- name: Setup LLVM for Windows ARM64 | |
if: ${{ matrix.buildplat[1] == 'win_arm64' }} | |
uses: ./.github/windows_arm64_steps | |
- name: pkg-config-for-win | |
if: runner.os == 'windows' | |
run: | | |
choco install -y --no-progress --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite | |
$CIBW = "${{ github.workspace }}/.openblas" | |
# pkgconfig needs a complete path, and not just "./openblas since the | |
# build is run in a tmp dir (?) | |
# It seems somewhere in the env passing, `\` is not | |
# passed through, so convert it to '/' | |
$CIBW = $CIBW.replace("\","/") | |
echo "CIBW_ENVIRONMENT_WINDOWS=PKG_CONFIG_PATH=$CIBW" >> $env:GITHUB_ENV | |
- name: Setup macOS | |
if: matrix.buildplat[0] == 'macos-13' || matrix.buildplat[0] == 'macos-14' | |
run: | | |
# Needed due to https://github.com/actions/runner-images/issues/3371 | |
# Supported versions: https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md | |
echo "FC=gfortran-13" >> "$GITHUB_ENV" | |
echo "F77=gfortran-13" >> "$GITHUB_ENV" | |
echo "F90=gfortran-13" >> "$GITHUB_ENV" | |
if [[ ${{ matrix.buildplat[2] }} == 'accelerate' ]]; then | |
# Builds with Accelerate only target macOS>=14.0 | |
echo "CIBW_ENVIRONMENT_MACOS=MACOSX_DEPLOYMENT_TARGET=14.0 INSTALL_OPENBLAS=false" >> "$GITHUB_ENV" | |
# the macos-13 image that's used for building the x86_64 wheel can't test | |
# a wheel with deployment target >= 14 without further work | |
echo "CIBW_TEST_SKIP=*-macosx_x86_64" >> "$GITHUB_ENV" | |
else | |
echo "CIBW_ENVIRONMENT_MACOS=PKG_CONFIG_PATH=$PWD/.openblas" >> "$GITHUB_ENV" | |
fi | |
# Used to run cibuildwheel | |
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
with: | |
python-version: "3.13" | |
- name: Build wheel | |
env: | |
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }} | |
run: | | |
python -m pip install cibuildwheel==3.1.0 | |
python -m cibuildwheel numpy-src --config-file cibuildwheel.toml --output-dir ./wheelhouse | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout numpy | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
repository: numpy/numpy | |
submodules: true | |
persist-credentials: false | |
- name: Build sdist | |
run: | | |
python -m pip install -U pip build | |
python -m build --sdist -Csetup-args=-Dallow-noblas=true | |
- name: Test the sdist | |
run: | | |
python -m pip install dist/*.gz -Csetup-args=-Dallow-noblas=true | |
pip install -r requirements/test_requirements.txt | |
cd .. # Can't import numpy within numpy src directory | |
python -c "import numpy, sys; print(numpy.__version__); sys.exit(numpy.test() is False)" | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: sdist | |
path: ./dist/* | |
testpypi-publish: | |
name: Upload release to TestPyPI | |
if: # TODO - add a release True/False? and on `main`? | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/numpy | |
permissions: | |
id-token: write | |
steps: | |
# TODO: retrieve your distributions here | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 | |
with: | |
print-hash: true | |
pypi-publish: | |
name: Upload release to PyPI | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/numpy | |
permissions: | |
id-token: write | |
steps: | |
# TODO: retrieve your distributions here | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 | |
with: | |
print-hash: true |