-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (74 loc) · 2.71 KB
/
Copy pathbuild_python_wheels.yml
File metadata and controls
89 lines (74 loc) · 2.71 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
name: Build Python wheels
on:
workflow_dispatch:
push:
tags:
- "v*"
pull_request:
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} (${{ matrix.cibw_archs }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cibw_archs: x86_64
- os: ubuntu-24.04-arm
cibw_archs: aarch64
- os: macos-14
cibw_archs: arm64
- os: macos-15-intel
cibw_archs: x86_64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build wheels
env:
CIBW_ARCHS: ${{ matrix.cibw_archs }}
run: python -m cibuildwheel python --output-dir wheelhouse
- name: Check bundled native library in wheels
shell: python
run: |
from pathlib import Path
import re
import zipfile
wheels = sorted(Path("wheelhouse").glob("*.whl"))
assert wheels, "No wheels built"
expected_by_platform = {
"linux": "tsedge/native/libtsedge.so",
"macosx": "tsedge/native/libtsedge.dylib",
}
for wheel in wheels:
print(f"Checking {wheel}")
name = wheel.name
assert "-py3-none-" in name, f"Wheel must use py3-none platform tag: {name}"
assert "-py3-none-any.whl" not in name, f"Wheel must not be universal: {name}"
assert not re.search(r"-cp\d+-cp\d+-", name), f"Wheel must not use CPython ABI tags: {name}"
expected = None
for platform_key, native_name in expected_by_platform.items():
if platform_key in name:
expected = native_name
break
assert expected is not None, f"Could not infer expected native library for {name}"
with zipfile.ZipFile(wheel) as zf:
names = zf.namelist()
bundled = [entry for entry in names if "tsedge/native/" in entry]
for entry in bundled:
print(" ", entry)
assert any(entry.endswith(expected) for entry in names), (
f"Missing bundled native library {expected} in {name}"
)
print("All wheels contain bundled native libraries")
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.cibw_archs }}
path: wheelhouse/*.whl