-
Notifications
You must be signed in to change notification settings - Fork 42
95 lines (85 loc) · 3.29 KB
/
publish.yml
File metadata and controls
95 lines (85 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# 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