Force use of numpy 1.26 #479
Workflow file for this run
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: Build | |
| on: [push, pull_request] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build_wheels: | |
| name: Build and test on ${{ matrix.os }}${{ matrix.numpy-version && format(' (numpy {0})', matrix.numpy-version) || '' }} for ${{ matrix.arch }} | |
| runs-on: ${{ matrix.runs-on || matrix.os }} | |
| permissions: | |
| contents: write | |
| env: | |
| CIBW_ARCHS_LINUX: ${{ matrix.arch }} | |
| CIBW_ARCHS_MACOS: "x86_64 arm64" | |
| CIBW_ENABLE: cpython-freethreading | |
| # Ensure cibuildwheel uses correct NumPy in isolated builds too | |
| CIBW_BEFORE_BUILD: | | |
| pip install --upgrade pip | |
| if [ -n "${{ matrix.numpy-version }}" ]; then | |
| pip install --force-reinstall "numpy==${{ matrix.numpy-version }}.*" | |
| else | |
| pip install --upgrade numpy | |
| fi | |
| python -c "import numpy; print('Using NumPy', numpy.__version__)" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux x86_64 builds (latest NumPy) | |
| - os: ubuntu-latest | |
| arch: x86_64 | |
| artifact_name: "linux-x86_64" | |
| # Linux x86_64 with NumPy 1.26 | |
| - os: ubuntu-latest | |
| arch: x86_64 | |
| artifact_name: "linux-x86_64_numpy1_26" | |
| numpy-version: "1.26" | |
| # Linux ARM64 builds (native runners) | |
| - os: ubuntu-24.04-arm | |
| arch: aarch64 | |
| artifact_name: "linux-aarch64" | |
| # Windows builds | |
| - os: windows-latest | |
| arch: x86_64 | |
| artifact_name: "windows-x86_64" | |
| # macOS builds (universal2) | |
| - os: macos-latest | |
| arch: x86_64 | |
| artifact_name: "macos-universal2" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: false | |
| - name: Install specific NumPy version | |
| if: matrix.numpy-version | |
| run: | | |
| pip install --upgrade pip | |
| pip install --force-reinstall "numpy==${{ matrix.numpy-version }}.*" | |
| python -c "import numpy; print('Installed NumPy version:', numpy.__version__)" | |
| shell: bash | |
| - name: Ensure latest NumPy if not pinned | |
| if: ${{ !matrix.numpy-version }} | |
| run: | | |
| pip install --upgrade pip | |
| pip install --upgrade numpy | |
| python -c "import numpy; print('Using latest NumPy:', numpy.__version__)" | |
| shell: bash | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v3.1.3 | |
| - name: Make sdist | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| run: | | |
| python -m pip install build | |
| python -m build --sdist --outdir wheelhouse . | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: ./wheelhouse/* | |
| - name: Upload to GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: wheelhouse/* |