Skip to content

Commit 208d9fe

Browse files
committed
Use CI to build Python wheels on different platforms
1 parent 78dd547 commit 208d9fe

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build Python Wheels
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_wheels:
7+
name: Build wheels on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-20.04, windows-2019, macos-11]
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Generate Python bindings
17+
run: bash ./scripts/uniffi_bindgen_generate_python.sh
18+
19+
- name: Build wheels
20+
uses: pypa/[email protected]
21+
env:
22+
CIBW_ARCHS_MACOS: "x86_64 arm64 universal2"
23+
CIBW_ARCHS_LINUX: "auto aarch64"
24+
CIBW_BUILD_VERBOSITY: 1
25+
with:
26+
package-dir: ./bindings/python
27+
28+
- uses: actions/upload-artifact@v3
29+
with:
30+
path: ./wheelhouse/*.whl

bindings/python/setup.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ where = src
1111
ldk_node =
1212
*.so
1313
*.dylib
14+
*.dll

scripts/uniffi_bindgen_generate_python.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ UNIFFI_BINDGEN_BIN="cargo run --manifest-path bindings/uniffi-bindgen/Cargo.toml
44

55
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
66
DYNAMIC_LIB_PATH="./target/release-smaller/libldk_node.so"
7-
else
7+
elif [[ "$OSTYPE" == "darwin"* ]]; then
88
DYNAMIC_LIB_PATH="./target/release-smaller/libldk_node.dylib"
9+
elif [[ "$OSTYPE" == "msys"* ]]; then
10+
DYNAMIC_LIB_PATH="./target/release-smaller/libldk_node.dll"
11+
else
12+
echo "Unsupported platform!: $OSTYPE"
13+
exit -1
914
fi
1015

1116
cargo build --profile release-smaller --features uniffi || exit 1

0 commit comments

Comments
 (0)