Skip to content

Commit 775f72e

Browse files
author
arman-bd
committed
build test
1 parent 2261357 commit 775f72e

5 files changed

Lines changed: 160 additions & 6 deletions

File tree

.github/workflows/_build_linux.yml

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,78 @@ jobs:
2727
cache: true
2828

2929
# Cache vendor dependencies to speed up builds
30+
# Note: For Linux, vendors are built inside manylinux container, so we cache the vendor directory
3031
- name: Restore vendor cache
3132
id: cache-vendor
3233
uses: actions/cache/restore@v4
3334
with:
3435
path: vendor
35-
key: vendor-linux-${{ hashFiles('scripts/linux/setup_vendors.sh') }}-v9
36+
key: vendor-linux-manylinux-${{ hashFiles('scripts/linux/setup_vendors.sh') }}-v9
3637
restore-keys: |
37-
vendor-linux-
38+
vendor-linux-manylinux-
3839
3940
# Build wheels with cibuildwheel (handles manylinux containers)
40-
# Vendor dependencies are built inside the manylinux container
41+
# The vendor directory is mounted into the container automatically
4142
- name: Build wheels
4243
uses: pypa/cibuildwheel@v2.22.0
4344
env:
4445
# Build for specified Python versions
4546
CIBW_BUILD: cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64
46-
# Vendor build happens inside manylinux container via before-build
47+
# Vendor build happens inside manylinux container via before-build (from pyproject.toml)
4748

