Merge pull request #554 from 27rabbitlt/patch-1 #521
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 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux x86_64 (build wheels) | |
| - os: ubuntu-latest | |
| arch: x86_64 | |
| artifact_name: "linux-x86_64" | |
| python-version: "3.x" | |
| # Linux x86_64 (test numpy 1.26) | |
| - os: ubuntu-latest | |
| arch: x86_64 | |
| artifact_name: "linux-x86_64_numpy1_26" | |
| python-version: "3.12" | |
| numpy-version: "1.26" | |
| # Linux ARM64 (build wheels) | |
| - os: ubuntu-24.04-arm | |
| arch: aarch64 | |
| artifact_name: "linux-aarch64" | |
| python-version: "3.x" | |
| # Windows (build wheels) | |
| - os: windows-latest | |
| arch: x86_64 | |
| artifact_name: "windows-x86_64" | |
| python-version: "3.x" | |
| # Windows ARM64 (build wheels) | |
| - os: windows-11-arm | |
| arch: aarch64 | |
| artifact_name: "windows-arm64" | |
| python-version: "3.x" | |
| # macOS (build wheels) | |
| - os: macos-latest | |
| arch: x86_64 | |
| artifact_name: "macos-universal2" | |
| python-version: "3.x" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-python@v3 | |
| name: Install Python | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Run tests with specific numpy version | |
| - name: Install and test with specific numpy version | |
| if: matrix.numpy-version | |
| run: | | |
| pip install "numpy==${{ matrix.numpy-version }}.*" | |
| pip install -e . | |
| pip install pytest | |
| python -m pytest | |
| # Build wheels only if: | |
| # - No numpy version is specified | |
| # - Python version is "3.x" | |
| - name: Build wheels | |
| if: ${{ !matrix.numpy-version }} | |
| uses: pypa/cibuildwheel@v3.1.3 | |
| - name: Make sdist | |
| if: ${{ matrix.os == 'windows-latest' && !matrix.numpy-version }} | |
| run: | | |
| python -m pip install build | |
| python -m build --sdist --outdir wheelhouse . | |
| - uses: actions/upload-artifact@v4 | |
| if: ${{ !matrix.numpy-version }} | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: ./wheelhouse/* | |
| - name: Upload to GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') && !matrix.numpy-version | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: wheelhouse/* |