-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make c# publish depend on platform build
- Loading branch information
Showing
4 changed files
with
63 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,81 @@ | ||
name: Publish C# Bindings | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'breez-sdk repo release (MAJOR.MINOR.PATCH)' | ||
required: true | ||
type: string | ||
cs-project-ref: | ||
description: 'commit/tag to use for the csharp project. Can be different from `version`' | ||
required: true | ||
type: string | ||
push: | ||
branches: | ||
- "build-artifacts-in-ci" | ||
|
||
jobs: | ||
build-tag-release: | ||
name: Build, tag, and release the Breez SDK C# bindings | ||
runs-on: macOS-latest | ||
build-all-platforms: | ||
name: Build all platforms | ||
uses: ./.github/workflows/build-all-platforms.yml | ||
|
||
build-package: | ||
needs: build-all-platforms | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install required dependencies | ||
env: | ||
HOMEBREW_NO_AUTO_UPDATE: 1 | ||
run: | | ||
brew tap messense/macos-cross-toolchains | ||
brew install protobuf | ||
brew install mingw-w64 | ||
brew install aarch64-unknown-linux-gnu | ||
brew install x86_64-unknown-linux-gnu | ||
cargo install --version 0.22.0 uniffi_bindgen | ||
- name: Checkout breez-sdk repo | ||
uses: actions/checkout@v3 | ||
with: | ||
path: build | ||
ref: ${{ inputs.version }} | ||
- name: Checkout breez-sdk repo for C# project | ||
uses: actions/checkout@v3 | ||
with: | ||
path: dist | ||
ref: ${{ inputs.cs-project-ref }} | ||
- name: Build C# bindings | ||
working-directory: build/libs/sdk-bindings | ||
env: | ||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | ||
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: x86_64-linux-gnu-gcc | ||
run: | | ||
make init | ||
rustup target add x86_64-pc-windows-gnu | ||
cargo build --release --target aarch64-unknown-linux-gnu | ||
cargo build --release --target x86_64-unknown-linux-gnu | ||
cargo build --release --target x86_64-pc-windows-gnu | ||
make csharp-darwin | ||
- name: Copy binding | ||
|
||
- name: Install rust | ||
run: | | ||
cp build/libs/sdk-bindings/ffi/csharp/breez_sdk.cs dist/libs/sdk-bindings/bindings-csharp | ||
- name: Copy libraries | ||
rustup set auto-self-update disable | ||
rustup toolchain install stable --profile minimal | ||
cargo install uniffi-bindgen-cs --git https://github.com/breez/uniffi-bindgen-cs --branch namespace | ||
- name: Build C# binding | ||
working-directory: libs/sdk-bindings | ||
run: | | ||
mkdir -p dist/libs/sdk-bindings/bindings-csharp/runtimes/osx-arm64/native && cp build/libs/target/aarch64-apple-darwin/release/libbreez_sdk_bindings.dylib "$_" | ||
mkdir -p dist/libs/sdk-bindings/bindings-csharp/runtimes/osx-x64/native && cp build/libs/target/x86_64-apple-darwin/release/libbreez_sdk_bindings.dylib "$_" | ||
mkdir -p dist/libs/sdk-bindings/bindings-csharp/runtimes/linux-arm64/native && cp build/libs/target/aarch64-unknown-linux-gnu/release/libbreez_sdk_bindings.so "$_" | ||
mkdir -p dist/libs/sdk-bindings/bindings-csharp/runtimes/linux-x64/native && cp build/libs/target/x86_64-unknown-linux-gnu/release/libbreez_sdk_bindings.so "$_" | ||
mkdir -p dist/libs/sdk-bindings/bindings-csharp/runtimes/win-x64/native && cp build/libs/target/x86_64-pc-windows-gnu/release/breez_sdk_bindings.dll "$_" | ||
- name: Update package version | ||
working-directory: dist/libs/sdk-bindings/bindings-csharp | ||
run: sed -i.bak -e 's/<Version>.*<\/Version>/<Version>${{ inputs.version }}<\/Version>/' Breez.Sdk.csproj | ||
uniffi-bindgen-cs src/breez_sdk.udl -o bindings-csharp -c ./uniffi.toml | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: sdk-bindings-${{ github.sha }}-aarch64-apple-darwin | ||
path: libs/sdk-bindings/bindings-csharp/runtimes/osx-arm64/native | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: sdk-bindings-${{ github.sha }}-x86_64-apple-darwin | ||
path: libs/sdk-bindings/bindings-csharp/runtimes/osx-x64/native | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: sdk-bindings-${{ github.sha }}-aarch64-unknown-linux-gnu | ||
path: libs/sdk-bindings/bindings-csharp/runtimes/linux-arm64/native | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: sdk-bindings-${{ github.sha }}-x86_64-unknown-linux-gnu | ||
path: libs/sdk-bindings/bindings-csharp/runtimes/linux-x64/native | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: sdk-bindings-${{ github.sha }}-aarch64-pc-windows-msvc | ||
path: libs/sdk-bindings/bindings-csharp/runtimes/win-arm64/native | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: sdk-bindings-${{ github.sha }}-x86_64-pc-windows-msvc | ||
path: libs/sdk-bindings/bindings-csharp/runtimes/win-x64/native | ||
|
||
# - name: Update package version | ||
# working-directory: dist/libs/sdk-bindings/bindings-csharp | ||
# run: sed -i.bak -e 's/<Version>.*<\/Version>/<Version>${{ inputs.version }}<\/Version>/' Breez.Sdk.csproj | ||
|
||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '6.0.x' | ||
|
||
- name: Build the project | ||
working-directory: dist/libs/sdk-bindings/bindings-csharp | ||
run: dotnet build Breez.Sdk.csproj | ||
|
||
- name: Create the package | ||
working-directory: dist/libs/sdk-bindings/bindings-csharp | ||
run: dotnet pack --configuration Release Breez.Sdk.csproj | ||
|
||
- name: Archive the package | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Breez.Sdk.${{ inputs.version }}.nupkg | ||
path: dist/libs/sdk-bindings/bindings-csharp/bin/Release/Breez.Sdk.${{ inputs.version }}.nupkg | ||
name: Breez.Sdk.${{ github.sha }}.nupkg | ||
path: dist/libs/sdk-bindings/bindings-csharp/bin/Release/Breez.Sdk.*.nupkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters