From 7bd0843bcd964e8e5e1f73deb3c9edd03b91733c Mon Sep 17 00:00:00 2001 From: Kingtous Date: Thu, 20 Oct 2022 17:16:15 +0800 Subject: [PATCH] feat: add flutter nightly ci --- .github/workflows/ci.yml | 2 + .github/workflows/flutter-ci.yml | 2 + .github/workflows/flutter-nightly.yml | 151 ++++++++++++++++++++++++++ build.py | 4 +- 4 files changed, 156 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/flutter-nightly.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 235b14be7..2e1702a60 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,8 @@ on: - master tags: - '*' + paths-ignore: + - ".github/**" jobs: # ensure_cargo_fmt: diff --git a/.github/workflows/flutter-ci.yml b/.github/workflows/flutter-ci.yml index ac7e9b27d..8b58db83f 100644 --- a/.github/workflows/flutter-ci.yml +++ b/.github/workflows/flutter-ci.yml @@ -8,6 +8,8 @@ on: - master tags: - '*' + paths-ignore: + - ".github/**" jobs: build: diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml new file mode 100644 index 000000000..79ae62e3d --- /dev/null +++ b/.github/workflows/flutter-nightly.yml @@ -0,0 +1,151 @@ +name: Flutter Nightly Build + +on: + schedule: + - cron: "* 0 * * *" + workflow_dispatch: + +jobs: + build: + name: ${{ matrix.job.target }} (${{ matrix.job.os }}) + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + # - { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + # - { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true } + # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } + # - { target: i686-pc-windows-msvc , os: windows-2019 } + # - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } + # - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } + # - { target: x86_64-apple-darwin , os: macos-10.15 } + # - { target: x86_64-pc-windows-gnu , os: windows-2019 } + - { target: x86_64-pc-windows-msvc , os: windows-2019 } + - { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 } + # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } + steps: + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Install prerequisites + shell: bash + if: startsWith(matrix.job.os, 'ubuntu') + run: | + case ${{ matrix.job.target }} in + x86_64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake libclang-dev ninja-build libayatana-appindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev;; + # arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; + # aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; + esac + + - name: Install LLVM and Clang + if: startsWith(matrix.job.os, 'windows') + uses: KyleMayes/install-llvm-action@v1 + with: + version: "13.0" + + - name: Install flutter + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.0.5' + + - 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@v1 + + - name: Install flutter rust bridge deps for linux + if: startsWith(matrix.job.os, 'ubuntu') + run: | + dart pub global activate ffigen --version 5.0.1 + # flutter_rust_bridge + if [[ ! -e $HOME/.cargo/bin/flutter_rust_bridge_codegen ]]; then  ✔ + pushd /tmp && git clone https://github.com/SoLongAndThanksForAllThePizza/flutter_rust_bridge --depth=1 && popd + pushd /tmp/flutter_rust_bridge/frb_codegen && cargo install --path . && popd + fi + pushd flutter && flutter pub get && popd + ~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart + + - name: Install flutter rust bridge deps for windows + if: startsWith(matrix.job.os, 'windows') + run: | + dart pub global activate ffigen --version 5.0.1 + $exists = Test-Path ~/.cargo/bin/flutter_rust_bridge_codegen.exe + If ( ! $exists -eq $True ) + { + Push-Location .. + git clone https://github.com/SoLongAndThanksForAllThePizza/flutter_rust_bridge --depth=1 + Push-Location flutter_rust_bridge/frb_codegen ; cargo install --path . ; Pop-Location + Pop-Location + } + Push-Location flutter ; flutter pub get ; Pop-Location + ~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart + + - name: Restore from cache and install vcpkg + uses: lukka/run-vcpkg@v7 + with: + setupOnly: true + vcpkgGitCommitId: '6ca56aeb457f033d344a7106cb3f9f1abf8f4e98' + + - name: Install vcpkg dependencies for linux + if: startsWith(matrix.job.os, 'ubuntu') + run: | + $VCPKG_ROOT/vcpkg install libvpx libyuv opus + shell: bash + + - name: Install vcpkg dependencies for windows + if: startsWith(matrix.job.os, 'windows') + run: | + $VCPKG_ROOT/vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static + shell: bash + + - name: Install cargo bundle tools + if: startsWith(matrix.job.os, 'ubuntu') + run: | + cargo install cargo-bundle + + - name: Show version information (Rust, cargo, GCC) + shell: bash + run: | + gcc --version || true + rustup -V + rustup toolchain list + rustup default + cargo -V + rustc -V + + - name: Build rustdesk for linux + if: startsWith(matrix.job.os, 'ubuntu') + run: ./build.py --flutter + + - name: Build rustdesk for windows + if: startsWith(matrix.job.os, 'windows') + run: python3 .\build.py --portable + + - name: Update nightly release for linux + if: startsWith(matrix.job.os, 'ubuntu') + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "nightly" + prerelease: true + title: "Nightly Build" + files: | + rustdesk-*.deb + + - name: Update nightly release for windows + if: startsWith(matrix.job.os, 'windows') + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "nightly" + prerelease: true + title: "Nightly Build" + files: | + rustdesk-*.exe diff --git a/build.py b/build.py index a81a9a999..e7deb52ba 100755 --- a/build.py +++ b/build.py @@ -225,9 +225,7 @@ def main(): version = get_version() features = ",".join(get_features(args)) flutter = args.flutter - if not flutter: - # not flutter, is sciter - os.system('python3 res/inline-sciter.py') + os.system('python3 res/inline-sciter.py') portable = args.portable if windows: if flutter: