Skip to content

Commit

Permalink
Add Python CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
tnull committed Nov 10, 2023
1 parent 9dbecb4 commit 572f00a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
39 changes: 39 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Continuous Integration Checks - Python

on: [push, pull_request]

jobs:
check-python:
runs-on: ubuntu-latest

env:
LDK_NODE_PYTHON_DIR: bindings/python

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Generate Python bindings
run: ./scripts/uniffi_bindgen_generate_python.sh

- name: Install testing prerequisites
run: |
pip3 install requests
- name: Start bitcoind and electrs
run: docker compose up -d

- name: Run Python unit tests
env:
BITCOIN_CLI_BIN: "docker exec ldk-node-bitcoin-1 bitcoin-cli"
BITCOIND_RPC_USER: "user"
BITCOIND_RPC_PASSWORD: "pass"
ESPLORA_ENDPOINT: "http://127.0.0.1:3002"
run: |
cd $LDK_NODE_PYTHON_DIR
python3 -m unittest discover -s src/ldk_node
10 changes: 9 additions & 1 deletion scripts/uniffi_bindgen_generate_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
BINDINGS_DIR="./bindings/python/src/ldk_node"
UNIFFI_BINDGEN_BIN="cargo run --manifest-path bindings/uniffi-bindgen/Cargo.toml"

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
DYNAMIC_LIB_PATH="./target/release-smaller/libldk_node.so"
else
DYNAMIC_LIB_PATH="./target/release-smaller/libldk_node.dylib"
fi

cargo build --profile release-smaller --features uniffi || exit 1
$UNIFFI_BINDGEN_BIN generate bindings/ldk_node.udl --language python -o "$BINDINGS_DIR" || exit 1
cp ./target/release-smaller/libldk_node.dylib "$BINDINGS_DIR"/libldk_node.dylib || exit 1

mkdir -p $BINDINGS_DIR
cp "$DYNAMIC_LIB_PATH" "$BINDINGS_DIR" || exit 1

0 comments on commit 572f00a

Please sign in to comment.