-
Notifications
You must be signed in to change notification settings - Fork 10
83 lines (71 loc) · 2.43 KB
/
Copy pathbuildwheels.yml
File metadata and controls
83 lines (71 loc) · 2.43 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
name: Build and upload wheels
on:
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
workflow_dispatch: # Allows manual triggering
# The Python project lives in the python_bindings/ subdirectory and reaches the
# C++ sources through a `fastpfor` symlink to the repository root. That symlink
# is fine for local builds but does not survive being copied into cibuildwheel's
# build containers (and is not preserved on Windows checkouts). To stay portable
# we build a self-contained sdist first (it bundles the real header/source
# files) and build every wheel from that extracted sdist.
jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Build sdist
run: uv build --sdist
working-directory: python_bindings
- uses: actions/upload-artifact@v4
with:
name: sdist-artifact
path: python_bindings/dist/*.tar.gz
if-no-files-found: error
build_wheels:
name: Build wheels on ${{ matrix.os }}
needs: build_sdist
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Native runners for each architecture we publish: x86_64 Linux,
# aarch64 Linux, x86_64 macOS, Apple Silicon macOS, and x86_64 Windows.
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-latest, windows-latest]
steps:
- uses: actions/download-artifact@v4
with:
name: sdist-artifact
path: dist
- name: Unpack sdist
shell: bash
run: |
mkdir -p sdist_src
tar -xzf dist/*.tar.gz -C sdist_src --strip-components=1
- name: Build wheels
uses: pypa/cibuildwheel@v3.3.1
with:
package-dir: sdist_src
- uses: actions/upload-artifact@v4
with:
name: wheel-artifact-${{ matrix.os }}
path: ./wheelhouse/*.whl
if-no-files-found: error
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# Only upload to PyPI when triggered by a tag (not manual workflow_dispatch).
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@v1.13.0
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}