mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2026-01-18 05:24:25 +01:00
* Wasm: end-to-end-test support * Update testing dev docs * Expose Arc in prelude * Switch to waterfalls fork * Set node version
608 lines
17 KiB
YAML
608 lines
17 KiB
YAML
name: CI
|
|
|
|
# Controls when the workflow will run
|
|
on:
|
|
# Triggers the workflow on push events but only for the "main" branch
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
|
|
fmt:
|
|
name: Cargo Format
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Check Rust Formatting
|
|
run: |
|
|
cd lib
|
|
cargo fmt -- --check
|
|
cd ../cli
|
|
cargo fmt -- --check
|
|
|
|
clippy:
|
|
name: Cargo Clippy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: |
|
|
lib -> target
|
|
cli -> target
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Clippy bindings
|
|
working-directory: lib/bindings
|
|
run: cargo clippy --all-targets -- -D warnings
|
|
|
|
- name: Clippy core
|
|
working-directory: lib/core
|
|
run: cargo clippy --all-targets -- -D warnings
|
|
|
|
- name: Clippy cli
|
|
working-directory: cli
|
|
run: cargo clippy -- -D warnings
|
|
|
|
clippy-wasm:
|
|
name: Cargo Clippy Wasm
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Wasm target
|
|
run: rustup target add wasm32-unknown-unknown
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: |
|
|
lib -> target
|
|
cli -> target
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup emsdk
|
|
uses: mymindstorm/setup-emsdk@v14
|
|
|
|
- name: Clippy
|
|
run: make wasm-clippy
|
|
|
|
build:
|
|
name: Cargo Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: |
|
|
lib -> target
|
|
cache-on-failure: "true"
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Cargo build bindings
|
|
working-directory: lib/bindings
|
|
run: cargo build
|
|
|
|
- name: Cargo build core
|
|
working-directory: lib/core
|
|
run: cargo build
|
|
|
|
- name: Check git status
|
|
env:
|
|
GIT_PAGER: cat
|
|
run: |
|
|
status=$(git status --porcelain)
|
|
if [[ -n "$status" ]]; then
|
|
echo "Git status has changes"
|
|
echo "$status"
|
|
git diff
|
|
exit 1
|
|
else
|
|
echo "No changes in git status"
|
|
fi
|
|
|
|
build-wasm:
|
|
name: Cargo Build Wasm
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Wasm target
|
|
run: rustup target add wasm32-unknown-unknown
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: |
|
|
lib -> target
|
|
cli -> target
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup emsdk
|
|
uses: mymindstorm/setup-emsdk@v14
|
|
|
|
- name: Cargo build
|
|
working-directory: lib/wasm
|
|
run: cargo build --target=wasm32-unknown-unknown
|
|
|
|
- name: Check git status
|
|
env:
|
|
GIT_PAGER: cat
|
|
run: |
|
|
status=$(git status --porcelain)
|
|
if [[ -n "$status" ]]; then
|
|
echo "Git status has changes"
|
|
echo "$status"
|
|
git diff
|
|
exit 1
|
|
else
|
|
echo "No changes in git status"
|
|
fi
|
|
|
|
tests:
|
|
name: Test sdk-core
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: |
|
|
lib -> target
|
|
cli -> target
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run sdk-core tests
|
|
working-directory: lib/core
|
|
run: cargo test
|
|
|
|
regtest-tests:
|
|
name: Regtest sdk-core tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set up Docker
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Set up Docker Compose
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y docker-compose
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: |
|
|
lib -> target
|
|
cli -> target
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Start regtest environment
|
|
working-directory: regtest
|
|
run: sh start.sh
|
|
|
|
- name: Run regtest tests
|
|
working-directory: lib/core
|
|
run: make cargo-regtest-test
|
|
|
|
build-bindings:
|
|
name: Test bindings
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: |
|
|
lib -> target
|
|
cli -> target
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Build bindings
|
|
working-directory: lib/bindings
|
|
run: cargo build
|
|
|
|
- name: Run bindings tests
|
|
run: |
|
|
curl -o jna-5.14.0.jar https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.14.0/jna-5.14.0.jar
|
|
export CLASSPATH=$(pwd)/jna-5.14.0.jar;
|
|
cd lib/bindings
|
|
cargo test
|
|
|
|
build-bindings-uniffi-25:
|
|
name: Test bindings Uniffi 0.25
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: -uniffi-25
|
|
workspaces: |
|
|
lib -> target
|
|
cli -> target
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup dotnet
|
|
uses: actions/setup-dotnet@v3
|
|
with:
|
|
dotnet-version: '7.0.x'
|
|
|
|
- name: Setup go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: '1.19.9'
|
|
|
|
- name: Build bindings
|
|
working-directory: lib/bindings
|
|
run: cargo build --no-default-features --features uniffi-25
|
|
|
|
- name: Build C# bindings
|
|
working-directory: lib/bindings
|
|
run: |
|
|
cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.8.0+v0.25.0
|
|
uniffi-bindgen-cs src/breez_sdk_liquid.udl -o ffi/csharp -c ./uniffi.toml
|
|
cp ../target/debug/libbreez_sdk_liquid_bindings.so ffi/csharp
|
|
|
|
- name: Build golang bindings
|
|
working-directory: lib/bindings
|
|
run: |
|
|
cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0
|
|
uniffi-bindgen-go src/breez_sdk_liquid.udl -o ffi/golang -c ./uniffi.toml
|
|
cp ../target/debug/libbreez_sdk_liquid_bindings.so ffi/golang
|
|
cp -r ffi/golang/breez_sdk_liquid tests/bindings/golang/
|
|
|
|
- name: Run bindings tests
|
|
working-directory: lib/bindings
|
|
run: cargo test --no-default-features --features uniffi-25
|
|
|
|
test-wasm:
|
|
name: Test Wasm
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Wasm target
|
|
run: rustup target add wasm32-unknown-unknown
|
|
|
|
- name: Install wasm-pack
|
|
run: cargo install wasm-pack
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: |
|
|
lib -> target
|
|
cli -> target
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup emsdk
|
|
uses: mymindstorm/setup-emsdk@v14
|
|
|
|
- name: Test Wasm
|
|
run: make wasm-test
|
|
|
|
regtest-tests-wasm:
|
|
name: Regtest sdk-core Wasm tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set up Docker
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Set up Docker Compose
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y docker-compose
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Install Wasm target
|
|
run: rustup target add wasm32-unknown-unknown
|
|
|
|
- name: Install wasm-pack
|
|
run: cargo install wasm-pack
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: |
|
|
lib -> target
|
|
cli -> target
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup emsdk
|
|
uses: mymindstorm/setup-emsdk@v14
|
|
|
|
- name: Start regtest environment
|
|
working-directory: regtest
|
|
run: sh start.sh
|
|
|
|
- name: Run Wasm regtest tests
|
|
working-directory: lib/core
|
|
run: make wasm-regtest-test
|
|
|
|
notification-plugin:
|
|
name: Check notification plugin
|
|
runs-on: macOS-14
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: |
|
|
lib -> target
|
|
cli -> target
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Java 17
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
distribution: "temurin"
|
|
java-version: 17
|
|
|
|
- name: Build bindings
|
|
working-directory: lib/bindings
|
|
run: cargo build
|
|
|
|
- name: Build Android bindings
|
|
working-directory: lib/bindings
|
|
run: |
|
|
cargo run --no-default-features --features=uniffi-25 --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language kotlin -o langs/android/lib/src/main/kotlin
|
|
|
|
- name: Run Android build
|
|
working-directory: lib/bindings/langs/android
|
|
run: |
|
|
./gradlew build
|
|
|
|
- name: Build Swift bindings
|
|
working-directory: lib/bindings
|
|
run: |
|
|
cargo run --bin uniffi-bindgen generate src/breez_sdk_liquid.udl --no-format --language swift -o langs/swift/Sources/BreezSDKLiquid
|
|
mv langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquid.swift langs/swift/Sources/BreezSDKLiquid/BreezSDKLiquid.swift
|
|
cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/ios-arm64/breez_sdk_liquidFFI.framework/Headers
|
|
cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/ios-arm64_x86_64-simulator/breez_sdk_liquidFFI.framework/Headers
|
|
cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/swift/breez_sdk_liquidFFI.xcframework/macos-arm64_x86_64/breez_sdk_liquidFFI.framework/Headers
|
|
cp langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h langs/flutter/breez_sdk_liquidFFI/include/
|
|
rm langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h
|
|
rm langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.modulemap
|
|
|
|
- name: Run Swift build
|
|
working-directory: lib/bindings/langs/swift
|
|
run: |
|
|
swift build
|
|
|
|
react-native:
|
|
name: Check react native bindings
|
|
runs-on: macOS-14
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: React native codegen
|
|
working-directory: packages/react-native
|
|
run: |
|
|
yarn global add tslint typescript
|
|
brew install kotlin ktlint swiftformat
|
|
make react-native
|
|
|
|
- name: Check git status
|
|
env:
|
|
GIT_PAGER: cat
|
|
run: |
|
|
status=$(git status --porcelain)
|
|
if [[ -n "$status" ]]; then
|
|
echo "Git status has changes"
|
|
echo "$status"
|
|
git diff
|
|
exit 1
|
|
else
|
|
echo "No changes in git status"
|
|
fi
|
|
|
|
flutter:
|
|
name: Check Dart/Flutter bindings
|
|
runs-on: macOS-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: stable
|
|
flutter-version: 3.29.0
|
|
- run: flutter --version
|
|
|
|
- name: Set up just
|
|
uses: extractions/setup-just@v2
|
|
|
|
- name: Set up Melos
|
|
uses: bluefireteam/melos-action@v3
|
|
with:
|
|
run-bootstrap: false
|
|
|
|
- name: Initialize the workspace
|
|
working-directory: lib/bindings/langs/flutter/
|
|
run: |
|
|
just clean
|
|
just init
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install flutter_rust_bridge_codegen dependencies
|
|
working-directory: lib/bindings/langs/flutter/
|
|
run: just frb
|
|
|
|
- name: Generate Dart/Flutter bindings & Softlink C Headers
|
|
working-directory: lib/bindings/langs/flutter/
|
|
run: just codegen
|
|
|
|
- name: Build iOS Framework & Softlink C Headers
|
|
working-directory: lib/bindings/langs/flutter/
|
|
if: ${{ success() || failure() }}
|
|
run: just build-ios-framework
|
|
|
|
- name: Generate FFI bindings
|
|
working-directory: lib/bindings/langs/flutter/
|
|
if: ${{ success() || failure() }}
|
|
run: just ffigen
|
|
|
|
- name: Static Analysis
|
|
working-directory: lib/bindings/langs/flutter/
|
|
if: ${{ success() || failure() }}
|
|
run: melos analyze
|
|
|
|
- name: Check Formatting
|
|
working-directory: lib/bindings/langs/flutter/
|
|
run: melos check-format
|
|
|
|
# This step is added to ensure version recipe was run to update podspec files & CMake script.
|
|
# It does not catch the case where 'packages/flutter/pubspec.yaml' wasn't updated properly.
|
|
- name: Update version number on podspec files & CMake scripts
|
|
working-directory: lib/bindings/langs/flutter/
|
|
run: just version
|
|
|
|
- name: Check git status
|
|
env:
|
|
GIT_PAGER: cat
|
|
run: |
|
|
status=$(git status --porcelain)
|
|
if [[ -n "$status" ]]; then
|
|
echo "Git status has changes"
|
|
echo "$status"
|
|
git diff
|
|
exit 1
|
|
else
|
|
echo "No changes in git status"
|
|
fi
|
|
|
|
# Create a new plain Rust project, add the Liquid SDK as single dependency and try to compile it.
|
|
# This tests whether the SDK compiles with the latest version of the dependencies that can be updated.
|
|
#
|
|
# See discussion at https://github.com/breez/breez-sdk/pull/971
|
|
check-sdk-as-dependency:
|
|
name: Check SDK as Rust dependency in fresh project
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install rust
|
|
run: |
|
|
rustup set auto-self-update disable
|
|
rustup toolchain install stable --profile minimal
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: |
|
|
lib -> target
|
|
|
|
- name: Install Protoc
|
|
uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "27.2"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: test-new-project-with-sdk-dependency
|
|
run: |
|
|
mkdir new-project
|
|
cd new-project
|
|
cargo init --name test_project --vcs none
|
|
|
|
# A project might reference our SDK as a git repository
|
|
# cargo add --git https://github.com/breez/breez-sdk-liquid breez-sdk-liquid
|
|
|
|
# In this test, we reference the checked out repo (e.g. this PR branch)
|
|
cargo add --path ../lib/core breez-sdk-liquid
|
|
|
|
# Add the secp256k1-zkp patch: https://github.com/BlockstreamResearch/rust-secp256k1-zkp/pull/48/commits and rebased on secp256k1-zkp 0.11.0
|
|
echo "[patch.crates-io]" >> Cargo.toml
|
|
echo "secp256k1-zkp = {git = 'https://github.com/dangeross/rust-secp256k1-zkp.git', rev = '57d29b15269ca2ce3c3b118b6a72b66c1169e7b1'}" >> Cargo.toml
|
|
# Propagate the patch in Cargo.lock
|
|
rm Cargo.lock
|
|
cargo update --package secp256k1-zkp
|
|
|
|
cargo clippy -- -D warnings
|