Skip to content

Commit 00e3277

Browse files
authored
Release (#4)
1 parent 017c40a commit 00e3277

26 files changed

+3256
-1012
lines changed

.github/workflows/_benchmark.yml

Lines changed: 0 additions & 133 deletions
This file was deleted.

.github/workflows/_build_linux.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: Build Linux Wheels
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python-versions:
7+
description: 'Python versions to build for'
8+
required: false
9+
type: string
10+
default: '["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]'
11+
12+
jobs:
13+
build-linux:
14+
name: Build Linux Wheels
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: recursive
21+
22+
# Setup Go for BoringSSL build
23+
- name: Setup Go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version: '1.21'
27+
cache: true
28+
29+
# Cache vendor dependencies to speed up builds
30+
- name: Restore vendor cache
31+
id: cache-vendor
32+
uses: actions/cache/restore@v4
33+
with:
34+
path: vendor
35+
key: vendor-linux-manylinux-${{ hashFiles('scripts/linux/setup_vendors.sh') }}-v11
36+
restore-keys: |
37+
vendor-linux-manylinux-${{ hashFiles('scripts/linux/setup_vendors.sh') }}-v11
38+
39+
# Build wheels with cibuildwheel (handles manylinux containers)
40+
# The vendor directory is mounted into the container and shared across Python versions
41+
# The setup script will skip rebuilding if libraries already exist
42+
- name: Build wheels
43+
uses: pypa/cibuildwheel@v2.22.0
44+
env:
45+
# Build for specified Python versions
46+
CIBW_BUILD: cp38-manylinux_x86_64 cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64 cp314-manylinux_x86_64
47+
# Vendor build happens inside manylinux container via before-build (from pyproject.toml)
48+
# The script will detect cached libraries and skip rebuilding
49+
50+
# Save vendor cache after build
51+
- name: Save vendor cache
52+
if: steps.cache-vendor.outputs.cache-hit != 'true'
53+
uses: actions/cache/save@v4
54+
with:
55+
path: vendor
56+
key: vendor-linux-manylinux-${{ hashFiles('scripts/linux/setup_vendors.sh') }}-v11
57+
58+
# Setup Python versions for testing
59+
- name: Setup Python versions
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: |
63+
3.8
64+
3.9
65+
3.10
66+
3.11
67+
3.12
68+
3.13
69+
3.14
70+
allow-prereleases: true
71+
72+
# Test the built wheels
73+
- name: Test wheels
74+
run: |
75+
# Test each wheel that was built
76+
for wheel in ./wheelhouse/*.whl; do
77+
echo "========================================"
78+
echo "Testing wheel: $(basename "$wheel")"
79+
echo "========================================"
80+
81+
# Extract Python version from wheel filename (e.g., cp39, cp310)
82+
python_tag=$(basename "$wheel" | grep -oE 'cp[0-9]+' | head -1)
83+
python_version="${python_tag:2:1}.${python_tag:3}"
84+
85+
echo "Setting up Python $python_version..."
86+
87+
# Try to find the matching Python version
88+
python_cmd=""
89+
for cmd in "python${python_version}" "python3.${python_version#*.}" "python3"; do
90+
if command -v "$cmd" &> /dev/null; then
91+
# Verify this is the right version
92+
version_check=$($cmd --version 2>&1 | grep -oE '[0-9]+\.[0-9]+' | head -1)
93+
if [ "$version_check" = "$python_version" ]; then
94+
python_cmd="$cmd"
95+
break
96+
fi
97+
fi
98+
done
99+
100+
# Fall back to python3 if we couldn't find exact match
101+
if [ -z "$python_cmd" ]; then
102+
echo "WARNING: Python $python_version not found, using python3"
103+
python_cmd="python3"
104+
fi
105+
106+
echo "Using Python: $($python_cmd --version)"
107+
108+
# Install the wheel in a fresh environment
109+
"$python_cmd" -m pip install --force-reinstall "$wheel"
110+
111+
# Run the test script
112+
echo ""
113+
echo "Running tests..."
114+
"$python_cmd" scripts/test_local_build.py
115+
116+
# Check exit code
117+
if [ $? -eq 0 ]; then
118+
echo ""
119+
echo "[OK] Wheel test PASSED: $(basename "$wheel")"
120+
else
121+
echo ""
122+
echo "[FAIL] Wheel test FAILED: $(basename "$wheel")"
123+
exit 1
124+
fi
125+
126+
echo ""
127+
done
128+
129+
echo "========================================"
130+
echo "All wheel tests PASSED"
131+
echo "========================================"
132+
133+
# Upload wheels as artifacts
134+
- uses: actions/upload-artifact@v4
135+
with:
136+
name: wheels-linux
137+
path: ./wheelhouse/*.whl
138+
if-no-files-found: error

0 commit comments

Comments
 (0)