rustdesk/.github/workflows/bridge.yml

80 lines
2.4 KiB
YAML
Raw Normal View History

2023-03-23 10:04:44 +08:00
# This yaml shares the build bridge steps with ci and nightly.
name: Build flutter-rust-bridge
# 2023-04-19 15:48:00+00:00
2023-03-23 10:04:44 +08:00
on:
workflow_call:
2023-05-12 15:16:25 +08:00
env:
2023-06-05 11:25:11 +08:00
FLUTTER_VERSION: "3.10.2"
FLUTTER_RUST_BRIDGE_VERSION: "1.75.3"
2023-05-12 15:16:25 +08:00
2023-03-23 10:04:44 +08:00
jobs:
generate_bridge:
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-20.04,
2023-03-23 10:04:44 +08:00
extra-build-args: "",
}
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install prerequisites
run: |
sudo apt install ca-certificates -y
2023-03-23 10:04:44 +08:00
sudo apt update -y
sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang cmake libclang-dev ninja-build llvm-dev libclang-10-dev llvm-10-dev pkg-config
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.job.target }}
override: true
profile: minimal # minimal component installation (ie, no documentation)
- uses: Swatinem/rust-cache@v2
with:
prefix-key: bridge-${{ matrix.job.os }}
workspace: "/tmp/flutter_rust_bridge/frb_codegen"
- name: Cache Bridge
id: cache-bridge
uses: actions/cache@v3
with:
path: /tmp/flutter_rust_bridge
key: vcpkg-${{ matrix.job.arch }}
- name: Install flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
2023-05-12 15:16:25 +08:00
flutter-version: ${{ env.FLUTTER_VERSION }}
2023-03-23 10:04:44 +08:00
cache: true
- name: Install flutter rust bridge deps
shell: bash
run: |
cargo install flutter_rust_bridge_codegen --version ${{ env.FLUTTER_RUST_BRIDGE_VERSION }} --features "uuid"
2023-03-23 10:04:44 +08:00
pushd flutter && flutter pub get && popd
- name: Run flutter rust bridge
run: |
~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart
- name: Upload Artifact
uses: actions/upload-artifact@master
with:
name: bridge-artifact
path: |
./src/bridge_generated.rs
./src/bridge_generated.io.rs
./flutter/lib/generated_bridge.dart
./flutter/lib/generated_bridge.freezed.dart