Build wheels #49
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 wheels | |
| on: | |
| # Manual run | |
| workflow_dispatch: | |
| inputs: | |
| publish_to_pypi: | |
| description: "whether to upload source code and wheels to pypi" | |
| default: "no" | |
| required: true | |
| type: choice | |
| options: | |
| - "yes" | |
| - "no" | |
| jobs: | |
| # Build wheels on Linux, Windows and macOS for Python 3.6+ | |
| build_wheels: | |
| name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| # Ensure that a wheel builder finishes even if another fails | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Windows 64 bit | |
| - os: windows-latest | |
| python: 36 | |
| bitness: 64 | |
| platform_id: win_amd64 | |
| - os: windows-latest | |
| python: 37 | |
| bitness: 64 | |
| platform_id: win_amd64 | |
| - os: windows-latest | |
| python: 38 | |
| bitness: 64 | |
| platform_id: win_amd64 | |
| - os: windows-latest | |
| python: 39 | |
| bitness: 64 | |
| platform_id: win_amd64 | |
| - os: windows-latest | |
| python: 310 | |
| bitness: 64 | |
| platform_id: win_amd64 | |
| - os: windows-latest | |
| python: 311 | |
| bitness: 64 | |
| platform_id: win_amd64 | |
| # Linux 64 bit manylinux2014 | |
| - os: ubuntu-22.04 | |
| python: 36 | |
| bitness: 64 | |
| platform_id: manylinux_x86_64 | |
| manylinux_image: manylinux2014 | |
| - os: ubuntu-22.04 | |
| python: 37 | |
| bitness: 64 | |
| platform_id: manylinux_x86_64 | |
| manylinux_image: manylinux2014 | |
| - os: ubuntu-22.04 | |
| python: 38 | |
| bitness: 64 | |
| platform_id: manylinux_x86_64 | |
| manylinux_image: manylinux2014 | |
| - os: ubuntu-22.04 | |
| python: 39 | |
| bitness: 64 | |
| platform_id: manylinux_x86_64 | |
| manylinux_image: manylinux2014 | |
| - os: ubuntu-22.04 | |
| python: 310 | |
| bitness: 64 | |
| platform_id: manylinux_x86_64 | |
| manylinux_image: manylinux2014 | |
| - os: ubuntu-22.04 | |
| python: 311 | |
| bitness: 64 | |
| platform_id: manylinux_x86_64 | |
| manylinux_image: manylinux2014 | |
| # MacOS x86_64 | |
| - os: macos-latest | |
| bitness: 64 | |
| python: 36 | |
| platform_id: macosx_x86_64 | |
| - os: macos-latest | |
| bitness: 64 | |
| python: 37 | |
| platform_id: macosx_x86_64 | |
| - os: macos-latest | |
| bitness: 64 | |
| python: 38 | |
| platform_id: macosx_x86_64 | |
| - os: macos-latest | |
| bitness: 64 | |
| python: 39 | |
| platform_id: macosx_x86_64 | |
| - os: macos-latest | |
| bitness: 64 | |
| python: 310 | |
| platform_id: macosx_x86_64 | |
| - os: macos-latest | |
| bitness: 64 | |
| python: 311 | |
| platform_id: macosx_x86_64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.8' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install cibuildwheel==2.16.2 | |
| - name: Build wheels | |
| env: | |
| CIBW_BEFORE_BUILD: python -m pip install numpy>=1.19.5 cython>=0.29.0 scipy>=1.7.0 | |
| CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} | |
| CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }} | |
| CIBW_BUILD_VERBOSITY: 1 | |
| run: cibuildwheel --output-dir wheelhouse | |
| - name: Store artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-cp${{ matrix.python }}-${{ matrix.platform_id }} | |
| path: wheelhouse/*.whl | |
| merge_wheels: | |
| needs: build_wheels | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Merge All Wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: wheels | |
| pattern: wheels-cp* | |
| merge-multiple: true | |
| - run: ls -R wheels | |
| # Build the source distribution under Linux | |
| build_sdist: | |
| name: Source distribution | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.8' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: python -m pip install twine build | |
| - name: Build source distribution | |
| run: | | |
| python -m build --sdist | |
| twine check dist/*.tar.gz | |
| - name: Store artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: source | |
| path: dist/*.tar.gz | |
| upload_pypi: | |
| name: Publish a Python distribution to PyPI | |
| needs: [build_wheels, build_sdist] | |
| runs-on: ubuntu-20.04 | |
| if: ${{ github.event.inputs.publish_to_pypi == 'yes' }} | |
| steps: | |
| - uses: actions/download-artifact@v2 | |
| with: | |
| name: artifact | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@v1.4.2 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_TOKEN }} |