Skip to content

Build macOS natively, cross-compile other targets. #4

Build macOS natively, cross-compile other targets.

Build macOS natively, cross-compile other targets. #4

name: Cross-compile all targets
on:
push: # TODO: remove after testing, don't run on any push
workflow_dispatch:
env:
RUST_VERSION: 1.78
jobs:
uniffi-bindings:
runs-on: ubuntu-20.04
steps:
- name: Set up Rust
run: |
rustup toolchain install ${{ env.RUST_VERSION }}
rustup default ${{ env.RUST_VERSION }}
- name: Checkout
uses: actions/checkout@v4
- name: Install uniffi-bindgen-go
run: cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0
- name: Generate bindings
run: uniffi-bindgen-go bindings/ldk_node.udl -o ffi/golang -c ./uniffi.toml
- name: Archive bindings
uses: actions/upload-artifact@v4
with:
name: ldk-node-bindings
path: |
ffi/golang/ldk_node/ldk_node.go
ffi/golang/ldk_node/ldk_node.h
ffi/golang/ldk_node/ldk_node.c
build-linux-windows:
runs-on: ubuntu-20.04
steps:
- name: Set up Rust
run: |
rustup toolchain install ${{ env.RUST_VERSION }}
rustup default ${{ env.RUST_VERSION }}
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross --rev c87a52a
- name: Checkout
uses: actions/checkout@v4
- name: Build Linux x86_64
run: cross build --release --target x86_64-unknown-linux-gnu --features uniffi
- name: Build Linux ARM
run: cross build --release --target arm-unknown-linux-gnueabihf --features uniffi
- name: Build Windows x64_64
run: cross build --release --target x86_64-pc-windows-gnu --features uniffi
- name: Archive Linux x86_64
uses: actions/upload-artifact@v4
with:
name: ldk-node-x86_64-unknown-linux-gnu
path: ffi/golang/ldk_node/x86_64-unknown-linux-gnu/libldk_node.so
- name: Archive Linux ARM
uses: actions/upload-artifact@v4
with:
name: ldk-node-arm-unknown-linux-gnueabihf
path: ffi/golang/ldk_node/arm-unknown-linux-gnueabihf/libldk_node.so
- name: Archive Windows x86_64
uses: actions/upload-artifact@v4
with:
name: ldk-node-x86_64-pc-windows-gnu
path: ffi/golang/ldk_node/x86_64-pc-windows-gnu/libldk_node.dll
build-macos:
runs-on: macos-12
steps:
- name: Set up Rust
run: |
rustup toolchain install ${{ env.RUST_VERSION }}
rustup default ${{ env.RUST_VERSION }}
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
- name: Checkout
uses: actions/checkout@v4
- name: Build macOS x86_64
run: cargo build --release --target x86_64-apple-darwin --features uniffi
- name: Build macOS ARM64
run: cargo build --release --target aarch64-apple-darwin --features uniffi
- name: Make universal macOS library
run: |
mkdir -p target/universal-macos/release
lipo -create -output "target/universal-macos/release/libldk_node.dylib" "target/aarch64-apple-darwin/release/libldk_node.dylib" "target/x86_64-apple-darwin/release/libldk_node.dylib"
- name: Archive macOS
uses: actions/upload-artifact@v4
with:
name: ldk-node-universal-macos
path: target/universal-macos/release/libldk_node.dylib