Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
227 changes: 15 additions & 212 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,223 +1,26 @@
name: Build and Release
name: Test native assets

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
workflow_dispatch:

jobs:

test:
runs-on: ubuntu-24.04
container:
image: stackwallet/stackwallet-ci:latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: Swatinem/rust-cache@v2
with:
workspaces: src/serai
key: test

- name: Run tests
run: |
cd src/serai
cargo +1.71.0 test --workspace --exclude bitcoin-serai

build-linux:
needs: test
runs-on: ubuntu-24.04
container:
image: stackwallet/stackwallet-ci:latest
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
asset: frostdart-linux-x86_64.so
- target: aarch64-unknown-linux-gnu
asset: frostdart-linux-aarch64.so
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- name: Add Rust target
run: rustup +1.71.0 target add ${{ matrix.target }}

- uses: Swatinem/rust-cache@v2
with:
workspaces: src/serai
key: linux-${{ matrix.target }}

- name: Build
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
run: |
cd src/serai/hrf
cargo +1.71.0 build --target ${{ matrix.target }} --release --lib
cp ../target/${{ matrix.target }}/release/libhrf_api.so \
../../../${{ matrix.asset }}

- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset }}
path: ${{ matrix.asset }}

build-android:
needs: test
runs-on: ubuntu-24.04
container:
image: stackwallet/stackwallet-ci:latest
strategy:
matrix:
include:
- target: aarch64-linux-android
abi: arm64-v8a
- target: armv7-linux-androideabi
abi: armeabi-v7a
- target: x86_64-linux-android
abi: x86_64
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- name: Add Rust target
run: rustup +1.71.0 target add ${{ matrix.target }}

- uses: Swatinem/rust-cache@v2
with:
workspaces: src/serai
key: android-${{ matrix.abi }}

- name: Build
env:
ANDROID_NDK_ROOT: /opt/android-ndk-r28
run: |
cd src/serai/hrf
sed -i 's/\[dependencies\]/[dependencies]\nopenssl = { version = "<=0.10.78", features = ["vendored"] }\nopenssl-sys = "<=0.9.114"/' Cargo.toml
cargo +1.71.0 ndk --target ${{ matrix.target }} --platform 21 build --release
cp ../target/${{ matrix.target }}/release/libhrf_api.so \
../../../frostdart-android-${{ matrix.abi }}.so

- uses: actions/upload-artifact@v4
with:
name: frostdart-android-${{ matrix.abi }}.so
path: frostdart-android-${{ matrix.abi }}.so

build-windows:
needs: test
runs-on: ubuntu-24.04
container:
image: stackwallet/stackwallet-ci:latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- name: Add Rust target
run: rustup +1.71.0 target add x86_64-pc-windows-gnu

- uses: Swatinem/rust-cache@v2
with:
workspaces: src/serai

- name: Build
run: |
cd src/serai/hrf
cargo +1.71.0 build --target x86_64-pc-windows-gnu --release --lib
cp ../target/x86_64-pc-windows-gnu/release/hrf_api.dll \
../../../frostdart-windows-x86_64.dll

- uses: actions/upload-artifact@v4
with:
name: frostdart-windows-x86_64.dll
path: frostdart-windows-x86_64.dll

build-ios:
needs: test
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: dtolnay/rust-toolchain@master
with:
toolchain: '1.71.0'
targets: aarch64-apple-ios

- uses: Swatinem/rust-cache@v2
with:
workspaces: src/serai

- name: Build
run: |
cd src/serai/hrf
sed -i '' 's/name = "hrf-api"/name = "frostdart"/' Cargo.toml
export IPHONEOS_DEPLOYMENT_TARGET=15.0
export RUSTFLAGS="-C link-arg=-mios-version-min=15.0"
cargo build --target aarch64-apple-ios --release --lib
cp ../target/aarch64-apple-ios/release/libfrostdart.a \
../../../frostdart-ios-aarch64.a

- uses: actions/upload-artifact@v4
with:
name: frostdart-ios-aarch64.a
path: frostdart-ios-aarch64.a

build-macos:
needs: test
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: dtolnay/rust-toolchain@master
with:
toolchain: '1.71.0'
targets: aarch64-apple-darwin

- uses: Swatinem/rust-cache@v2
with:
workspaces: src/serai

- name: Build
run: |
cd src/serai/hrf
cargo build --target aarch64-apple-darwin --release --lib
xcodebuild -create-xcframework \
-library ../target/aarch64-apple-darwin/release/libhrf_api.dylib \
-output ../../../frostdart.xcframework
cd ../../..
zip -r frostdart.xcframework.zip frostdart.xcframework

- uses: actions/upload-artifact@v4
with:
name: frostdart.xcframework.zip
path: frostdart.xcframework.zip

release:
needs: [build-linux, build-android, build-ios, build-macos, build-windows]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Generate checksums
run: |
cd artifacts
sha256sum * > checksums.txt

- uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: artifacts/*
- uses: dart-lang/setup-dart@v1
with:
sdk: '3.13.0'
- uses: dtolnay/rust-toolchain@1.90.0
- run: dart pub get --no-example
- run: dart analyze lib test hook
- run: dart test
- name: Rust tests
if: matrix.os == 'ubuntu-24.04'
working-directory: src/serai/hrf
run: cargo test --locked --workspace --exclude bitcoin-serai
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,3 @@ build/

.flutter-plugins
.flutter-plugins-dependencies

android/src/main/jniLibs/

/macos/frostdart.xcframework/
/ios/libfrostdart.a
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

34 changes: 1 addition & 33 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,4 @@ version:
revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
channel: stable

project_type: plugin_ffi

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
- platform: android
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
- platform: ios
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
- platform: linux
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
- platform: macos
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
- platform: windows
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
project_type: package_ffi
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.3.0

* Build Rust automatically with native assets (Dart 3.13+, Rust 1.90.0).
* Replace `FrostdartBindings` with generated `@Native` functions; public wrappers remain available.

## 0.0.1

* TODO: Describe initial release.
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# frostdart

Dart interface to the Serai FROST multisig implementation
Dart bindings for the Serai FROST multisig implementation. Rust sources live in
`src/serai`; native assets build and bundle them automatically.

## Building
Requires Dart 3.13+ (or a Flutter SDK containing it), Rust installed with rustup,
and the platform's C build tools: Xcode for Apple, the Android NDK, a Linux C
compiler, or Visual Studio's C++ build tools on Windows. Put `rustup` on PATH.
The hook locates the pinned Rust 1.90.0 tools and installs the target as needed.

```
git clone https://www.github.com/cypherstack/frostdart
cd frostdart
git submodule update --init --recursive
cd scripts/[platform]
./build_all.sh
```sh
dart pub get --no-example
dart test
```

or `build_all.bat` for Windows.
Consuming Flutter apps use normal `flutter run` / `flutter build` commands.
The example requires iOS 15+ or macOS 13+ for Apple builds.

Rust 1.71.0 or newer is required. `[rustup](https://rustup.rs/) toolchain install 1.71.0-x86_64-pc-windows-msvc` for Windows.
Regenerate bindings with `dart run ffigen --config ffigen.yaml` (requires libclang).
9 changes: 0 additions & 9 deletions android/.gitignore

This file was deleted.

Loading