Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion .github/workflows/wheel_publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
name: Build,download and publish wheels
on: workflow_dispatch
on:
workflow_dispatch:
inputs:
artifact_run_id:
description: Successful wheel run to publish without rebuilding (leave empty to build)
required: false
type: string
jobs:
build_sdist:
name: Build source distribution
if: inputs.artifact_run_id == ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -19,6 +26,7 @@ jobs:

build_wheels:
name: Build wheels on ${{ matrix.os }}
if: inputs.artifact_run_id == ''
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -67,17 +75,34 @@ jobs:

upload_pypi:
needs: [build_wheels, build_sdist]
if: >-
always() &&
((github.ref == 'refs/heads/pybind11' && needs.build_wheels.result == 'success' && needs.build_sdist.result == 'success') || inputs.artifact_run_id != '')
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
actions: read
steps:
- name: Verify the reused wheel run succeeded
if: inputs.artifact_run_id != ''
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RUN_ID: ${{ inputs.artifact_run_id }}
run: |
[[ "$RUN_ID" =~ ^[0-9]+$ ]] || exit 1
gh api "repos/$GH_REPO/actions/runs/$RUN_ID" \
--jq '.status == "completed" and .conclusion == "success" and .path == ".github/workflows/wheel_publish.yml"' | grep -qx true

- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
run-id: ${{ inputs.artifact_run_id || github.run_id }}
github-token: ${{ github.token }}

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@v1.12.4
Expand Down
13 changes: 11 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,19 @@ exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"]
# test-command = "pytest"

build = ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*", "cp313-*", "cp314-*", "cp315-*"]
# PyTorch and the scientific dependencies require 64-bit Python wheels.
archs = "auto64"
test-command = "python {project}/scripts/wheel_smoke.py"

# Skip building free-threaded compatible wheels on Windows
skip = "*t-win*"
# Legacy musllinux targets lack wheels for the required scientific dependencies.
skip = "*t-win* cp3{8,9,10,11,12,13}-musllinux_*"

[tool.cibuildwheel.linux]
environment = { PIP_EXTRA_INDEX_URL = "https://download.pytorch.org/whl/cpu" }

[[tool.cibuildwheel.overrides]]
select = "cp3{9,10,11,12,13}-manylinux_*"
manylinux-x86_64-image = "manylinux_2_28"



Expand Down
Loading