Skip to content

Commit

Permalink
Update publish CI to build uniffi 25 languages separately
Browse files Browse the repository at this point in the history
  • Loading branch information
dangeross committed Mar 6, 2025
1 parent 15968b0 commit 3810bf2
Show file tree
Hide file tree
Showing 13 changed files with 408 additions and 117 deletions.
76 changes: 63 additions & 13 deletions .github/workflows/build-bindings-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,35 @@ on:
required: false
type: boolean
default: false
uniffi-25:
description: 'If true, builds additional bindings for Uniffi 0.25'
required: false
type: boolean
default: false

jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- id: set-matrix
run: |
if [ ${{ inputs.uniffi-25 }} == true ]; then
echo "::set-output name=matrix::['', '-uniffi-25']"
else
echo "::set-output name=matrix::['']"
fi
outputs:
uniffi-matrix: ${{ steps.set-matrix.outputs.matrix }}

build:
if: ${{ !inputs.use-dummy-binaries }}
runs-on: ubuntu-latest
name: build ${{ matrix.target }}
name: build ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy:
matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [
aarch64-linux-android,
x86_64-linux-android,
Expand All @@ -40,6 +61,23 @@ jobs:
ref: ${{ inputs.ref }}
repository: ${{ inputs.repository || github.repository }}

- name: Downgrade Uniffi
if: matrix.uniffi == '-uniffi-25'
working-directory: lib
run: |
sed -i.bak -e 's/^uniffi = .*/uniffi = "0.25.0"/' Cargo.toml
rm Cargo.toml.bak
- name: Downgrade bindings Uniffi
if: matrix.uniffi == '-uniffi-25'
working-directory: lib/bindings
run: |
rm uniffi-bindgen.rs
mv uniffi-25-bindgen.rs uniffi-bindgen.rs
sed -i.bak -e 's/^uniffi_bindgen = .*/uniffi_bindgen = "0.25.2"/' Cargo.toml
sed -i.bak -e 's/^uniffi_bindgen_kotlin_multiplatform = .*/uniffi_bindgen_kotlin_multiplatform = { git = "https:\/\/gitlab.com\/trixnity\/uniffi-kotlin-multiplatform-bindings", rev = "e8e3a88df5b657787c1198425c16008232b26548" }/' Cargo.toml
rm Cargo.toml.bak
- name: Install rust toolchain
run: |
rustup set auto-self-update disable
Expand All @@ -55,6 +93,7 @@ jobs:

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.uniffi }}
workspaces: lib

