Move to nanobind #86
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
| # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries | |
| # https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml | |
| name: Build and upload to PyPI | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| release: | |
| types: [published] | |
| jobs: | |
| build_wheels: | |
| name: Build wheels for ${{ matrix.os }} | |
| runs-on: ${{ matrix.runs-on }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: linux-intel | |
| runs-on: ubuntu-latest | |
| cibw_image: "ghcr.io/scverse/rapids_singlecell:manylinux_2_28_x86_64_cuda12.9" | |
| dockerfile: "docker/manylinux_2_28_x86_64_cuda12.9.Dockerfile" | |
| - os: linux-arm | |
| runs-on: ubuntu-24.04-arm | |
| cibw_image: "ghcr.io/scverse/rapids_singlecell:manylinux_2_28_aarch64_cuda12.9" | |
| dockerfile: "docker/manylinux_2_28_aarch64_cuda12.9.Dockerfile" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Build CUDA manylinux image | |
| run: | | |
| docker build -t "${{ matrix.cibw_image }}" -f "${{ matrix.dockerfile }}" docker | |
| # cibuildwheel action (Linux-only wheels inside our custom manylinux+CUDA images) | |
| - name: Build wheels (CUDA 12.9) | |
| uses: pypa/cibuildwheel@v3.1.4 | |
| env: | |
| # Skip musllinux | |
| CIBW_SKIP: '*-musllinux*' | |
| # Point cibuildwheel to our CUDA manylinux images (per-arch) | |
| CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.os == 'linux-intel' && matrix.cibw_image || '' }} | |
| CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.os == 'linux-arm' && matrix.cibw_image || '' }} | |
| # Make CUDA visible inside the build container | |
| CIBW_ENVIRONMENT: > | |
| CUDA_PATH=/usr/local/cuda | |
| LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH | |
| PATH=/usr/local/cuda/bin:$PATH | |
| # Tooling to build a nanobind/scikit-build-core extension | |
| CIBW_BEFORE_BUILD: > | |
| python -m pip install -U pip | |
| scikit-build-core cmake ninja nanobind | |
| # No runtime tests (CI has no GPU) | |
| CIBW_TEST_SKIP: "*" | |
| CIBW_TEST_COMMAND: "" | |
| # Bundle redistributable CUDA libs & ensure manylinux compliance | |
| CIBW_REPAIR_WHEEL_COMMAND: "auditwheel repair -w {dest_dir} {wheel}" | |
| # Be somewhat chatty to see compile/link flags | |
| CIBW_BUILD_VERBOSITY: "1" | |
| - uses: actions/upload-artifact@v4 | |
| 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@v5 | |
| - name: Build sdist | |
| run: pipx run build --sdist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cibw-sdist | |
| path: dist/*.tar.gz | |
| upload_pypi: | |
| needs: [build_wheels, build_sdist] | |
| runs-on: ubuntu-latest | |
| environment: publish | |
| permissions: | |
| id-token: write | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| steps: | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| # unpacks all CIBW artifacts into dist/ | |
| pattern: cibw-* | |
| path: dist | |
| merge-multiple: true | |
| - uses: pypa/gh-action-pypi-publish@release/v1 |