Skip to content

Commit

Permalink
Add Windows target to Kotlin/JVM published library
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Jul 4, 2023
1 parent ea0256f commit 12f8d55
Showing 1 changed file with 55 additions and 24 deletions.
79 changes: 55 additions & 24 deletions .github/workflows/publish-jvm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: Publish bdk-jvm to Maven Central
on: [workflow_dispatch]

jobs:
build-jvm-macOS-M1-native-lib:
build-macOS-native-libs:
name: "Create M1 and x86_64 JVM native binaries"
runs-on: macos-12
steps:
- name: "Checkout publishing branch"
uses: actions/checkout@v2

- name: Cache
- name: "Cache"
uses: actions/cache@v3
with:
path: |
Expand All @@ -18,7 +18,7 @@ jobs:
./target
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}

- name: Set up JDK
- name: "Set up JDK"
uses: actions/setup-java@v2
with:
distribution: temurin
Expand All @@ -27,36 +27,59 @@ jobs:
- name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0

- name: Install aarch64 Rust target
- name: "Install aarch64 Rust target"
run: rustup target add aarch64-apple-darwin

- name: Build bdk-jvm library
- name: "Build bdk-jvm library"
run: |
cd bdk-jvm
./gradlew buildJvmLib
# build aarch64 + x86_64 native libraries and upload
- name: Upload macOS native libraries for reuse in publishing job
- name: "Upload macOS native libraries for reuse in publishing job"
uses: actions/upload-artifact@v3
with:
# name: no name is required because we upload the entire directory
# the default name "artifact" will be used
name: artifact-macos
path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-jvm/lib/src/main/resources/

build-jvm-full-library:
name: Create full bdk-jvm library
needs: [build-jvm-macOS-M1-native-lib]
runs-on: ubuntu-20.04
build-windows-native-lib:
name: "Create Windows-compatible JVM native binaries"
runs-on: windows-2022
steps:
- name: Checkout publishing branch
- name: "Checkout publishing branch"
uses: actions/checkout@v2

- name: Update bdk-ffi git submodule
- name: "Set up JDK"
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 11

- name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0

- name: "Install x86_64-pc-windows-msvc Rust target"
run: rustup target add x86_64-pc-windows-msvc

- name: "Build bdk-jvm library"
run: |
git submodule set-url bdk-ffi https://github.com/bitcoindevkit/bdk-ffi.git
git submodule update --init bdk-ffi
cd bdk-jvm
./gradlew buildJvmLib
- name: Cache
- name: "Upload Windows native libraries for reuse in publishing job"
uses: actions/upload-artifact@v3
with:
name: artifact-windows
path: D:\a\bdk-ffi\bdk-ffi\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-20.04
steps:
- name: "Checkout publishing branch"
uses: actions/checkout@v2

- name: "Cache"
uses: actions/cache@v3
with:
path: |
Expand All @@ -65,7 +88,7 @@ jobs:
./target
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}

- name: Set up JDK
- name: "Set up JDK"
uses: actions/setup-java@v2
with:
distribution: temurin
Expand All @@ -74,20 +97,28 @@ jobs:
- name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0

- name: Build bdk-jvm library
- name: "Build bdk-jvm library"
run: |
cd bdk-jvm
./gradlew buildJvmLib
- name: Download macOS native libraries from previous job
- name: "Download macOS native libraries from previous job"
uses: actions/download-artifact@v3
id: download
with:
# Download the macOS artifacts created in the prior job
name: artifact-macos
path: ./bdk-jvm/lib/src/main/resources/

- name: "Download Windows native libraries from previous job"
uses: actions/download-artifact@v3
id: download
with:
# download the artifact created in the prior job (named "artifact")
name: artifact
# Download the Windows artifacts created in the prior job
name: artifact-windows
path: ./bdk-jvm/lib/src/main/resources/

- name: Publish to Maven Central
- name: "Publish to Maven Central"
env:
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.PGP_KEY_ID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET_KEY }}
Expand Down

0 comments on commit 12f8d55

Please sign in to comment.