- name: Build bindings
Expand All @@ -73,36 +112,43 @@ jobs:
- name: Archive release
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.target }}
name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: dist/*

jnilibs:
needs: build
needs:
- setup
- build
runs-on: ubuntu-latest
name: build jniLibs
name: build jniLibs${{ matrix.uniffi }}
strategy:
matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
steps:
- uses: actions/download-artifact@v4
with:
name: bindings-aarch64-linux-android
name: bindings-aarch64-linux-android${{ matrix.uniffi }}
path: arm64-v8a

- uses: actions/download-artifact@v4
with:
name: bindings-x86_64-linux-android
name: bindings-x86_64-linux-android${{ matrix.uniffi }}
path: x86_64

- name: Archive jniLibs
uses: actions/upload-artifact@v4
with:
name: bindings-android-jniLibs
name: bindings-android-jniLibs${{ matrix.uniffi }}
path: ./*

build-dummies:
if: ${{ inputs.use-dummy-binaries }}
runs-on: ubuntu-latest
name: build android dummies
name: build dummies ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy:
matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [
aarch64-linux-android,
x86_64-linux-android,
Expand All @@ -116,26 +162,30 @@ jobs:
- name: Upload dummy Android ${{ matrix.target }} artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.target }}
name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: ./*

jnilibs-dummy:
needs: build-dummies
runs-on: ubuntu-latest
name: build jniLibs dummy
name: build jniLibs dummy ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy:
matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
steps:
- uses: actions/download-artifact@v4
with:
name: bindings-aarch64-linux-android
name: bindings-aarch64-linux-android${{ matrix.uniffi }}
path: arm64-v8a

- uses: actions/download-artifact@v4
with:
name: bindings-x86_64-linux-android
name: bindings-x86_64-linux-android${{ matrix.uniffi }}
path: x86_64

- name: Archive jniLibs
uses: actions/upload-artifact@v4
with:
name: bindings-android-jniLibs
name: bindings-android-jniLibs${{ matrix.uniffi }}
path: ./*
65 changes: 56 additions & 9 deletions .github/workflows/build-bindings-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,35 @@ on:
required: false
type: boolean
default: false
uniffi-25:
description: 'If true, builds additional bindings for Uniffi 0.25'
required: false
type: boolean
default: false

jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- id: set-matrix
run: |
if [ ${{ inputs.uniffi-25 }} == true ]; then
echo "::set-output name=matrix::['', '-uniffi-25']"
else
echo "::set-output name=matrix::['']"
fi
outputs:
uniffi-matrix: ${{ steps.set-matrix.outputs.matrix }}

build:
if: ${{ !inputs.use-dummy-binaries }}
runs-on: macOS-latest
name: build ${{ matrix.target }}
name: build ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy:
matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [
aarch64-apple-darwin,
x86_64-apple-darwin,
Expand All @@ -40,6 +61,23 @@ jobs:
ref: ${{ inputs.ref }}
repository: ${{ inputs.repository || github.repository }}

- name: Downgrade Uniffi
if: matrix.uniffi == '-uniffi-25'
working-directory: lib
run: |
sed -i.bak -e 's/^uniffi = .*/uniffi = "0.25.0"/' Cargo.toml
rm Cargo.toml.bak
- name: Downgrade bindings Uniffi
if: matrix.uniffi == '-uniffi-25'
working-directory: lib/bindings
run: |
rm uniffi-bindgen.rs
mv uniffi-25-bindgen.rs uniffi-bindgen.rs
sed -i.bak -e 's/^uniffi_bindgen = .*/uniffi_bindgen = "0.25.2"/' Cargo.toml
sed -i.bak -e 's/^uniffi_bindgen_kotlin_multiplatform = .*/uniffi_bindgen_kotlin_multiplatform = { git = "https:\/\/gitlab.com\/trixnity\/uniffi-kotlin-multiplatform-bindings", rev = "e8e3a88df5b657787c1198425c16008232b26548" }/' Cargo.toml
rm Cargo.toml.bak
- name: Install rust toolchain
run: |
rustup set auto-self-update disable
Expand All @@ -55,6 +93,7 @@ jobs:

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.uniffi }}
workspaces: lib

- name: Build bindings
Expand All @@ -64,24 +103,29 @@ jobs:
- name: Archive release
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.target }}
name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: |
lib/target/${{ matrix.target }}/release/libbreez_sdk_liquid_bindings.dylib
lib/target/${{ matrix.target }}/release/libbreez_sdk_liquid_bindings.a
merge:
runs-on: macOS-latest
needs: build
name: build darwin-universal
needs:
- setup
- build
name: build darwin-universal${{ matrix.uniffi }}
strategy:
matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
steps:
- uses: actions/download-artifact@v4
with:
name: bindings-aarch64-apple-darwin
name: bindings-aarch64-apple-darwin${{ matrix.uniffi }}
path: aarch64-apple-darwin

- uses: actions/download-artifact@v4
with:
name: bindings-x86_64-apple-darwin
name: bindings-x86_64-apple-darwin${{ matrix.uniffi }}
path: x86_64-apple-darwin

