From d9471fc54912377f829a35215d0a550fc1c160e9 Mon Sep 17 00:00:00 2001 From: thunderbiscuit Date: Thu, 31 Jul 2025 10:14:55 -0400 Subject: [PATCH] ci: add workflow to build library in ci --- .github/workflows/build.yml | 98 +++++++++++++++++++++++++++++++++ scripts/build-linux-x86_64.sh | 3 + scripts/build-macos-aarch64.sh | 3 + scripts/build-macos-x86_64.sh | 3 + scripts/build-windows-x86_64.sh | 3 + 5 files changed, 110 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..bbf44cc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,98 @@ +name: Compile bdk-jvm For All Targets +on: [workflow_dispatch] + +permissions: {} + +jobs: + build-macOS-native-libs: + name: "Create M1 and x86_64 native binaries" + runs-on: macos-14 + steps: + - name: "Checkout publishing branch" + uses: actions/checkout@v4 + with: + submodules: recursive + persist-credentials: false + fetch-depth: 0 + + - name: "Set up JDK" + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: "Build bdk-jvm library" + run: | + bash ./scripts/build-macos-aarch64.sh + bash ./scripts/build-macos-x86_64.sh + + - name: "Upload macOS native libraries" + uses: actions/upload-artifact@v4 + with: + name: artifact-macos + path: /Users/runner/work/bdk-jvm/bdk-jvm/lib/src/main/resources/ + + build-windows-native-lib: + name: "Create Windows native binaries" + runs-on: windows-2022 + steps: + - name: "Checkout publishing branch" + uses: actions/checkout@v4 + with: + submodules: recursive + persist-credentials: false + fetch-depth: 0 + + - name: "Set up JDK" + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: "Build bdk-jvm library" + run: bash ./scripts/build-windows-x86_64.sh + + - name: "Upload Windows native libraries" + uses: actions/upload-artifact@v4 + with: + name: artifact-windows + path: D:\a\bdk-jvm\bdk-jvm\lib\src\main\resources\ + + build-full-library: + name: Create full bdk-jvm library + needs: [build-macOS-native-libs, build-windows-native-lib] + runs-on: ubuntu-24.04 + steps: + - name: "Checkout publishing branch" + uses: actions/checkout@v4 + with: + submodules: recursive + persist-credentials: false + fetch-depth: 0 + + - name: "Set up JDK" + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: "Build bdk-jvm library" + run: bash ./scripts/build-linux-x86_64.sh + + - name: "Download macOS native binaries from previous job" + uses: actions/download-artifact@v4 + with: + name: artifact-macos + path: ./bdk-jvm/lib/src/main/resources/ + + - name: "Download Windows native libraries from previous job" + uses: actions/download-artifact@v4 + with: + name: artifact-windows + path: ./bdk-jvm/lib/src/main/resources/ + + - name: "Upload library code and binaries" + uses: actions/upload-artifact@v4 + with: + name: artifact-full + path: ./bdk-jvm/lib/ diff --git a/scripts/build-linux-x86_64.sh b/scripts/build-linux-x86_64.sh index f5fa78e..d239620 100644 --- a/scripts/build-linux-x86_64.sh +++ b/scripts/build-linux-x86_64.sh @@ -5,6 +5,9 @@ TARGET_DIR="target/x86_64-unknown-linux-gnu/release-smaller" RESOURCE_DIR="resources/linux-x86-64" LIB_NAME="libbdkffi.so" +echo "Making sure the submodule is initialized..." +git submodule update --init + # Move to the Rust library directory cd ./bdk-ffi/bdk-ffi/ || exit diff --git a/scripts/build-macos-aarch64.sh b/scripts/build-macos-aarch64.sh index b25ae21..f1b718b 100644 --- a/scripts/build-macos-aarch64.sh +++ b/scripts/build-macos-aarch64.sh @@ -5,6 +5,9 @@ TARGET_DIR="target/$COMPILATION_TARGET/release-smaller" RESOURCE_DIR="resources/darwin-aarch64" LIB_NAME="libbdkffi.dylib" +echo "Making sure the submodule is initialized..." +git submodule update --init + # Move to the Rust library directory cd ./bdk-ffi/bdk-ffi/ || exit diff --git a/scripts/build-macos-x86_64.sh b/scripts/build-macos-x86_64.sh index bb4b77d..04e1743 100644 --- a/scripts/build-macos-x86_64.sh +++ b/scripts/build-macos-x86_64.sh @@ -5,6 +5,9 @@ TARGET_DIR="target/x86_64-apple-darwin/release-smaller" RESOURCE_DIR="resources/darwin-x86-64" LIB_NAME="libbdkffi.dylib" +echo "Making sure the submodule is initialized..." +git submodule update --init + # Move to the Rust library directory cd ./bdk-ffi/bdk-ffi/ || exit diff --git a/scripts/build-windows-x86_64.sh b/scripts/build-windows-x86_64.sh index 37cc573..7e6eb30 100644 --- a/scripts/build-windows-x86_64.sh +++ b/scripts/build-windows-x86_64.sh @@ -5,6 +5,9 @@ TARGET_DIR="target/x86_64-pc-windows-msvc/release-smaller" RESOURCE_DIR="resources/win32-x86-64" LIB_NAME="bdkffi.dll" +echo "Making sure the submodule is initialized..." +git submodule update --init + # Move to the Rust library directory cd ./bdk-ffi/bdk-ffi/ || exit