4849
# Save vendor cache after build
4950
- name: Save vendor cache
5051
if: steps.cache-vendor.outputs.cache-hit != 'true'
5152
uses: actions/cache/save@v4
5253
with:
5354
path: vendor
54-
key: vendor-linux-${{ hashFiles('scripts/linux/setup_vendors.sh') }}-v9
55+
key: vendor-linux-manylinux-${{ hashFiles('scripts/linux/setup_vendors.sh') }}-v9
56+
57+
# Test the built wheels
58+
- name: Test wheels
59+
run: |
60+
# Test each wheel that was built
61+
for wheel in ./wheelhouse/*.whl; do
62+
echo "========================================"
63+
echo "Testing wheel: $(basename "$wheel")"
64+
echo "========================================"
65+
66+
# Extract Python version from wheel filename (e.g., cp39, cp310)
67+
python_tag=$(basename "$wheel" | grep -oP 'cp\d+' | head -1)
68+
python_version="${python_tag:2:1}.${python_tag:3}"
69+
70+
echo "Setting up Python $python_version..."
71+
72+
# Use the appropriate Python version
73+
python_cmd="python${python_version}"
74+
if ! command -v "$python_cmd" &> /dev/null; then
75+
python_cmd="python3"
76+
fi
77+
78+
# Install the wheel in a fresh environment
79+
"$python_cmd" -m pip install --force-reinstall "$wheel"
80+
81+
# Run the test script
82+
echo ""
83+
echo "Running tests..."
84+
"$python_cmd" scripts/test_local_build.py
85+
86+
# Check exit code
87+
if [ $? -eq 0 ]; then
88+
echo ""
89+
echo "[OK] Wheel test PASSED: $(basename "$wheel")"
90+
else
91+
echo ""
92+
echo "[FAIL] Wheel test FAILED: $(basename "$wheel")"
93+
exit 1
94+
fi
95+
96+
echo ""
97+
done
98+
99+
echo "========================================"
100+
echo "All wheel tests PASSED"
101+
echo "========================================"
55102
56103
# Upload wheels as artifacts
57104
- uses: actions/upload-artifact@v4

.github/workflows/_build_macos.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,52 @@ jobs:
9090
# Use delocate to bundle dependencies
9191
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel} --ignore-missing-dependencies"
9292

93+
# Test the built wheels
94+
- name: Test wheels
95+
run: |
96+
# Test each wheel that was built
97+
for wheel in ./wheelhouse/*.whl; do
98+
echo "========================================"
99+
echo "Testing wheel: $(basename "$wheel")"
100+
echo "========================================"
101+
102+
# Extract Python version from wheel filename (e.g., cp39, cp310)
103+
python_tag=$(basename "$wheel" | grep -oE 'cp[0-9]+' | head -1)
104+
python_version="${python_tag:2:1}.${python_tag:3}"
105+
106+
echo "Setting up Python $python_version..."
107+
108+
# Use the appropriate Python version
109+
python_cmd="python${python_version}"
110+
if ! command -v "$python_cmd" &> /dev/null; then
111+
python_cmd="python3"
112+
fi
113+
114+
# Install the wheel in a fresh environment
115+
"$python_cmd" -m pip install --force-reinstall "$wheel"
116+
117+
# Run the test script
118+
echo ""
119+
echo "Running tests..."
120+
"$python_cmd" scripts/test_local_build.py
121+
122+
# Check exit code
123+
if [ $? -eq 0 ]; then
124+
echo ""
125+
echo "[OK] Wheel test PASSED: $(basename "$wheel")"
126+
else
127+
echo ""
128+
echo "[FAIL] Wheel test FAILED: $(basename "$wheel")"
129+
exit 1
130+
fi
131+
132+
echo ""
133+
done
134+
135+
echo "========================================"
136+
echo "All wheel tests PASSED"
137+
echo "========================================"
138+
93139
# Upload wheels as artifacts
94140
- uses: actions/upload-artifact@v4
95141
with:

.github/workflows/_build_windows.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,47 @@ jobs:
9898
# Build for specified Python versions
9999
CIBW_BUILD: cp39-win_amd64 cp310-win_amd64 cp311-win_amd64 cp312-win_amd64
100100

101+
# Test the built wheels
102+
- name: Test wheels
103+
run: |
104+
# Test each wheel that was built
105+
for wheel in ./wheelhouse/*.whl; do
106+
echo "========================================"
107+
echo "Testing wheel: $(basename "$wheel")"
108+
echo "========================================"
109+
110+
# Extract Python version from wheel filename (e.g., cp39, cp310)
111+
python_tag=$(basename "$wheel" | grep -oP 'cp\d+' | head -1)
112+
python_version="${python_tag:2:1}.${python_tag:3}"
113+
114+
echo "Setting up Python $python_version..."
115+
116+
# Install the wheel in a fresh environment
117+
python -m pip install --force-reinstall "$wheel"
118+
119+
# Run the test script
120+
echo ""
121+
echo "Running tests..."
122+
python scripts/test_local_build.py
123+
124+
# Check exit code
125+
if [ $? -eq 0 ]; then
126+
echo ""
127+
echo "[OK] Wheel test PASSED: $(basename "$wheel")"
128+
else
129+
echo ""
130+
echo "[FAIL] Wheel test FAILED: $(basename "$wheel")"
131+
exit 1
132+
fi
133+
134+
echo ""
135+
done
136+
137+
echo "========================================"
138+
echo "All wheel tests PASSED"
139+
echo "========================================"
140+
shell: bash
141+
101142
# Upload wheels as artifacts
102143
- uses: actions/upload-artifact@v4
103144
with:

scripts/linux/setup.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def check_io_uring_support():
2525

2626

2727
def get_library_paths():
28-
"""Get Linux-specific library paths for BoringSSL and nghttp2."""
28+
"""Get Linux-specific library paths for BoringSSL, nghttp2, and liburing."""
2929
# Always use vendor-built BoringSSL for wheel compatibility
3030
vendor_dir = Path("vendor").resolve()
3131

@@ -82,11 +82,23 @@ def get_library_paths():
8282
nghttp2_lib = alt_path
8383
break
8484

85+
# liburing - use vendor build if io_uring is supported
86+
liburing_include = None
87+
liburing_lib = None
88+
if check_io_uring_support():
89+
vendor_liburing = vendor_dir / "liburing" / "install"
90+
if vendor_liburing.exists() and (vendor_liburing / "include").exists():
91+
liburing_include = str(vendor_liburing / "include")
92+
liburing_lib = str(vendor_liburing / "lib")
93+
print(f"Using vendor liburing from: {vendor_liburing}")
94+
8595
return {
8696
"openssl_include": boringssl_include,
8797
"openssl_lib": boringssl_lib,
8898
"nghttp2_include": nghttp2_include,
8999
"nghttp2_lib": nghttp2_lib,
100+
"liburing_include": liburing_include,
101+
"liburing_lib": liburing_lib,
90102
}
91103

92104

setup.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
print(f" BoringSSL lib: {LIB_PATHS['openssl_lib']}")
6060
print(f" nghttp2 include: {LIB_PATHS['nghttp2_include']}")
6161
print(f" nghttp2 lib: {LIB_PATHS['nghttp2_lib']}")
62+
if LIB_PATHS.get("liburing_include"):
63+
print(f" liburing include: {LIB_PATHS['liburing_include']}")
64+
print(f" liburing lib: {LIB_PATHS['liburing_lib']}")
6265
print()
6366

6467
# Build include and library directory lists
@@ -78,6 +81,11 @@
7881

7982
LIBRARY_DIRS = BORINGSSL_LIB_DIRS + [LIB_PATHS["nghttp2_lib"]]
8083

84+
# Add liburing paths on Linux if available
85+
if IS_LINUX and LIB_PATHS.get("liburing_include"):
86+
INCLUDE_DIRS.append(LIB_PATHS["liburing_include"])
87+
LIBRARY_DIRS.append(LIB_PATHS["liburing_lib"])
88+
8189
# Add zlib paths on Windows if available
8290
if IS_WINDOWS and LIB_PATHS.get("zlib_include"):
8391
zlib_inc = LIB_PATHS["zlib_include"]

0 commit comments

Comments
 (0)