- name: Build Darwin universal
Expand All @@ -93,17 +137,20 @@ jobs:
- name: Archive release
uses: actions/upload-artifact@v4
with:
name: bindings-darwin-universal
name: bindings-darwin-universal${{ matrix.uniffi }}
path: |
darwin-universal/libbreez_sdk_liquid_bindings.dylib
darwin-universal/libbreez_sdk_liquid_bindings.a
build-dummies:
if: ${{ inputs.use-dummy-binaries }}
runs-on: ubuntu-latest
name: build darwin dummies
name: build dummies ${{ matrix.target }}${{ matrix.uniffi }}
needs:
- setup
strategy:
matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [
aarch64-apple-darwin,
x86_64-apple-darwin,
Expand All @@ -118,5 +165,5 @@ jobs:
- name: Upload dummy darwin ${{ matrix.target }} artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.target }}
name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: ./*
49 changes: 45 additions & 4 deletions .github/workflows/build-bindings-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,35 @@ on:
required: false
type: boolean
default: false
uniffi-25:
description: 'If true, builds additional bindings for Uniffi 0.25'
required: false
type: boolean
default: false

jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- id: set-matrix
run: |
if [ ${{ inputs.uniffi-25 }} == true ]; then
echo "::set-output name=matrix::['', '-uniffi-25']"
else
echo "::set-output name=matrix::['']"
fi
outputs:
uniffi-matrix: ${{ steps.set-matrix.outputs.matrix }}

build:
if: ${{ !inputs.use-dummy-binaries }}
runs-on: ubuntu-20.04
name: build ${{ matrix.target }}
name: build ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy:
matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [
aarch64-unknown-linux-gnu,
x86_64-unknown-linux-gnu,
Expand All @@ -40,6 +61,23 @@ jobs:
ref: ${{ inputs.ref }}
repository: ${{ inputs.repository || github.repository }}

- name: Downgrade Uniffi
if: matrix.uniffi == '-uniffi-25'
working-directory: lib
run: |
sed -i.bak -e 's/^uniffi = .*/uniffi = "0.25.0"/' Cargo.toml
rm Cargo.toml.bak
- name: Downgrade bindings Uniffi
if: matrix.uniffi == '-uniffi-25'
working-directory: lib/bindings
run: |
rm uniffi-bindgen.rs
mv uniffi-25-bindgen.rs uniffi-bindgen.rs
sed -i.bak -e 's/^uniffi_bindgen = .*/uniffi_bindgen = "0.25.2"/' Cargo.toml
sed -i.bak -e 's/^uniffi_bindgen_kotlin_multiplatform = .*/uniffi_bindgen_kotlin_multiplatform = { git = "https:\/\/gitlab.com\/trixnity\/uniffi-kotlin-multiplatform-bindings", rev = "e8e3a88df5b657787c1198425c16008232b26548" }/' Cargo.toml
rm Cargo.toml.bak
- name: Install rust toolchain
run: |
rustup set auto-self-update disable
Expand All @@ -66,6 +104,7 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.uniffi }}
workspaces: lib

- name: Build bindings
Expand All @@ -78,15 +117,17 @@ jobs:
- name: Archive release
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.target }}
name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: lib/target/${{ matrix.target }}/release/libbreez_sdk_liquid_bindings.so

build-dummies:
if: ${{ inputs.use-dummy-binaries }}
runs-on: ubuntu-latest
name: build linux dummies
name: build dummies ${{ matrix.target }}${{ matrix.uniffi }}
needs: setup
strategy:
matrix:
uniffi: ${{ fromJson(needs.setup.outputs.uniffi-matrix) }}
target: [
aarch64-unknown-linux-gnu,
x86_64-unknown-linux-gnu,
Expand All @@ -99,5 +140,5 @@ jobs:
- name: Upload dummy linux ${{ matrix.target }} artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.target }}
name: bindings-${{ matrix.target }}${{ matrix.uniffi }}
path: ./*
Loading

0 comments on commit 3810bf2

Please sign in to comment.