Skip to content

Commit

Permalink
ci: adj. python scripts and actions
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
  • Loading branch information
yukibtc committed Sep 19, 2024
1 parent ddd3d1d commit 79ecb35
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 23 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/publish-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ jobs:
container:
image: quay.io/pypa/manylinux_2_28_x86_64
env:
PLAT: manylinux_2_28_x86_64
PYBIN: "/opt/python/${{ matrix.python }}/bin"
steps:
- name: "Checkout"
uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
# Needed because inside container
- name: "Setup Rust"
uses: actions-rs/toolchain@v1
with:
toolchain: stable

Expand All @@ -44,7 +45,7 @@ jobs:

- uses: actions/upload-artifact@v3
with:
name: nostr_sdk-manylinux_2_28_x86_64-${{ matrix.python }}
name: nostr_protocol-manylinux_2_28_x86_64-${{ matrix.python }}
path: /home/runner/work/nostr/nostr/bindings/nostr-ffi/bindings-python/dist/*.whl

build-linux-aarch64:
Expand All @@ -60,10 +61,6 @@ jobs:
- name: "Checkout"
uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: "Setup Python"
uses: actions/setup-python@v4
with:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/publish-sdk-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ jobs:
container:
image: quay.io/pypa/manylinux_2_28_x86_64
env:
PLAT: manylinux_2_28_x86_64
PYBIN: "/opt/python/${{ matrix.python }}/bin"
steps:
- name: "Checkout"
uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
# Needed because inside container
- name: "Setup Rust"
uses: actions-rs/toolchain@v1
with:
toolchain: stable

Expand Down Expand Up @@ -60,10 +61,6 @@ jobs:
- name: "Checkout"
uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: "Setup Python"
uses: actions/setup-python@v4
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ set -euo pipefail
${PYBIN}/python --version
${PYBIN}/pip install -r requirements.txt

cd ../

echo "Generating native binaries..."
cargo build --release
rustup target add x86_64-unknown-linux-gnu
cargo build --release --target x86_64-unknown-linux-gnu

echo "Generating nostr.py..."
cargo run -p uniffi-bindgen generate --library ../../target/release/libnostr_ffi.so --language python --no-format -o bindings-python/src/nostr/
cargo run -p uniffi-bindgen generate --library ../../target/x86_64-unknown-linux-gnu/release/libnostr_ffi.so --language python --no-format -o bindings-python/src/nostr/

echo "Copying linux libnostr_ffi.so..."
cp ../../target/release/libnostr_ffi.so bindings-python/src/nostr/
cp ../../target/x86_64-unknown-linux-gnu/release/libnostr_ffi.so bindings-python/src/nostr/

echo "All done!"
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ ${PYBIN}/python --version
${PYBIN}/pip install -r requirements.txt

echo "Generating native binaries..."
cargo build --release
rustup target add x86_64-unknown-linux-gnu
cargo build --release --target x86_64-unknown-linux-gnu

echo "Generating nostr_sdk.py..."
cd ../
cargo run -p uniffi-bindgen generate --library ../../target/release/libnostr_sdk_ffi.so --language python --no-format -o bindings-python/src/nostr-sdk/
cargo run -p uniffi-bindgen generate --library ../../target/x86_64-unknown-linux-gnu/release/libnostr_sdk_ffi.so --language python --no-format -o bindings-python/src/nostr-sdk/

echo "Copying linux libnostr_sdk_ffi.so..."
cp ../../target/release/libnostr_sdk_ffi.so bindings-python/src/nostr-sdk/
cp ../../target/x86_64-unknown-linux-gnu/release/libnostr_sdk_ffi.so bindings-python/src/nostr-sdk/

echo "All done!"
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ pip install --user -r requirements.txt

echo "Generating native binaries..."
rustup target add x86_64-pc-windows-msvc
# TODO: enable all features
cargo build --release --target x86_64-pc-windows-msvc --features lmdb
cargo build --release --target x86_64-pc-windows-msvc

echo "Generating nostr_sdk.py..."
cd ../
Expand Down

0 comments on commit 79ecb35

Please sign in to comment.