Skip to content

Commit d9471fc

Browse files
ci: add workflow to build library in ci
1 parent 9e32ada commit d9471fc

File tree

5 files changed

+110
-0
lines changed

5 files changed

+110
-0
lines changed

.github/workflows/build.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Compile bdk-jvm For All Targets
2+
on: [workflow_dispatch]
3+
4+
permissions: {}
5+
6+
jobs:
7+
build-macOS-native-libs:
8+
name: "Create M1 and x86_64 native binaries"
9+
runs-on: macos-14
10+
steps:
11+
- name: "Checkout publishing branch"
12+
uses: actions/checkout@v4
13+
with:
14+
submodules: recursive
15+
persist-credentials: false
16+
fetch-depth: 0
17+
18+
- name: "Set up JDK"
19+
uses: actions/setup-java@v4
20+
with:
21+
distribution: temurin
22+
java-version: 17
23+
24+
- name: "Build bdk-jvm library"
25+
run: |
26+
bash ./scripts/build-macos-aarch64.sh
27+
bash ./scripts/build-macos-x86_64.sh
28+
29+
- name: "Upload macOS native libraries"
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: artifact-macos
33+
path: /Users/runner/work/bdk-jvm/bdk-jvm/lib/src/main/resources/
34+
35+
build-windows-native-lib:
36+
name: "Create Windows native binaries"
37+
runs-on: windows-2022
38+
steps:
39+
- name: "Checkout publishing branch"
40+
uses: actions/checkout@v4
41+
with:
42+
submodules: recursive
43+
persist-credentials: false
44+
fetch-depth: 0
45+
46+
- name: "Set up JDK"
47+
uses: actions/setup-java@v4
48+
with:
49+
distribution: temurin
50+
java-version: 17
51+
52+
- name: "Build bdk-jvm library"
53+
run: bash ./scripts/build-windows-x86_64.sh
54+
55+
- name: "Upload Windows native libraries"
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: artifact-windows
59+
path: D:\a\bdk-jvm\bdk-jvm\lib\src\main\resources\
60+
61+
build-full-library:
62+
name: Create full bdk-jvm library
63+
needs: [build-macOS-native-libs, build-windows-native-lib]
64+
runs-on: ubuntu-24.04
65+
steps:
66+
- name: "Checkout publishing branch"
67+
uses: actions/checkout@v4
68+
with:
69+
submodules: recursive
70+
persist-credentials: false
71+
fetch-depth: 0
72+
73+
- name: "Set up JDK"
74+
uses: actions/setup-java@v4
75+
with:
76+
distribution: temurin
77+
java-version: 17
78+
79+
- name: "Build bdk-jvm library"
80+
run: bash ./scripts/build-linux-x86_64.sh
81+
82+
- name: "Download macOS native binaries from previous job"
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: artifact-macos
86+
path: ./bdk-jvm/lib/src/main/resources/
87+
88+
- name: "Download Windows native libraries from previous job"
89+
uses: actions/download-artifact@v4
90+
with:
91+
name: artifact-windows
92+
path: ./bdk-jvm/lib/src/main/resources/
93+
94+
- name: "Upload library code and binaries"
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: artifact-full
98+
path: ./bdk-jvm/lib/

scripts/build-linux-x86_64.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ TARGET_DIR="target/x86_64-unknown-linux-gnu/release-smaller"
55
RESOURCE_DIR="resources/linux-x86-64"
66
LIB_NAME="libbdkffi.so"
77

8+
echo "Making sure the submodule is initialized..."
9+
git submodule update --init
10+
811
# Move to the Rust library directory
912
cd ./bdk-ffi/bdk-ffi/ || exit
1013

scripts/build-macos-aarch64.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ TARGET_DIR="target/$COMPILATION_TARGET/release-smaller"
55
RESOURCE_DIR="resources/darwin-aarch64"
66
LIB_NAME="libbdkffi.dylib"
77

8+
echo "Making sure the submodule is initialized..."
9+
git submodule update --init
10+
811
# Move to the Rust library directory
912
cd ./bdk-ffi/bdk-ffi/ || exit
1013

scripts/build-macos-x86_64.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ TARGET_DIR="target/x86_64-apple-darwin/release-smaller"
55
RESOURCE_DIR="resources/darwin-x86-64"
66
LIB_NAME="libbdkffi.dylib"
77

8+
echo "Making sure the submodule is initialized..."
9+
git submodule update --init
10+
811
# Move to the Rust library directory
912
cd ./bdk-ffi/bdk-ffi/ || exit
1013

scripts/build-windows-x86_64.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ TARGET_DIR="target/x86_64-pc-windows-msvc/release-smaller"
55
RESOURCE_DIR="resources/win32-x86-64"
66
LIB_NAME="bdkffi.dll"
77

8+
echo "Making sure the submodule is initialized..."
9+
git submodule update --init
10+
811
# Move to the Rust library directory
912
cd ./bdk-ffi/bdk-ffi/ || exit
1013

0 commit comments

Comments
 (0)