mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2025-12-29 03:44:27 +01:00
* CI: Test if SDK compiles with latest dependencies * Add secp256k1-zkp patch * Propagate the patch in Cargo.lock
254 lines
6.7 KiB
YAML
254 lines
6.7 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@v2
|
|
with:
|
|
version: "23.4"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Check Rust Clippy
|
|
run: |
|
|
cd lib
|
|
cargo clippy -- -D warnings
|
|
cd ../cli
|
|
cargo clippy -- -D warnings
|
|
|
|
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@v2
|
|
with:
|
|
version: "23.4"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run sdk-core tests
|
|
working-directory: lib/core
|
|
run: cargo 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@v2
|
|
with:
|
|
version: "23.4"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build bindings
|
|
working-directory: lib/bindings
|
|
run: cargo build
|
|
|
|
- name: Setup python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Run bindings tests
|
|
run: |
|
|
curl -o jna-5.12.1.jar https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar
|
|
export CLASSPATH=$(pwd)/jna-5.12.1.jar;
|
|
cd lib/bindings
|
|
cargo test
|
|
|
|
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 update
|
|
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
|
|
- 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 flutter_rust_bridge_codegen dependencies
|
|
working-directory: lib/bindings/langs/flutter/
|
|
run: just frb
|
|
|
|
- name: Generate Dart/Flutter bindings
|
|
working-directory: lib/bindings/langs/flutter/
|
|
continue-on-error: true
|
|
run: |
|
|
just codegen
|
|
|
|
- name: Generate FFI bindings
|
|
working-directory: lib/bindings/langs/flutter/
|
|
continue-on-error: true
|
|
run: |
|
|
just ffigen
|
|
|
|
- name: Static Analysis
|
|
working-directory: lib/bindings/langs/flutter/
|
|
run: melos analyze
|
|
|
|
- name: Check Formatting
|
|
working-directory: lib/bindings/langs/flutter/
|
|
run: melos check-format
|
|
|
|
- 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@v3
|
|
|
|
- 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@v2
|
|
with:
|
|
version: "23.4"
|
|
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-liquid-sdk breez-liquid-sdk
|
|
|
|
# In this test, we reference the checked out repo (e.g. this PR branch)
|
|
cargo add --path ../lib/core breez-liquid-sdk
|
|
|
|
# Add the secp256k1-zkp patch: https://github.com/BlockstreamResearch/rust-secp256k1-zkp/pull/48/commits
|
|
echo "[patch.crates-io]" >> Cargo.toml
|
|
echo "secp256k1-zkp = {git = 'https://github.com/sanket1729/rust-secp256k1-zkp.git', rev = '60e631c24588a0c9e271badd61959294848c665d'}" >> Cargo.toml
|
|
# Propagate the patch in Cargo.lock
|
|
rm Cargo.lock
|
|
cargo update --package secp256k1-zkp
|
|
|
|
cargo clippy -- -D warnings |