opt: reuse deps workflows

This commit is contained in:
Kingtous 2023-03-23 10:04:44 +08:00
parent 98329f08c1
commit 7f20dac547
6 changed files with 175 additions and 307 deletions

73
.github/workflows/bridge.yml vendored Normal file
View File

@ -0,0 +1,73 @@
# This yaml shares the build bridge steps with ci and nightly.
name: Build flutter-rust-bridge
on:
workflow_call:
jobs:
generate_bridge:
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-18.04,
extra-build-args: "",
}
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install prerequisites
run: |
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"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Install flutter rust bridge deps
shell: bash
run: |
cargo install flutter_rust_bridge_codegen
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

View File

@ -164,161 +164,10 @@ jobs:
./build.py --flutter ${{ matrix.job.extra-build-args }}
build-vcpkg-deps-linux:
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: true
matrix:
job:
# - { arch: armv7, os: ubuntu-20.04 }
- { arch: x86_64, os: ubuntu-20.04 }
- { arch: aarch64, os: ubuntu-20.04 }
steps:
- name: Create vcpkg artifacts folder
run: mkdir -p /opt/artifacts
- name: Cache Vcpkg
id: cache-vcpkg
uses: actions/cache@v3
with:
path: /opt/artifacts
key: vcpkg-${{ matrix.job.arch }}
- uses: Kingtous/run-on-arch-action@amd64-support
name: Run vcpkg install on ${{ matrix.job.arch }}
id: vcpkg
with:
arch: ${{ matrix.job.arch }}
distro: ubuntu18.04
githubToken: ${{ github.token }}
setup: |
ls -l "/opt/artifacts"
dockerRunArgs: |
--volume "/opt/artifacts:/artifacts"
shell: /bin/bash
install: |
apt update -y
case "${{ matrix.job.arch }}" in
x86_64)
# CMake 3.15+
apt install -y gpg wget ca-certificates
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
apt update -y
apt install -y curl zip unzip tar git cmake g++ gcc build-essential pkg-config wget nasm yasm ninja-build libjpeg8-dev
;;
aarch64|armv7)
apt install -y curl zip unzip tar git cmake g++ gcc build-essential pkg-config wget nasm yasm ninja-build libjpeg8-dev automake libtool
esac
cmake --version
gcc -v
run: |
# disable git safe.directory
git config --global --add safe.directory "*"
case "${{ matrix.job.arch }}" in
x86_64)
export VCPKG_FORCE_SYSTEM_BINARIES=1
pushd /artifacts
git clone https://github.com/microsoft/vcpkg.git || true
pushd vcpkg
git reset --hard ${{ env.VCPKG_COMMIT_ID }}
./bootstrap-vcpkg.sh
./vcpkg install libvpx libyuv opus
;;
aarch64|armv7)
pushd /artifacts
# libyuv
git clone https://chromium.googlesource.com/libyuv/libyuv || true
pushd libyuv
git pull
mkdir -p build
pushd build
mkdir -p /artifacts/vcpkg/installed
cmake .. -DCMAKE_INSTALL_PREFIX=/artifacts/vcpkg/installed
make -j4 && make install
popd
popd
# libopus, ubuntu 18.04 prebuilt is not be compiled with -fPIC
wget -O opus.tar.gz http://archive.ubuntu.com/ubuntu/pool/main/o/opus/opus_1.1.2.orig.tar.gz
tar -zxvf opus.tar.gz; ls -l
pushd opus-1.1.2
./autogen.sh; ./configure --prefix=/artifacts/vcpkg/installed
make -j4; make install
;;
esac
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: vcpkg-artifact-${{ matrix.job.arch }}
path: |
/opt/artifacts/vcpkg/installed
uses: ./.github/workflows/vcpkg-deps-linux.yml
generate-bridge-linux:
name: generate bridge
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: true
matrix:
job:
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-20.04,
extra-build-args: "",
}
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install prerequisites
run: |
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"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Install flutter rust bridge deps
shell: bash
run: |
cargo install flutter_rust_bridge_codegen
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
uses: ./.github/workflows/bridge.yml
build-rustdesk-android:
needs: [generate-bridge-linux]

View File

@ -264,161 +264,10 @@ jobs:
rustdesk*-${{ matrix.job.target }}.dmg
build-vcpkg-deps-linux:
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
# - { arch: armv7, os: ubuntu-20.04 }
- { arch: x86_64, os: ubuntu-20.04 }
- { arch: aarch64, os: ubuntu-20.04 }
steps:
- name: Create vcpkg artifacts folder
run: mkdir -p /opt/artifacts
- name: Cache Vcpkg
id: cache-vcpkg
uses: actions/cache@v3
with:
path: /opt/artifacts
key: vcpkg-${{ matrix.job.arch }}
- uses: Kingtous/run-on-arch-action@amd64-support
name: Run vcpkg install on ${{ matrix.job.arch }}
id: vcpkg
with:
arch: ${{ matrix.job.arch }}
distro: ubuntu18.04
githubToken: ${{ github.token }}
setup: |
ls -l "/opt/artifacts"
dockerRunArgs: |
--volume "/opt/artifacts:/artifacts"
shell: /bin/bash
install: |
apt update -y
case "${{ matrix.job.arch }}" in
x86_64)
# CMake 3.15+
apt install -y gpg wget ca-certificates
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
apt update -y
apt install -y curl zip unzip tar git cmake g++ gcc build-essential pkg-config wget nasm yasm ninja-build libjpeg8-dev
;;
aarch64|armv7)
apt install -y curl zip unzip tar git cmake g++ gcc build-essential pkg-config wget nasm yasm ninja-build libjpeg8-dev automake libtool
esac
cmake --version
gcc -v
run: |
# disable git safe.directory
git config --global --add safe.directory "*"
case "${{ matrix.job.arch }}" in
x86_64)
export VCPKG_FORCE_SYSTEM_BINARIES=1
pushd /artifacts
git clone https://github.com/microsoft/vcpkg.git || true
pushd vcpkg
git reset --hard ${{ env.VCPKG_COMMIT_ID }}
./bootstrap-vcpkg.sh
./vcpkg install libvpx libyuv opus
;;
aarch64|armv7)
pushd /artifacts
# libyuv
git clone https://chromium.googlesource.com/libyuv/libyuv || true
pushd libyuv
git pull
mkdir -p build
pushd build
mkdir -p /artifacts/vcpkg/installed
cmake .. -DCMAKE_INSTALL_PREFIX=/artifacts/vcpkg/installed
make -j4 && make install
popd
popd
# libopus, ubuntu 18.04 prebuilt is not be compiled with -fPIC
wget -O opus.tar.gz http://archive.ubuntu.com/ubuntu/pool/main/o/opus/opus_1.1.2.orig.tar.gz
tar -zxvf opus.tar.gz; ls -l
pushd opus-1.1.2
./autogen.sh; ./configure --prefix=/artifacts/vcpkg/installed
make -j4; make install
;;
esac
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: vcpkg-artifact-${{ matrix.job.arch }}
path: |
/opt/artifacts/vcpkg/installed
uses: ./.github/workflows/vcpkg-deps-linux.yml
generate-bridge-linux:
name: generate bridge
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-18.04,
extra-build-args: "",
}
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install prerequisites
run: |
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"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Install flutter rust bridge deps
shell: bash
run: |
cargo install flutter_rust_bridge_codegen
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
uses: ./.github/workflows/bridge.yml
build-rustdesk-android:
needs: [generate-bridge-linux]

94
.github/workflows/vcpkg-deps-linux.yml vendored Normal file
View File

