Skip to content

Commit

Permalink
add dart sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
zksemi committed May 7, 2024
1 parent a97b330 commit 3f0d8aa
Show file tree
Hide file tree
Showing 27 changed files with 19,322 additions and 16 deletions.
103 changes: 103 additions & 0 deletions .github/workflows/build_dart_sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: build_dart_sdk

on:
workflow_dispatch:

jobs:
build-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
target:
- x86_64-pc-windows-msvc
- i686-pc-windows-msvc
steps:
- name: Prepare
run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- name: Compile
run: |
cd bindings/dart/rust
rustup set profile minimal
rustup toolchain install stable
rustup default stable
rustup override set stable
rustup target add --toolchain stable ${{ matrix.target }}
cargo build --profile dart --target=${{ matrix.target }}
cd ../../../
move target\${{ matrix.target }}\dart\*.dll .
7z a ${{ matrix.target }}.7z *.dll
- name: Upload
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.target }}.7z
tag: ${{ github.ref }}
overwrite: true
file_glob: true
build-osx:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
target:
- x86_64-apple-darwin
- aarch64-apple-darwin
- aarch64-apple-ios
steps:
- uses: actions/checkout@v4
- name: Compile
run: |
cd bindings/dart/rust
rustup set profile minimal
rustup toolchain install stable
rustup default stable
rustup override set stable
rustup target add --toolchain stable ${{ matrix.target }}
cargo build --profile dart --target=${{ matrix.target }}
cd ../../../
mv target/${{ matrix.target }}/dart/*.dylib .
tar acf ${{ matrix.target }}.tar.xz *.dylib
- name: Upload
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.target }}.tar.xz
tag: ${{ github.ref }}
overwrite: true
file_glob: true
build-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- i686-unknown-linux-gnu
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- armv7-linux-androideabi
- aarch64-linux-android
steps:
- uses: actions/checkout@v4
- name: Compile
run: |
cd bindings/dart/rust
rustup set profile minimal
rustup toolchain install stable
rustup default stable
rustup override set stable
rustup target add --toolchain stable ${{ matrix.target }}
cargo install cross --git https://github.com/cross-rs/cross
cross build --profile dart --target=${{ matrix.target }}
cd ../../../
mv target/${{ matrix.target }}/dart/*.so .
tar acf ${{ matrix.target }}.tar.xz *.so
- name: Upload
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.target }}.tar.xz
tag: ${{ github.ref }}
overwrite: true
file_glob: true
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,30 @@ jobs:
python-version: '3.10'
- run: make copy_lib_to_py_example run_example_python

dart_binding:
name: dart binding
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: subosito/flutter-action@v2
with:
channel: stable
- name: build
run: |
cd bindings/dart
cargo install '[email protected]'
flutter pub get
flutter_rust_bridge_codegen generate
cd rust
cargo build --profile dart
cd ..
cp ../../target/dart/*.so .
export LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH
dart pub add --dev test
dart test/main.dart
build_wasm:
name: build wasm
Expand Down
Loading

0 comments on commit 3f0d8aa

Please sign in to comment.