diff --git a/.github/workflows/publish-jvm.yaml b/.github/workflows/publish-jvm.yaml new file mode 100644 index 0000000..7d1c269 --- /dev/null +++ b/.github/workflows/publish-jvm.yaml @@ -0,0 +1,102 @@ +name: Publish bdk-jvm to Maven Central +on: [workflow_dispatch] +#on: +# release: +# types: [published] + +jobs: + build-jvm-macOS-M1-native-lib: + name: Create M1 and x86_64 JVM native binaries + runs-on: macos-12 + steps: + - name: Checkout publishing branch + uses: actions/checkout@v2 + + - name: Update bdk-ffi git submodule + run: | + git submodule set-url bdk-ffi https://github.com/bitcoindevkit/bdk-ffi.git + git submodule update --init bdk-ffi + + - name: Cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + ./bdk-ffi/target + key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + distribution: temurin + java-version: 11 + + - name: Install aarch64 Rust target + run: rustup target add aarch64-apple-darwin + + - name: Build bdk-jvm library + run: ./gradlew :jvm:buildJvmLib + + # build aarch64 + x86_64 native libraries and upload + - 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 + path: /Users/runner/work/bdk-kotlin/bdk-kotlin/jvm/src/main/resources/ + + build-jvm-full-library: + name: Create full bdk-jvm library + needs: [build-jvm-macOS-M1-native-lib] + runs-on: ubuntu-22.04 + steps: + - name: Checkout publishing branch + uses: actions/checkout@v2 + + - name: Update bdk-ffi git submodule + run: | + git submodule set-url bdk-ffi https://github.com/bitcoindevkit/bdk-ffi.git + git submodule update --init bdk-ffi + + - name: Cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + ./bdk-ffi/target + key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + distribution: temurin + java-version: 11 + + - name: Build bdk-jvm library + run: ./gradlew :jvm:buildJvmLib + + - name: Download macOS 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 + path: ./jvm/src/main/resources/ + + - name: Upload everything in jvm/src/ + uses: actions/upload-artifact@v3 + with: + name: final-src-directory + path: /home/runner/work/bdk-kotlin/bdk-kotlin/jvm/ + + - name: Publish to MavenLocal + run: ./gradlew :jvm:publishToMavenLocal --exclude-task signMavenPublication + + # Copy/paste this artifact in your local Maven repository at ~/.m2/repository/ + - name: Upload library from MavenLocal + uses: actions/upload-artifact@v3 + with: + name: mavenlocal-bdk-jvm-artifact + path: ~/.m2/repository/ diff --git a/.github/workflows/test.yaml b/.github/workflows/test-android.yaml similarity index 90% rename from .github/workflows/test.yaml rename to .github/workflows/test-android.yaml index 0e214b9..833b014 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test-android.yaml @@ -1,5 +1,4 @@ -name: Tests - +name: Test Android on: [push, pull_request] env: @@ -49,9 +48,3 @@ jobs: - name: Run Android tests run: ./gradlew :android:test --console=rich - - - name: Build bdk-jvm library - run: ./gradlew :jvm:buildJvmLib - - - name: Run JVM tests - run: ./gradlew :jvm:test --console=rich diff --git a/.github/workflows/test-jvm.yaml b/.github/workflows/test-jvm.yaml new file mode 100644 index 0000000..821cb59 --- /dev/null +++ b/.github/workflows/test-jvm.yaml @@ -0,0 +1,35 @@ +name: Test JVM +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - name: Check out PR branch + uses: actions/checkout@v2 + + - name: Update bdk-ffi git submodule + run: | + git submodule set-url bdk-ffi https://github.com/bitcoindevkit/bdk-ffi.git + git submodule update --init bdk-ffi + + - name: cache + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + bdk-ffi/target + key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + distribution: temurin + java-version: 11 + + - name: Build bdk-jvm library + run: ./gradlew :jvm:buildJvmLib + + - name: Run JVM tests + run: ./gradlew :jvm:test --console=rich