@ -0,0 +1,94 @@
name: Build vcpkg dependencies for linux clients
on:
workflow_call:
jobs:
build-vcpkg-deps-linux:
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: true
matrix:
job:
# - { arch: armv7, os: ubuntu-20.04 }
- { arch: x86_64, os: ubuntu-20.04 }
- { arch: aarch64, os: ubuntu-20.04 }
steps:
- name: Create vcpkg artifacts folder
run: mkdir -p /opt/artifacts
- name: Cache Vcpkg
id: cache-vcpkg
uses: actions/cache@v3
with:
path: /opt/artifacts
key: vcpkg-${{ matrix.job.arch }}
- uses: Kingtous/run-on-arch-action@amd64-support
name: Run vcpkg install on ${{ matrix.job.arch }}
id: vcpkg
with:
arch: ${{ matrix.job.arch }}
distro: ubuntu18.04
githubToken: ${{ github.token }}
setup: |
ls -l "/opt/artifacts"
dockerRunArgs: |
--volume "/opt/artifacts:/artifacts"
shell: /bin/bash
install: |
apt update -y
case "${{ matrix.job.arch }}" in
x86_64)
# CMake 3.15+
apt install -y gpg wget ca-certificates
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
apt update -y
apt install -y curl zip unzip tar git cmake g++ gcc build-essential pkg-config wget nasm yasm ninja-build libjpeg8-dev
;;
aarch64|armv7)
apt install -y curl zip unzip tar git cmake g++ gcc build-essential pkg-config wget nasm yasm ninja-build libjpeg8-dev automake libtool
esac
cmake --version
gcc -v
run: |
# disable git safe.directory
git config --global --add safe.directory "*"
case "${{ matrix.job.arch }}" in
x86_64)
export VCPKG_FORCE_SYSTEM_BINARIES=1
pushd /artifacts
git clone https://github.com/microsoft/vcpkg.git || true
pushd vcpkg
git reset --hard ${{ env.VCPKG_COMMIT_ID }}
./bootstrap-vcpkg.sh
./vcpkg install libvpx libyuv opus
;;
aarch64|armv7)
pushd /artifacts
# libyuv
git clone https://chromium.googlesource.com/libyuv/libyuv || true
pushd libyuv
git pull
mkdir -p build
pushd build
mkdir -p /artifacts/vcpkg/installed
cmake .. -DCMAKE_INSTALL_PREFIX=/artifacts/vcpkg/installed
make -j4 && make install
popd
popd
# libopus, ubuntu 18.04 prebuilt is not be compiled with -fPIC
wget -O opus.tar.gz http://archive.ubuntu.com/ubuntu/pool/main/o/opus/opus_1.1.2.orig.tar.gz
tar -zxvf opus.tar.gz; ls -l
pushd opus-1.1.2
./autogen.sh; ./configure --prefix=/artifacts/vcpkg/installed
make -j4; make install
;;
esac
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: vcpkg-artifact-${{ matrix.job.arch }}
path: |
/opt/artifacts/vcpkg/installed

3
.gitignore vendored
View File

@ -27,6 +27,7 @@ rustdesk
appimage/AppDir
appimage/*.AppImage
appimage/appimage-build
appimage/*.xz
# flutter
flutter/linux/build/**
flutter/linux/cmake-build-debug/**
@ -38,6 +39,8 @@ flatpak/.flatpak-builder/shared-modules/**
flatpak/.flatpak-builder/shared-modules/*.tar.xz
flatpak/.flatpak-builder/debian-binary
flatpak/build/**
flatpak/repo/**
flatpak/*.flatpak
# bridge file
lib/generated_bridge.dart
# vscode devcontainer

View File

@ -92,7 +92,7 @@ dependencies:
password_strength: ^0.2.0
flutter_launcher_icons: ^0.11.0
flutter_keyboard_visibility: ^5.4.0
texture_rgba_renderer: ^0.0.13
texture_rgba_renderer: ^0.0.14
percent_indicator: ^4.2.2
dropdown_button2: ^2.0.0