Skip to content

Commit 025254a

Browse files
committed
Add Python CI job
1 parent 9dbecb4 commit 025254a

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

.github/workflows/python.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Continuous Integration Checks - Python
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
check-python:
7+
runs-on: ubuntu-latest
8+
9+
env:
10+
LDK_NODE_PYTHON_DIR: bindings/python
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.10'
20+
21+
- name: Generate Python bindings
22+
run: ./scripts/uniffi_bindgen_generate_python.sh
23+
24+
- name: Install testing prerequisites
25+
run: |
26+
pip3 install requests
27+
28+
- name: Start bitcoind and electrs
29+
run: docker compose up -d
30+
31+
- name: Run Python unit tests
32+
env:
33+
BITCOIN_CLI_BIN: "docker exec ldk-node-bitcoin-1 bitcoin-cli"
34+
BITCOIND_RPC_USER: "user"
35+
BITCOIND_RPC_PASSWORD: "pass"
36+
ESPLORA_ENDPOINT: "http://127.0.0.1:3002"
37+
run: |
38+
cd $LDK_NODE_PYTHON_DIR
39+
python3 -m unittest discover -s src/ldk_node

scripts/uniffi_bindgen_generate_python.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
BINDINGS_DIR="./bindings/python/src/ldk_node"
33
UNIFFI_BINDGEN_BIN="cargo run --manifest-path bindings/uniffi-bindgen/Cargo.toml"
44

5+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
6+
DYNAMIC_LIB_PATH="./target/release-smaller/libldk_node.so"
7+
else
8+
DYNAMIC_LIB_PATH="./target/release-smaller/libldk_node.dylib"
9+
fi
10+
511
cargo build --profile release-smaller --features uniffi || exit 1
612
$UNIFFI_BINDGEN_BIN generate bindings/ldk_node.udl --language python -o "$BINDINGS_DIR" || exit 1
7-
cp ./target/release-smaller/libldk_node.dylib "$BINDINGS_DIR"/libldk_node.dylib || exit 1
13+
14+
mkdir -p $BINDINGS_DIR
15+
cp "$DYNAMIC_LIB_PATH" "$BINDINGS_DIR" || exit 1

0 commit comments

Comments
 (0)