From 97aeee71724e39de35712d25aafc22dbfbc8cf09 Mon Sep 17 00:00:00 2001 From: Vasyl Gello Date: Fri, 3 Nov 2023 21:41:48 +0200 Subject: [PATCH] Fix CI * Drop third party lib repos * Now all vcpkg dependencies are declared in vcpkg.json * Implement vcpkg binary caching in Github Actions Signed-off-by: Vasyl Gello --- .github/workflows/bridge.yml | 26 +- .github/workflows/ci.yml | 55 ++- .github/workflows/flutter-build.yml | 529 ++++++++++++++++++++----- .github/workflows/flutter-ci.yml | 1 - .github/workflows/flutter-nightly.yml | 2 +- .github/workflows/flutter-tag.yml | 2 +- .github/workflows/history.yml | 20 +- .github/workflows/vcpkg-deps-linux.yml | 92 ----- 8 files changed, 497 insertions(+), 230 deletions(-) delete mode 100644 .github/workflows/vcpkg-deps-linux.yml diff --git a/.github/workflows/bridge.yml b/.github/workflows/bridge.yml index c94322102..5b9367221 100644 --- a/.github/workflows/bridge.yml +++ b/.github/workflows/bridge.yml @@ -8,7 +8,7 @@ on: env: FLUTTER_VERSION: "3.13.9" FLUTTER_RUST_BRIDGE_VERSION: "1.80.1" - + jobs: generate_bridge: runs-on: ${{ matrix.job.os }} @@ -27,9 +27,25 @@ jobs: - name: Install prerequisites run: | - sudo apt install ca-certificates -y - 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 + sudo apt-get install ca-certificates -y + sudo apt-get update -y + sudo apt-get install -y \ + clang \ + cmake \ + curl \ + gcc \ + git \ + g++ \ + libclang-10-dev \ + libclang-dev \ + libgtk-3-dev \ + llvm-10-dev \ + llvm-dev \ + nasm \ + ninja-build \ + pkg-config \ + wget \ + yasm - name: Install Rust toolchain uses: actions-rs/toolchain@v1 @@ -74,5 +90,5 @@ jobs: path: | ./src/bridge_generated.rs ./src/bridge_generated.io.rs - ./flutter/lib/generated_bridge.dart + ./flutter/lib/generated_bridge.dart ./flutter/lib/generated_bridge.freezed.dart diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 028df3860..080a0b743 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,12 @@ name: CI -# env: +env: # MIN_SUPPORTED_RUST_VERSION: "1.46.0" # CICD_INTERMEDIATES_DIR: "_cicd-intermediates" + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" + # vcpkg version: 2023.10.19 + # for multiarch gcc compatibility + VCPKG_COMMIT_ID: "8eb57355a4ffb410a2e94c07b4dca2dffbee8e50" on: workflow_dispatch: @@ -76,6 +80,13 @@ jobs: - { 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: Export GitHub Actions cache environment variables + uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + - name: Checkout source code uses: actions/checkout@v3 @@ -83,21 +94,43 @@ jobs: shell: bash 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 libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev;; + x86_64-unknown-linux-gnu) + sudo apt-get -y update + sudo apt-get install -y \ + clang \ + cmake \ + curl \ + gcc \ + git \ + g++ \ + libasound2-dev \ + libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev \ + libgtk-3-dev \ + libpulse-dev \ + libxcb-randr0-dev \ + libxcb-shape0-dev \ + libxcb-xfixes0-dev \ + libxdo-dev \ + libxfixes-dev \ + nasm \ + wget \ + yasm + ;; # 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: Restore from cache and install vcpkg - uses: lukka/run-vcpkg@v7 + - name: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 with: - setupOnly: true - vcpkgGitCommitId: '501db0f17ef6df184fcdbfbe0f87cde2313b6ab1' #2023.04.15 - + vcpkgDirectory: /opt/artifacts/vcpkg + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + - name: Install vcpkg dependencies run: | - $VCPKG_ROOT/vcpkg install libvpx libyuv opus aom - shell: bash + $VCPKG_ROOT/vcpkg install --x-install-root="$VCPKG_ROOT/installed" + shell: bash - name: Install Rust toolchain uses: actions-rs/toolchain@v1 @@ -118,7 +151,7 @@ jobs: rustc -V - uses: Swatinem/rust-cache@v1 - + - name: Build uses: actions-rs/cargo@v1 with: @@ -183,7 +216,7 @@ jobs: ;; esac; - echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS} + echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS} - name: Run tests uses: actions-rs/cargo@v1 diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml index 8b28f763a..d6493bf0e 100644 --- a/.github/workflows/flutter-build.yml +++ b/.github/workflows/flutter-build.yml @@ -1,4 +1,4 @@ -name: Build the flutter version of the RustDesk +name: Build the flutter version of the RustDesk on: workflow_call: @@ -16,14 +16,15 @@ env: FLUTTER_VERSION: "3.13.9" FLUTTER_RUST_BRIDGE_VERSION: "1.80.1" # for arm64 linux - FLUTTER_ELINUX_VERSION: "3.10.6" - FLUTTER_ELINUX_COMMIT_ID: "410b3ca42f2cd0c485edf517a1666652bab442d4" + FLUTTER_ELINUX_VERSION: "3.13.9" + FLUTTER_ELINUX_COMMIT_ID: "f4d4205893c16b0aa9cb6ba46b9f32b639d3b057" TAG_NAME: "${{ inputs.upload-tag }}" - # vcpkg version: 2023.04.15 + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" + # vcpkg version: 2023.10.19 # for multiarch gcc compatibility - VCPKG_COMMIT_ID: "501db0f17ef6df184fcdbfbe0f87cde2313b6ab1" + VCPKG_COMMIT_ID: "8eb57355a4ffb410a2e94c07b4dca2dffbee8e50" VERSION: "1.2.4" - NDK_VERSION: "r25c" + NDK_VERSION: "r26b" #signing keys env variable checks ANDROID_SIGNING_KEY: '${{ secrets.ANDROID_SIGNING_KEY }}' MACOS_P12_BASE64: '${{ secrets.MACOS_P12_BASE64 }}' @@ -45,6 +46,13 @@ jobs: - { target: x86_64-pc-windows-msvc, os: windows-2019, arch: x86_64 } # - { target: aarch64-pc-windows-msvc, os: windows-2019, arch: aarch64 } steps: + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + - name: Checkout source code uses: actions/checkout@v3 @@ -87,14 +95,18 @@ jobs: 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: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 + with: + vcpkgDirectory: C:\vcpkg + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + - name: Install vcpkg dependencies run: | - cd C:\ - git clone https://github.com/Kingtous/rustdesk_thirdpary_lib --depth=1 - + $VCPKG_ROOT/vcpkg install --triplet x64-windows-static --x-install-root="$VCPKG_ROOT/installed" + shell: bash + - name: Build rustdesk - env: - VCPKG_ROOT: C:\rustdesk_thirdpary_lib\vcpkg run: python3 .\build.py --portable --hwcodec --flutter --feature IddDriver - name: find Runner.res @@ -169,6 +181,13 @@ jobs: - { target: i686-pc-windows-msvc, os: windows-2019, arch: x86 } # - { target: aarch64-pc-windows-msvc, os: windows-2019 } steps: + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + - name: Checkout source code uses: actions/checkout@v3 @@ -189,22 +208,20 @@ jobs: with: prefix-key: ${{ matrix.job.os }}-sciter - - name: Restore from cache and install vcpkg - uses: lukka/run-vcpkg@v7 + - name: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 with: - setupOnly: true + vcpkgDirectory: C:\vcpkg vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} - name: Install vcpkg dependencies run: | - cd C:\ - git clone https://github.com/Kingtous/rustdesk_thirdpary_lib --depth=1 + $VCPKG_ROOT/vcpkg install --triplet x86-windows-static --x-install-root="$VCPKG_ROOT/installed" + shell: bash - name: Build rustdesk id: build shell: bash - env: - VCPKG_ROOT: C:\rustdesk_thirdpary_lib\vcpkg run: | python3 res/inline-sciter.py # Patch sciter x86 @@ -251,7 +268,7 @@ jobs: popd mkdir -p ./SignOutput mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}-sciter.exe - + - name: Sign rustdesk self-extracted file uses: GermanBluefox/code-sign-action@v7 with: @@ -285,17 +302,24 @@ jobs: arch: x86_64 } steps: + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + - name: Checkout source code uses: actions/checkout@v3 - name: Import the codesign cert if: env.MACOS_P12_BASE64 != null uses: apple-actions/import-codesign-certs@v1 - with: + with: p12-file-base64: ${{ secrets.MACOS_P12_BASE64 }} p12-password: ${{ secrets.MACOS_P12_PASSWORD }} keychain: rustdesk - + - name: Check sign and import sign key if: env.MACOS_P12_BASE64 != null run: | @@ -310,11 +334,11 @@ jobs: fileName: rustdesk.json fileDir: ${{ github.workspace }} encodedString: ${{ secrets.MACOS_NOTARIZE_JSON }} - + - name: Install rcodesign tool if: env.MACOS_P12_BASE64 != null shell: bash - run: | + run: | pushd /tmp wget https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.22.0/apple-codesign-0.22.0-macos-universal.tar.gz tar -zxvf apple-codesign-0.22.0-macos-universal.tar.gz @@ -350,15 +374,14 @@ jobs: 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 --c-output ./flutter/macos/Runner/bridge_generated.h - - name: Restore from cache and install vcpkg - uses: lukka/run-vcpkg@v7 + - name: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 with: - setupOnly: true vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} - name: Install vcpkg dependencies run: | - $VCPKG_ROOT/vcpkg install libvpx libyuv opus aom + $VCPKG_ROOT/vcpkg install --x-install-root="$VCPKG_ROOT/installed" - name: Show version information (Rust, cargo, Clang) shell: bash @@ -403,9 +426,6 @@ jobs: files: | rustdesk*-${{ matrix.job.arch }}.dmg - build-vcpkg-deps-linux: - uses: ./.github/workflows/vcpkg-deps-linux.yml - generate-bridge-linux: uses: ./.github/workflows/bridge.yml @@ -425,6 +445,13 @@ jobs: extra-build-features: "", } steps: + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + - name: Install dependencies run: | brew install nasm yasm @@ -436,11 +463,15 @@ jobs: channel: "stable" flutter-version: ${{ env.FLUTTER_VERSION }} - - name: Clone deps - shell: bash + - name: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 + with: + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + + - name: Install vcpkg dependencies run: | - pushd /opt - sudo git clone https://github.com/rustdesk-org/rustdesk_thirdparty_lib.git --depth=1 + $VCPKG_ROOT/vcpkg install --triplet arm64-ios --x-install-root="$VCPKG_ROOT/installed" + shell: bash - name: Restore bridge files uses: actions/download-artifact@master @@ -458,7 +489,7 @@ jobs: - uses: Swatinem/rust-cache@v2 with: - prefix-key: rustdesk-lib-cache + prefix-key: rustdesk-lib-cache-ios key: ${{ matrix.job.target }}-${{ matrix.job.extra-build-features }} - name: Install flutter rust bridge deps @@ -469,10 +500,8 @@ jobs: ~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart --c-output ./flutter/ios/Runner/bridge_generated.h - name: Build rustdesk lib - env: - VCPKG_ROOT: /opt/rustdesk_thirdparty_lib/vcpkg run: | - rustup target add ${{ matrix.job.target }} + rustup target add ${{ matrix.job.target }} cargo build --features flutter --release --target aarch64-apple-ios --lib - name: Build rustdesk @@ -482,7 +511,7 @@ jobs: # flutter build ipa --release --obfuscate --split-debug-info=./split-debug-info --no-codesign # for easy debugging flutter build ipa --release --no-codesign - + # - name: Upload Artifacts # # if: env.ANDROID_SIGNING_KEY != null && env.UPLOAD_ARTIFACT == 'true' # uses: actions/upload-artifact@master @@ -498,7 +527,6 @@ jobs: # tag_name: ${{ env.TAG_NAME }} # files: | # flutter/build/ios/ipa/*.ipa - build-rustdesk-android: needs: [generate-bridge-linux] @@ -523,10 +551,51 @@ jobs: openssl-arch: android-arm } steps: + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + - name: Install dependencies run: | - sudo apt update - sudo apt-get -qq install -y 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 libappindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libvdpau-dev libva-dev libpam0g-dev libclang-dev llvm-dev libclang-10-dev llvm-10-dev pkg-config tree g++ libc6-dev gcc-multilib g++-multilib openjdk-11-jdk-headless + sudo apt-get update + sudo apt-get install -y \ + clang \ + cmake \ + curl \ + gcc-multilib \ + git \ + g++ \ + g++-multilib \ + libappindicator3-dev \ + libasound2-dev \ + libc6-dev \ + libclang-10-dev \ + libclang-dev \ + libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev \ + libgtk-3-dev \ + libpam0g-dev \ + libpulse-dev \ + libva-dev \ + libvdpau-dev \ + libxcb-randr0-dev \ + libxcb-shape0-dev \ + libxcb-xfixes0-dev \ + libxdo-dev \ + libxfixes-dev \ + llvm-10-dev \ + llvm-dev \ + nasm \ + ninja-build \ + openjdk-11-jdk-headless \ + pkg-config \ + tree \ + wget \ + yasm + - name: Checkout source code uses: actions/checkout@v3 - name: Install flutter @@ -540,11 +609,23 @@ jobs: ndk-version: ${{ env.NDK_VERSION }} add-to-path: true - - name: Clone deps - shell: bash + - name: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 + with: + vcpkgDirectory: /opt/artifacts/vcpkg + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + + - name: Install vcpkg dependencies run: | - pushd /opt - git clone https://github.com/rustdesk-org/rustdesk_thirdparty_lib.git --depth=1 + case ${{ matrix.job.target }} in + aarch64-linux-android) + ./flutter/build_android_deps.sh arm64-v8a + ;; + armv7-linux-androideabi) + ./flutter/build_android_deps.sh armeabi-v7a + ;; + esac + shell: bash - name: Restore bridge files uses: actions/download-artifact@master @@ -561,16 +642,15 @@ jobs: - uses: Swatinem/rust-cache@v2 with: - prefix-key: rustdesk-lib-cache + prefix-key: rustdesk-lib-cache-android # TODO: drop '-android' part after caches are invalidated key: ${{ matrix.job.target }}-${{ matrix.job.extra-build-features }} - name: Build rustdesk lib env: ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }} - VCPKG_ROOT: /opt/rustdesk_thirdparty_lib/vcpkg run: | - rustup target add ${{ matrix.job.target }} + rustup target add ${{ matrix.job.target }} cargo install cargo-ndk --version ${{ env.CARGO_NDK_VERSION }} case ${{ matrix.job.target }} in aarch64-linux-android) @@ -596,7 +676,7 @@ jobs: case ${{ matrix.job.target }} in aarch64-linux-android) mkdir -p ./flutter/android/app/src/main/jniLibs/arm64-v8a - cp /opt/rustdesk_thirdparty_lib/android/app/src/main/jniLibs/arm64-v8a/*.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/ + cp ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/ cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/librustdesk.so # build flutter pushd flutter @@ -605,7 +685,7 @@ jobs: ;; armv7-linux-androideabi) mkdir -p ./flutter/android/app/src/main/jniLibs/armeabi-v7a - cp /opt/rustdesk_thirdparty_lib/android/app/src/main/jniLibs/armeabi-v7a/*.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/ + cp ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_shared.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/ cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/librustdesk.so # build flutter pushd flutter @@ -616,7 +696,7 @@ jobs: popd mkdir -p signed-apk; pushd signed-apk mv ../rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.apk . - + - uses: r0adkll/sign-android-release@v1 name: Sign app APK if: env.ANDROID_SIGNING_KEY != null @@ -657,7 +737,7 @@ jobs: signed-apk/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.apk build-rustdesk-lib-linux-amd64: - needs: [generate-bridge-linux, build-vcpkg-deps-linux] + needs: [generate-bridge-linux] name: build-rust-lib ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-features }}] runs-on: ${{ matrix.job.os }} strategy: @@ -690,13 +770,20 @@ jobs: } # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } steps: + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + - name: Maximize build space run: | sudo rm -rf /opt/ghc sudo rm -rf /usr/local/lib/android sudo rm -rf /usr/share/dotnet - sudo apt update -y - sudo apt install qemu-user-static -y + sudo apt-get update -y + sudo apt-get install -y nasm qemu-user-static yasm - name: Checkout source code uses: actions/checkout@v3 @@ -718,7 +805,7 @@ jobs: target: ${{ matrix.job.target }} override: true profile: minimal # minimal component installation (ie, no documentation) - + - name: Save Rust toolchain version run: | RUST_TOOLCHAIN_VERSION=$(cargo --version | awk '{print $2}') @@ -735,11 +822,16 @@ jobs: name: bridge-artifact path: ./ - - name: Restore vcpkg files - uses: actions/download-artifact@master + - name: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 with: - name: vcpkg-artifact-${{ matrix.job.arch }} - path: /opt/artifacts/vcpkg/installed + vcpkgDirectory: /opt/artifacts/vcpkg + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + + - name: Install vcpkg dependencies + run: | + $VCPKG_ROOT/vcpkg install --x-install-root="$VCPKG_ROOT/installed" + shell: bash - uses: rustdesk-org/run-on-arch-action@amd64-support name: Build rustdesk library for ${{ matrix.job.arch }} @@ -758,11 +850,41 @@ jobs: --volume "/opt/artifacts:/opt/artifacts" shell: /bin/bash install: | - apt update -y + apt-get update -y echo -e "installing deps" - apt-get -qq install -y 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 libappindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libvdpau-dev libva-dev libpam0g-dev libclang-dev llvm-dev libclang-10-dev llvm-10-dev pkg-config tree g++ gcc libvpx-dev tree > /dev/null + apt-get install -y \ + clang \ + cmake \ + curl \ + gcc \ + git \ + g++ \ + libappindicator3-dev \ + libasound2-dev \ + libclang-10-dev \ + libclang-dev \ + libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev \ + libgtk-3-dev \ + libpam0g-dev \ + libpulse-dev \ + libva-dev \ + libvdpau-dev \ + libxcb-randr0-dev \ + libxcb-shape0-dev \ + libxcb-xfixes0-dev \ + libxdo-dev \ + libxfixes-dev \ + llvm-10-dev \ + llvm-dev \ + nasm \ + ninja-build \ + pkg-config \ + tree \ + wget \ + yasm # we have libopus compiled by us. - apt remove -y libopus-dev || true + apt-get remove -y libopus-dev || true # output devs ls -l ./ tree -L 3 /opt/artifacts/vcpkg/installed @@ -806,7 +928,7 @@ jobs: build-rustdesk-lib-linux-arm: if: ${{ inputs.upload-artifact }} - needs: [generate-bridge-linux, build-vcpkg-deps-linux] + needs: [generate-bridge-linux] name: build-rust-lib ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-features }}] runs-on: [self-hosted, Linux, ARM64] strategy: @@ -841,13 +963,29 @@ jobs: # - { arch: armv7, target: armv7-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" } # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } steps: + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + crossbuild-essential-arm64 \ + nasm \ + pkg-config \ + yasm + #- name: Maximize build space # run: | # sudo rm -rf /opt/ghc # sudo rm -rf /usr/local/lib/android # sudo rm -rf /usr/share/dotnet - # sudo apt update -y - # sudo apt install qemu-user-static -y + # sudo apt-get update -y + # sudo apt-get install qemu-user-static -y - name: Checkout source code uses: actions/checkout@v3 @@ -869,7 +1007,7 @@ jobs: target: ${{ matrix.job.target }} override: true profile: minimal # minimal component installation (ie, no documentation) - + - name: Save Rust toolchain version run: | RUST_TOOLCHAIN_VERSION=$(cargo --version | awk '{print $2}') @@ -886,11 +1024,23 @@ jobs: name: bridge-artifact path: ./ - - name: Restore vcpkg files - uses: actions/download-artifact@master + - name: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 with: - name: vcpkg-artifact-${{ matrix.job.arch }} - path: /opt/artifacts/vcpkg/installed + vcpkgDirectory: /opt/artifacts/vcpkg + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + + - name: Install vcpkg dependencies + run: | + case ${{ matrix.job.target }} in + aarch64-unknown-linux-gnu) + $VCPKG_ROOT/vcpkg install --triplet arm64-linux --x-install-root="$VCPKG_ROOT/installed" + ;; + armv7-unknown-linux-gnueabihf) + $VCPKG_ROOT/vcpkg install --triplet arm-linux --x-install-root="$VCPKG_ROOT/installed" + ;; + esac + shell: bash - uses: rustdesk-org/run-on-arch-action@amd64-support name: Build rustdesk library for ${{ matrix.job.arch }} @@ -907,11 +1057,41 @@ jobs: --volume "/opt/artifacts:/opt/artifacts" shell: /bin/bash install: | - apt update -y + apt-get update -y echo -e "installing deps" - apt-get -qq install -y 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 libappindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libvdpau-dev libva-dev libpam0g-dev libclang-dev llvm-dev libclang-10-dev llvm-10-dev pkg-config tree g++ gcc libvpx-dev tree > /dev/null + apt-get install -y \ + clang \ + cmake \ + curl \ + gcc \ + git \ + g++ \ + libappindicator3-dev \ + libasound2-dev \ + libclang-10-dev \ + libclang-dev \ + libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev \ + libgtk-3-dev \ + libpam0g-dev \ + libpulse-dev \ + libva-dev \ + libvdpau-dev \ + libxcb-randr0-dev \ + libxcb-shape0-dev \ + libxcb-xfixes0-dev \ + libxdo-dev \ + libxfixes-dev \ + llvm-10-dev \ + llvm-dev \ + nasm \ + ninja-build \ + pkg-config \ + tree \ + wget \ + yasm # we have libopus compiled by us. - apt remove -y libopus-dev || true + apt-get remove -y libopus-dev || true # output devs ls -l ./ tree -L 3 /opt/artifacts/vcpkg/installed @@ -950,7 +1130,6 @@ jobs: build-rustdesk-sciter-arm: if: ${{ inputs.upload-artifact }} - needs: [build-vcpkg-deps-linux] name: build-rustdesk(sciter) ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-features }}] runs-on: [self-hosted, Linux, ARM64] strategy: @@ -970,14 +1149,29 @@ jobs: # - { arch: armv7, target: armv7-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" } # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } steps: + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + crossbuild-essential-armhf \ + nasm \ + pkg-config \ + yasm #- name: Maximize build space # run: | # sudo rm -rf /opt/ghc # sudo rm -rf /usr/local/lib/android # sudo rm -rf /usr/share/dotnet - # sudo apt update -y - # sudo apt install qemu-user-static -y + # sudo apt-get update -y + # sudo apt-get install qemu-user-static -y - name: Checkout source code uses: actions/checkout@v3 @@ -999,17 +1193,22 @@ jobs: target: ${{ matrix.job.target }} override: true profile: minimal # minimal component installation (ie, no documentation) - + - name: Save Rust toolchain version run: | RUST_TOOLCHAIN_VERSION=$(cargo --version | awk '{print $2}') echo "RUST_TOOLCHAIN_VERSION=$RUST_TOOLCHAIN_VERSION" >> $GITHUB_ENV - - name: Restore vcpkg files - uses: actions/download-artifact@master + - name: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 with: - name: vcpkg-artifact-${{ matrix.job.arch }} - path: /opt/artifacts/vcpkg/installed + vcpkgDirectory: /opt/artifacts/vcpkg + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + + - name: Install vcpkg dependencies + run: | + $VCPKG_ROOT/vcpkg install --triplet arm-linux --x-install-root="$VCPKG_ROOT/installed" + shell: bash - uses: rustdesk-org/run-on-arch-action@amd64-support name: Build rustdesk sciter binary for ${{ matrix.job.arch }} @@ -1025,10 +1224,42 @@ jobs: --volume "/opt/artifacts:/opt/artifacts" shell: /bin/bash install: | - apt update -y - apt-get -qq install -y git cmake g++ gcc build-essential nasm yasm curl unzip xz-utils python3 wget pkg-config ninja-build pkg-config libgtk-3-dev liblzma-dev clang libappindicator3-dev rpm libclang-dev - apt-get -qq install -y libdbus-1-dev pkg-config nasm yasm libglib2.0-dev libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev - apt-get -qq install -y libpulse-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libvpx-dev libvdpau-dev libva-dev libpam0g-dev + apt-get update -y + apt-get install -y \ + build-essential \ + clang \ + cmake \ + curl \ + gcc \ + git \ + g++ \ + libappindicator3-dev \ + libasound2-dev \ + libclang-dev \ + libdbus-1-dev \ + libglib2.0-dev \ + libgstreamer1.0-dev \ + libgstreamer-plugins-base1.0-dev \ + libgtk-3-dev \ + liblzma-dev \ + libpam0g-dev \ + libpulse-dev \ + libva-dev \ + libvdpau-dev \ + libxcb-randr0-dev \ + libxcb-shape0-dev \ + libxcb-xfixes0-dev \ + libxdo-dev \ + libxfixes-dev \ + nasm \ + ninja-build \ + pkg-config \ + python3 \ + rpm \ + unzip \ + wget \ + xz-utils \ + yasm run: | # disable git safe.directory git config --global --add safe.directory "*" @@ -1046,7 +1277,7 @@ jobs: registry = 'https://github.com/rust-lang/crates.io-index' """ > ~/.cargo/config cat ~/.cargo/config - + # build pushd /workspace python3 ./res/inline-sciter.py @@ -1133,8 +1364,15 @@ jobs: - name: Prepare env run: | - sudo apt update -y - sudo apt-get -qq install -y git curl wget nasm yasm libgtk-3-dev libarchive-tools + sudo apt-get update -y + sudo apt-get install -y \ + curl \ + git \ + libarchive-tools \ + libgtk-3-dev \ + nasm \ + wget \ + yasm mkdir -p ./target/release/ - name: Restore the rustdesk lib file @@ -1153,7 +1391,7 @@ jobs: git clone https://github.com/sony/flutter-elinux.git || true pushd flutter-elinux git fetch - git reset --hard ${{ env.FLUTTER_ELINUX_COMMIT_ID }} + git reset --hard ${{ env.FLUTTER_ELINUX_COMMIT_ID }} popd - uses: rustdesk-org/run-on-arch-action@amd64-support @@ -1171,8 +1409,27 @@ jobs: --volume "/opt/flutter-elinux:/opt/flutter-elinux" shell: /bin/bash install: | - apt update -y - apt-get -qq install -y git cmake g++ gcc build-essential nasm yasm curl unzip xz-utils python3 wget pkg-config ninja-build pkg-config libgtk-3-dev liblzma-dev clang libappindicator3-dev rpm + apt-get update -y + apt-get install -y \ + build-essential \ + clang \ + cmake \ + curl \ + gcc \ + git \ + g++ \ + libappindicator3-dev \ + libgtk-3-dev \ + liblzma-dev \ + nasm \ + ninja-build \ + pkg-config \ + python3 \ + rpm \ + unzip \ + wget \ + xz-utils \ + yasm run: | # disable git safe.directory git config --global --add safe.directory "*" @@ -1218,7 +1475,7 @@ jobs: pushd ~/rpmbuild/RPMS/${{ matrix.job.arch }} mkdir -p /opt/artifacts/rpm for name in rustdesk*??.rpm; do - mv "$name" "/opt/artifacts/rpm/${name%%.rpm}.rpm" + mv "$name" "/opt/artifacts/rpm/${name%%.rpm}.rpm" done # rpm suse package echo -e "start packaging suse package" @@ -1236,7 +1493,7 @@ jobs: pushd ~/rpmbuild/RPMS/${{ matrix.job.arch }} mkdir -p /opt/artifacts/rpm for name in rustdesk*??.rpm; do - mv "$name" "/opt/artifacts/rpm/${name%%.rpm}-suse.rpm" + mv "$name" "/opt/artifacts/rpm/${name%%.rpm}-suse.rpm" done - name: Rename rustdesk @@ -1254,7 +1511,7 @@ jobs: tag_name: ${{ env.TAG_NAME }} files: | rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.deb - + - name: Build appimage package if: ${{ matrix.job.extra-build-features == 'appimage' }} shell: bash @@ -1365,7 +1622,7 @@ jobs: - { arch: x86_64, target: x86_64-unknown-linux-gnu, - os: ubuntu-18.04, + os: ubuntu-18.04, extra-build-features: "", } - { @@ -1393,8 +1650,15 @@ jobs: - name: Prepare env run: | - sudo apt update -y - sudo apt-get -qq install -y git curl wget nasm yasm libgtk-3-dev libarchive-tools + sudo apt-get update -y + sudo apt-get install -y \ + curl \ + git \ + libarchive-tools \ + libgtk-3-dev \ + nasm \ + wget \ + yasm mkdir -p ./target/release/ - name: Restore the rustdesk lib file @@ -1417,8 +1681,27 @@ jobs: --volume "/opt/artifacts:/opt/artifacts" shell: /bin/bash install: | - apt update -y - apt-get -qq install -y git cmake g++ gcc build-essential nasm yasm curl unzip xz-utils python3 wget pkg-config ninja-build pkg-config libgtk-3-dev liblzma-dev clang libappindicator3-dev rpm + apt-get update -y + apt-get install -y \ + build-essential \ + clang \ + cmake \ + curl \ + gcc \ + git \ + g++ \ + libappindicator3-dev \ + libgtk-3-dev \ + liblzma-dev \ + nasm \ + ninja-build \ + pkg-config \ + python3 \ + rpm \ + unzip \ + wget \ + xz-utils \ + yasm run: | # disable git safe.directory git config --global --add safe.directory "*" @@ -1442,7 +1725,7 @@ jobs: pushd ~/rpmbuild/RPMS/${{ matrix.job.arch }} mkdir -p /opt/artifacts/rpm for name in rustdesk*??.rpm; do - mv "$name" "/opt/artifacts/rpm/${name%%.rpm}.rpm" + mv "$name" "/opt/artifacts/rpm/${name%%.rpm}.rpm" done # rpm suse package pushd /workspace @@ -1455,7 +1738,7 @@ jobs: pushd ~/rpmbuild/RPMS/${{ matrix.job.arch }} mkdir -p /opt/artifacts/rpm for name in rustdesk*??.rpm; do - mv "$name" "/opt/artifacts/rpm/${name%%.rpm}-suse.rpm" + mv "$name" "/opt/artifacts/rpm/${name%%.rpm}-suse.rpm" done - name: Rename rustdesk @@ -1605,13 +1888,24 @@ jobs: # --volume "${PWD}:/workspace" # shell: /bin/bash # install: | - # apt update -y - # apt install -y rpm + # apt-get update -y + # apt-get install -y rpm # run: | # pushd /workspace # # install - # apt update -y - # apt install -y flatpak flatpak-builder cmake g++ gcc git curl wget nasm yasm libgtk-3-dev git + # apt-get update -y + # apt-get install -y \ + # cmake \ + # curl \ + # flatpak \ + # flatpak-builder \ + # gcc \ + # git \ + # g++ \ + # libgtk-3-dev \ + # nasm \ + # wget \ + # yasm # # flatpak deps # flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo # flatpak --user install -y flathub org.freedesktop.Platform/${{ matrix.job.arch }}/23.08 @@ -1666,15 +1960,30 @@ jobs: --volume "${PWD}:/workspace" shell: /bin/bash install: | - apt update -y - apt install -y rpm git wget curl + apt-get update -y + apt-get install -y \ + curl \ + git \ + rpm \ + wget run: | # disable git safe.directory git config --global --add safe.directory "*" pushd /workspace # install - apt update -y - apt install -y flatpak flatpak-builder cmake g++ gcc git curl wget nasm yasm libgtk-3-dev git + apt-get update -y + apt-get install -y \ + cmake \ + curl \ + flatpak \ + flatpak-builder \ + gcc \ + git \ + g++ \ + libgtk-3-dev \ + nasm \ + wget \ + yasm # flatpak deps flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak --user install -y flathub org.freedesktop.Platform/${{ matrix.job.arch }}/23.08 diff --git a/.github/workflows/flutter-ci.yml b/.github/workflows/flutter-ci.yml index 6dab5f7d4..5a1608c69 100644 --- a/.github/workflows/flutter-ci.yml +++ b/.github/workflows/flutter-ci.yml @@ -19,4 +19,3 @@ jobs: uses: ./.github/workflows/flutter-build.yml with: upload-artifact: false - diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index 67dc14ae9..b16db4c4a 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -12,4 +12,4 @@ jobs: secrets: inherit with: upload-artifact: true - upload-tag: "nightly" + upload-tag: "nightly" diff --git a/.github/workflows/flutter-tag.yml b/.github/workflows/flutter-tag.yml index 20083a3f9..df1b52495 100644 --- a/.github/workflows/flutter-tag.yml +++ b/.github/workflows/flutter-tag.yml @@ -15,4 +15,4 @@ jobs: secrets: inherit with: upload-artifact: true - upload-tag: "1.2.4" + upload-tag: "1.2.4" diff --git a/.github/workflows/history.yml b/.github/workflows/history.yml index c40641fcd..d1991977d 100644 --- a/.github/workflows/history.yml +++ b/.github/workflows/history.yml @@ -7,9 +7,7 @@ env: FLUTTER_VERSION: "3.13.9" TAG_NAME: "tmp" FLUTTER_RUST_BRIDGE_VERSION: "1.80.1" - # vcpkg version: 2022.05.10 - # for multiarch gcc compatibility - VCPKG_COMMIT_ID: "501db0f17ef6df184fcdbfbe0f87cde2313b6ab1" + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" VERSION: "1.2.4" jobs: @@ -54,14 +52,18 @@ jobs: 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: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 + with: + vcpkgDirectory: C:\vcpkg + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + - name: Install vcpkg dependencies run: | - cd C:\ - git clone https://github.com/Kingtous/rustdesk_thirdpary_lib --depth=1 - + $VCPKG_ROOT/vcpkg install --x-install-root="$VCPKG_ROOT/installed" + shell: bash + - name: Build rustdesk - env: - VCPKG_ROOT: C:\rustdesk_thirdpary_lib\vcpkg run: python3 .\build.py --portable --hwcodec --flutter --feature IddDriver - name: Build self-extracted executable @@ -72,7 +74,7 @@ jobs: popd mkdir -p ./SignOutput mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ matrix.job.date }}-${{ matrix.job.target }}.exe - + - name: Publish Release uses: softprops/action-gh-release@v1 with: diff --git a/.github/workflows/vcpkg-deps-linux.yml b/.github/workflows/vcpkg-deps-linux.yml deleted file mode 100644 index 9801764e4..000000000 --- a/.github/workflows/vcpkg-deps-linux.yml +++ /dev/null @@ -1,92 +0,0 @@ -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: rustdesk-org/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) - apt update -y - apt install -y curl zip unzip tar git g++ gcc build-essential pkg-config wget nasm yasm ninja-build libjpeg8-dev libssl-dev - wget https://github.com/Kitware/CMake/releases/download/v3.27.5/cmake-3.27.5.tar.gz - apt remove -y --purge cmake - tar -zxvf cmake-3.27.5.tar.gz - cd cmake-3.27.5 - ./bootstrap - make - make install - cd - - cmake --version - gcc -v - ;; - aarch64|armv7) - apt install -y curl zip unzip git - esac - 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 aom - ;; - aarch64) - pushd /artifacts - rm -rf rustdesk_thirdparty_lib - git clone https://github.com/Kingtous/rustdesk_thirdparty_lib.git --depth=1 - mkdir -p /artifacts/vcpkg/installed - mv ./rustdesk_thirdparty_lib/vcpkg/installed/arm64-linux /artifacts/vcpkg/installed/arm64-linux - ;; - armv7) - pushd /artifacts - rm -rf rustdesk_thirdparty_lib - git clone https://github.com/Kingtous/rustdesk_thirdparty_lib.git --depth=1 - mkdir -p /artifacts/vcpkg/installed - mv ./rustdesk_thirdparty_lib/vcpkg/installed/arm-linux /artifacts/vcpkg/installed/arm-linux - ;; - esac - - name: Upload artifacts - uses: actions/upload-artifact@master - with: - name: vcpkg-artifact-${{ matrix.job.arch }} - path: | - /opt/artifacts/vcpkg/installed