From 90d95f796d5f5dafaf626974b64c522ef787f58a Mon Sep 17 00:00:00 2001 From: Matthias Weiss Date: Tue, 10 Dec 2024 15:02:42 +0100 Subject: [PATCH 1/4] Dummy commit --- .github/workflows/flutter-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml index 5b85236159a8..c48023850896 100644 --- a/.github/workflows/flutter-build.yml +++ b/.github/workflows/flutter-build.yml @@ -2049,6 +2049,8 @@ jobs: files: | flatpak/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}${{ matrix.job.suffix }}.flatpak +# super important comment + build-rustdesk-web: if: False name: build-rustdesk-web From f317243edec37c802a49dcc94f8ade79d1dd4955 Mon Sep 17 00:00:00 2001 From: Matthias Weiss Date: Wed, 11 Dec 2024 10:10:30 +0100 Subject: [PATCH 2/4] Try upgrading Rust version --- .github/workflows/bridge.yml | 2 +- .github/workflows/flutter-build.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bridge.yml b/.github/workflows/bridge.yml index 1c0fec8d21f9..9dd593f3437d 100644 --- a/.github/workflows/bridge.yml +++ b/.github/workflows/bridge.yml @@ -8,7 +8,7 @@ on: env: FLUTTER_VERSION: "3.22.3" FLUTTER_RUST_BRIDGE_VERSION: "1.80.1" - RUST_VERSION: "1.75" # https://github.com/rustdesk/rustdesk/discussions/7503 + RUST_VERSION: "1.83" jobs: generate_bridge: diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml index c48023850896..1774ea504be9 100644 --- a/.github/workflows/flutter-build.yml +++ b/.github/workflows/flutter-build.yml @@ -18,9 +18,9 @@ on: # in this file! env: - SCITER_RUST_VERSION: "1.75" # https://github.com/rustdesk/rustdesk/discussions/7503, also 1.78 has ABI change which causes our sciter version not working, https://blog.rust-lang.org/2024/03/30/i128-layout-update.html - RUST_VERSION: "1.75" # sciter failed on m1 with 1.78 because of https://blog.rust-lang.org/2024/03/30/i128-layout-update.html - MAC_RUST_VERSION: "1.81" # 1.81 is requred for macos, because of https://github.com/yury/cidre requires 1.81 + SCITER_RUST_VERSION: "1.83" # https://github.com/rustdesk/rustdesk/discussions/7503, also 1.78 has ABI change which causes our sciter version not working, https://blog.rust-lang.org/2024/03/30/i128-layout-update.html + RUST_VERSION: "1.83" + # MAC_RUST_VERSION: "1.81" # 1.81 is requred for macos, because of https://github.com/yury/cidre requires 1.81 CARGO_NDK_VERSION: "3.1.2" SCITER_ARMV7_CMAKE_VERSION: "3.29.7" SCITER_NASM_DEBVERSION: "2.14-1" From deb2d6a86f627e9e26d82cd8c21a14d8e49d6a16 Mon Sep 17 00:00:00 2001 From: Matthias Weiss Date: Wed, 11 Dec 2024 10:59:19 +0100 Subject: [PATCH 3/4] Disable ARM build --- .github/workflows/flutter-build.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml index 1774ea504be9..743fe269a4e9 100644 --- a/.github/workflows/flutter-build.yml +++ b/.github/workflows/flutter-build.yml @@ -1369,14 +1369,14 @@ jobs: deb_arch: amd64, vcpkg-triplet: x64-linux, } - - { - arch: aarch64, - target: aarch64-unknown-linux-gnu, - distro: ubuntu18.04, - on: [self-hosted, Linux, ARM64], - deb_arch: arm64, - vcpkg-triplet: arm64-linux, - } + # - { + # arch: aarch64, + # target: aarch64-unknown-linux-gnu, + # distro: ubuntu18.04, + # on: [self-hosted, Linux, ARM64], + # deb_arch: arm64, + # vcpkg-triplet: arm64-linux, + # } steps: - name: Export GitHub Actions cache environment variables uses: actions/github-script@v6 From facc94d4394db56a65bd0e487ee07203f518da2d Mon Sep 17 00:00:00 2001 From: Matthias Weiss Date: Wed, 11 Dec 2024 15:21:50 +0100 Subject: [PATCH 4/4] Restore Pipelines to Origin --- .github/workflows/bridge.yml | 4 +- .github/workflows/flutter-build.yml | 1592 ++++++++--------- .github/workflows/playground.yml | 416 +++++ .../third-party-RustDeskTempTopMostWindow.yml | 60 + 4 files changed, 1273 insertions(+), 799 deletions(-) create mode 100644 .github/workflows/playground.yml create mode 100644 .github/workflows/third-party-RustDeskTempTopMostWindow.yml diff --git a/.github/workflows/bridge.yml b/.github/workflows/bridge.yml index 9dd593f3437d..9d56fbe6f2b5 100644 --- a/.github/workflows/bridge.yml +++ b/.github/workflows/bridge.yml @@ -8,7 +8,7 @@ on: env: FLUTTER_VERSION: "3.22.3" FLUTTER_RUST_BRIDGE_VERSION: "1.80.1" - RUST_VERSION: "1.83" + RUST_VERSION: "1.75" # https://github.com/rustdesk/rustdesk/discussions/7503 jobs: generate_bridge: @@ -73,7 +73,7 @@ jobs: - name: Install flutter rust bridge deps shell: bash run: | - cargo install flutter_rust_bridge_codegen --version ${{ env.FLUTTER_RUST_BRIDGE_VERSION }} --features "uuid" + cargo install flutter_rust_bridge_codegen --version ${{ env.FLUTTER_RUST_BRIDGE_VERSION }} --features "uuid" --locked pushd flutter && sed -i -e 's/extended_text: 14.0.0/extended_text: 13.0.0/g' pubspec.yaml && flutter pub get && popd - name: Run flutter rust bridge diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml index 743fe269a4e9..9ec7d9e012d4 100644 --- a/.github/workflows/flutter-build.yml +++ b/.github/workflows/flutter-build.yml @@ -18,9 +18,9 @@ on: # in this file! env: - SCITER_RUST_VERSION: "1.83" # https://github.com/rustdesk/rustdesk/discussions/7503, also 1.78 has ABI change which causes our sciter version not working, https://blog.rust-lang.org/2024/03/30/i128-layout-update.html - RUST_VERSION: "1.83" - # MAC_RUST_VERSION: "1.81" # 1.81 is requred for macos, because of https://github.com/yury/cidre requires 1.81 + SCITER_RUST_VERSION: "1.75" # https://github.com/rustdesk/rustdesk/discussions/7503, also 1.78 has ABI change which causes our sciter version not working, https://blog.rust-lang.org/2024/03/30/i128-layout-update.html + RUST_VERSION: "1.75" # sciter failed on m1 with 1.78 because of https://blog.rust-lang.org/2024/03/30/i128-layout-update.html + MAC_RUST_VERSION: "1.81" # 1.81 is requred for macos, because of https://github.com/yury/cidre requires 1.81 CARGO_NDK_VERSION: "3.1.2" SCITER_ARMV7_CMAKE_VERSION: "3.29.7" SCITER_NASM_DEBVERSION: "2.14-1" @@ -49,511 +49,511 @@ jobs: generate-bridge: uses: ./.github/workflows/bridge.yml - # build-RustDeskTempTopMostWindow: - # uses: ./.github/workflows/third-party-RustDeskTempTopMostWindow.yml - # with: - # upload-artifact: ${{ inputs.upload-artifact }} - # target: windows-2022 - # configuration: Release - # platform: x64 - # target_version: Windows10 - # strategy: - # fail-fast: false - - # build-for-windows-flutter: - # name: ${{ matrix.job.target }} - # needs: [build-RustDeskTempTopMostWindow, generate-bridge] - # runs-on: ${{ matrix.job.os }} - # strategy: - # fail-fast: false - # matrix: - # job: - # # - { target: i686-pc-windows-msvc , os: windows-2022 } - # # - { target: x86_64-pc-windows-gnu , os: windows-2022 } - # - { - # target: x86_64-pc-windows-msvc, - # os: windows-2022, - # arch: x86_64, - # vcpkg-triplet: x64-windows-static, - # } - # # - { target: aarch64-pc-windows-msvc, os: windows-2022, 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@v4 - - # - name: Restore bridge files - # uses: actions/download-artifact@master - # with: - # name: bridge-artifact - # path: ./ - - # - name: Install LLVM and Clang - # uses: KyleMayes/install-llvm-action@v1 - # with: - # version: ${{ env.LLVM_VERSION }} - - # - name: Install flutter - # uses: subosito/flutter-action@v2.12.0 #https://github.com/subosito/flutter-action/issues/277 - # with: - # channel: "stable" - # flutter-version: ${{ env.FLUTTER_VERSION }} - - # # https://github.com/flutter/flutter/issues/155685 - # - name: Replace engine with rustdesk custom flutter engine - # run: | - # flutter doctor -v - # flutter precache --windows - # Invoke-WebRequest -Uri https://github.com/rustdesk/engine/releases/download/main/windows-x64-release.zip -OutFile windows-x64-release.zip - # Expand-Archive -Path windows-x64-release.zip -DestinationPath windows-x64-release - # mv -Force windows-x64-release/*  C:/hostedtoolcache/windows/flutter/stable-${{ env.FLUTTER_VERSION }}-x64/bin/cache/artifacts/engine/windows-x64-release/ - - # - name: Patch flutter - # shell: bash - # run: | - # cp .github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff $(dirname $(dirname $(which flutter))) - # cd $(dirname $(dirname $(which flutter))) - # [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply flutter_3.24.4_dropdown_menu_enableFilter.diff - - # - name: Install Rust toolchain - # uses: dtolnay/rust-toolchain@v1 - # with: - # toolchain: ${{ env.SCITER_RUST_VERSION }} - # targets: ${{ matrix.job.target }} - # components: "rustfmt" - - # - uses: Swatinem/rust-cache@v2 - # with: - # prefix-key: ${{ matrix.job.os }} - - # - name: Setup vcpkg with Github Actions binary cache - # uses: lukka/run-vcpkg@v11 - # with: - # vcpkgDirectory: C:\vcpkg - # vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} - # doNotCache: false - - # - name: Install vcpkg dependencies - # env: - # VCPKG_DEFAULT_HOST_TRIPLET: ${{ matrix.job.vcpkg-triplet }} - # run: | - # if ! $VCPKG_ROOT/vcpkg \ - # install \ - # --triplet ${{ matrix.job.vcpkg-triplet }} \ - # --x-install-root="$VCPKG_ROOT/installed"; then - # find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do - # echo "$_1:" - # echo "======" - # cat "$_1" - # echo "======" - # echo "" - # done - # exit 1 - # fi - # head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true - # shell: bash - - # - name: Build rustdesk - # run: | - # Invoke-WebRequest -Uri https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip -OutFile usbmmidd_v2.zip - # Expand-Archive usbmmidd_v2.zip -DestinationPath . - # python3 .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack - # Remove-Item -Path usbmmidd_v2\Win32 -Recurse - # Remove-Item -Path "usbmmidd_v2\deviceinstaller64.exe", "usbmmidd_v2\deviceinstaller.exe", "usbmmidd_v2\usbmmidd.bat" - # mv ./flutter/build/windows/x64/runner/Release ./rustdesk - # mv -Force .\usbmmidd_v2 ./rustdesk - - # - name: find Runner.res - # # Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res - # # Runner.rc does not contain actual version, but Runner.res does - # continue-on-error: true - # shell: bash - # run: | - # runner_res=$(find . -name "Runner.res"); - # if [ "$runner_res" == "" ]; then - # echo "Runner.res: not found"; - # else - # echo "Runner.res: $runner_res"; - # cp $runner_res ./libs/portable/Runner.res; - # echo "list ./libs/portable/Runner.res"; - # ls -l ./libs/portable/Runner.res; - # fi - - # - name: Download RustDeskTempTopMostWindow artifacts - # uses: actions/download-artifact@master - # if: ${{ inputs.upload-artifact }} - # with: - # name: topmostwindow-artifacts - # path: "./rustdesk" - - # - name: Upload unsigned - # if: env.UPLOAD_ARTIFACT == 'true' - # uses: actions/upload-artifact@master - # with: - # name: rustdesk-unsigned-windows-${{ matrix.job.arch }} - # path: rustdesk - - # - name: Sign rustdesk files - # if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != '' - # shell: bash - # run: | - # pip3 install requests argparse - # BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./rustdesk/ - - # - name: Build self-extracted executable - # shell: bash - # if: env.UPLOAD_ARTIFACT == 'true' - # run: | - # sed -i '/dpiAware/d' res/manifest.xml - # pushd ./libs/portable - # pip3 install -r requirements.txt - # python3 ./generate.py -f ../../rustdesk/ -o . -e ../../rustdesk/rustdesk.exe - # popd - # mkdir -p ./SignOutput - # mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.exe - - # - name: Add MSBuild to PATH - # uses: microsoft/setup-msbuild@v2 - - # - name: Build msi - # if: env.UPLOAD_ARTIFACT == 'true' - # run: | - # pushd ./res/msi - # python preprocess.py --arp -d ../../rustdesk - # nuget restore msi.sln - # msbuild msi.sln -p:Configuration=Release -p:Platform=x64 /p:TargetVersion=Windows10 - # mv ./Package/bin/x64/Release/en-us/Package.msi ../../SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.msi - # sha256sum ../../SignOutput/rustdesk-*.msi - - # - name: Sign rustdesk self-extracted file - # if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != '' - # shell: bash - # run: | - # BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./SignOutput - - # - name: Publish Release - # uses: softprops/action-gh-release@v1 - # if: env.UPLOAD_ARTIFACT == 'true' - # with: - # prerelease: true - # tag_name: ${{ env.TAG_NAME }} - # files: | - # ./SignOutput/rustdesk-*.msi - # ./SignOutput/rustdesk-*.exe - - # # The fallback for the flutter version, we use Sciter for 32bit Windows. - # build-for-windows-sciter: - # name: ${{ matrix.job.target }} (${{ matrix.job.os }}) - # runs-on: ${{ matrix.job.os }} - # # Temporarily disable this action due to additional test is needed. - # # if: false - # strategy: - # fail-fast: false - # matrix: - # job: - # # - { target: i686-pc-windows-msvc , os: windows-2022 } - # # - { target: x86_64-pc-windows-gnu , os: windows-2022 } - # - { - # target: i686-pc-windows-msvc, - # os: windows-2022, - # arch: x86, - # vcpkg-triplet: x86-windows-static, - # } - # # - { target: aarch64-pc-windows-msvc, os: windows-2022 } - # 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@v4 - - # - name: Install LLVM and Clang - # uses: rustdesk-org/install-llvm-action-32bit@master - # with: - # version: ${{ env.LLVM_VERSION }} - - # - name: Install Rust toolchain - # uses: dtolnay/rust-toolchain@v1 - # with: - # toolchain: nightly-2023-10-13-${{ matrix.job.target }} # must use nightly here, because of abi_thiscall feature required - # targets: ${{ matrix.job.target }} - # components: "rustfmt" - - # - uses: Swatinem/rust-cache@v2 - # with: - # prefix-key: ${{ matrix.job.os }}-sciter - - # - name: Setup vcpkg with Github Actions binary cache - # uses: lukka/run-vcpkg@v11 - # with: - # vcpkgDirectory: C:\vcpkg - # vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} - # doNotCache: false - - # - name: Install vcpkg dependencies - # env: - # VCPKG_DEFAULT_HOST_TRIPLET: ${{ matrix.job.vcpkg-triplet }} - # run: | - # if ! $VCPKG_ROOT/vcpkg \ - # install \ - # --triplet ${{ matrix.job.vcpkg-triplet }} \ - # --x-install-root="$VCPKG_ROOT/installed"; then - # find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do - # echo "$_1:" - # echo "======" - # cat "$_1" - # echo "======" - # echo "" - # done - # exit 1 - # fi - # head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true - # shell: bash - - # - name: Build rustdesk - # id: build - # shell: bash - # run: | - # python3 res/inline-sciter.py - # # Patch sciter x86 - # sed -i 's/branch = "dyn"/branch = "dyn_x86"/g' ./Cargo.toml - # cargo build --features inline,vram,hwcodec --release --bins - # mkdir -p ./Release - # mv ./target/release/rustdesk.exe ./Release/rustdesk.exe - # curl -LJ -o ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll - # echo "output_folder=./Release" >> $GITHUB_OUTPUT - # curl -LJ -o ./usbmmidd_v2.zip https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip - # unzip usbmmidd_v2.zip - # # Do not remove x64 files, because the user may run the 32bit version on a 64bit system. - # # Do not remove ./usbmmidd_v2/deviceinstaller64.exe, as x86 exe cannot install and uninstall drivers when running on x64, - # # we need the x64 exe to install and uninstall the driver. - # rm -rf ./usbmmidd_v2/deviceinstaller.exe ./usbmmidd_v2/usbmmidd.bat - # mv ./usbmmidd_v2 ./Release || true - - # - name: find Runner.res - # # Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res - # # Runner.rc does not contain actual version, but Runner.res does - # continue-on-error: true - # shell: bash - # run: | - # runner_res=$(find . -name "Runner.res"); - # if [ "$runner_res" == "" ]; then - # echo "Runner.res: not found"; - # else - # echo "Runner.res: $runner_res"; - # cp $runner_res ./libs/portable/Runner.res; - # echo "list ./libs/portable/Runner.res"; - # ls -l ./libs/portable/Runner.res; - # fi - - # - name: Sign rustdesk files - # if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != '' - # shell: bash - # run: | - # pip3 install requests argparse - # BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./Release/ - - # - name: Build self-extracted executable - # shell: bash - # run: | - # sed -i '/dpiAware/d' res/manifest.xml - # pushd ./libs/portable - # pip3 install -r requirements.txt - # python3 ./generate.py -f ../../Release/ -o . -e ../../Release/rustdesk.exe - # 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 - # if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != '' - # shell: bash - # run: | - # BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./SignOutput/ - - # - name: Publish Release - # uses: softprops/action-gh-release@v1 - # if: env.UPLOAD_ARTIFACT == 'true' - # with: - # prerelease: true - # tag_name: ${{ env.TAG_NAME }} - # files: | - # ./SignOutput/rustdesk-*.exe - - # build-for-macOS-arm64-selfhost: - # # use build-for-macOS instead - # if: false - # runs-on: [self-hosted, macOS, ARM64] - # needs: [generate-bridge] - # 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@v4 - - # - name: Restore bridge files - # uses: actions/download-artifact@master - # with: - # name: bridge-artifact - # path: ./ - - # - name: Build rustdesk - # run: | - # ./build.py --flutter --hwcodec - - # - name: create unsigned dmg - # if: env.UPLOAD_ARTIFACT == 'true' - # run: | - # CREATE_DMG="$(command -v create-dmg)" - # CREATE_DMG="$(readlink -f "$CREATE_DMG")" - # sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG" - # create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}-arm64.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app - - # - name: Upload unsigned macOS app - # if: env.UPLOAD_ARTIFACT == 'true' - # uses: actions/upload-artifact@master - # with: - # name: rustdesk-unsigned-macos-arm64 - # path: rustdesk-${{ env.VERSION }}-arm64.dmg # can not upload the directory directly or tar.gz file, which destroy the link structure, causing the codesign failed - - # - name: Codesign app and create signed dmg - # if: env.MACOS_P12_BASE64 != null && env.UPLOAD_ARTIFACT == 'true' - # run: | - # # Patch create-dmg to give more attempts to unmount image - # CREATE_DMG="$(command -v create-dmg)" - # CREATE_DMG="$(readlink -f "$CREATE_DMG")" - # sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG" - # # start sign the rustdesk.app and dmg - # rm -rf *.dmg || true - # codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict ./flutter/build/macos/Build/Products/Release/RustDesk.app -vvv - # create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app - # codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict rustdesk-${{ env.VERSION }}.dmg -vvv - # # notarize the rustdesk-${{ env.VERSION }}.dmg - # rcodesign notary-submit --api-key-path ~/.p12/api-key.json --staple rustdesk-${{ env.VERSION }}.dmg - - # - name: Rename rustdesk - # if: env.UPLOAD_ARTIFACT == 'true' - # run: | - # for name in rustdesk*??.dmg; do - # mv "$name" "${name%%.dmg}-aarch64.dmg" - # done - - # - name: Publish DMG package - # if: env.UPLOAD_ARTIFACT == 'true' - # uses: softprops/action-gh-release@v1 - # with: - # prerelease: true - # tag_name: ${{ env.TAG_NAME }} - # files: | - # rustdesk*-aarch64.dmg - - # build-rustdesk-ios: - # if: ${{ inputs.upload-artifact }} - # name: build rustdesk ios ipa - # runs-on: ${{ matrix.job.os }} - # needs: [generate-bridge] - # strategy: - # fail-fast: false - # matrix: - # job: - # - { - # arch: aarch64, - # target: aarch64-apple-ios, - # os: macos-13, - # vcpkg-triplet: arm64-ios, - # } - # 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 - # - name: Checkout source code - # uses: actions/checkout@v4 - # - name: Install flutter - # uses: subosito/flutter-action@v2 - # with: - # channel: "stable" - # flutter-version: ${{ env.FLUTTER_VERSION }} - - # - name: Patch flutter - # run: | - # cd $(dirname $(dirname $(which flutter))) - # [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff - - # - name: Setup vcpkg with Github Actions binary cache - # uses: lukka/run-vcpkg@v11 - # with: - # vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} - # doNotCache: false - - # - name: Install vcpkg dependencies - # run: | - # if ! $VCPKG_ROOT/vcpkg \ - # install \ - # --triplet ${{ matrix.job.vcpkg-triplet }} \ - # --x-install-root="$VCPKG_ROOT/installed"; then - # find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do - # echo "$_1:" - # echo "======" - # cat "$_1" - # echo "======" - # echo "" - # done - # exit 1 - # fi - # head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true - # shell: bash - - # - name: Install Rust toolchain - # uses: dtolnay/rust-toolchain@v1 - # with: - # toolchain: ${{ env.RUST_VERSION }} - # targets: ${{ matrix.job.target }} - # components: "rustfmt" - - # - uses: Swatinem/rust-cache@v2 - # with: - # prefix-key: rustdesk-lib-cache-ios - # key: ${{ matrix.job.target }} - - # - name: Restore bridge files - # uses: actions/download-artifact@master - # with: - # name: bridge-artifact - # path: ./ - - # - name: Build rustdesk lib - # run: | - # rustup target add ${{ matrix.job.target }} - # cargo build --features flutter,hwcodec --release --target aarch64-apple-ios --lib - - # - name: Build rustdesk - # shell: bash - # run: | - # pushd flutter - # # flutter build ipa --release --obfuscate --split-debug-info=./split-debug-info --no-codesign - # # for easy debugging - # flutter build ipa --release --no-codesign + build-RustDeskTempTopMostWindow: + uses: ./.github/workflows/third-party-RustDeskTempTopMostWindow.yml + with: + upload-artifact: ${{ inputs.upload-artifact }} + target: windows-2022 + configuration: Release + platform: x64 + target_version: Windows10 + strategy: + fail-fast: false + + build-for-windows-flutter: + name: ${{ matrix.job.target }} + needs: [build-RustDeskTempTopMostWindow, generate-bridge] + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + # - { target: i686-pc-windows-msvc , os: windows-2022 } + # - { target: x86_64-pc-windows-gnu , os: windows-2022 } + - { + target: x86_64-pc-windows-msvc, + os: windows-2022, + arch: x86_64, + vcpkg-triplet: x64-windows-static, + } + # - { target: aarch64-pc-windows-msvc, os: windows-2022, 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@v4 + + - name: Restore bridge files + uses: actions/download-artifact@master + with: + name: bridge-artifact + path: ./ + + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v1 + with: + version: ${{ env.LLVM_VERSION }} + + - name: Install flutter + uses: subosito/flutter-action@v2.12.0 #https://github.com/subosito/flutter-action/issues/277 + with: + channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} + + # https://github.com/flutter/flutter/issues/155685 + - name: Replace engine with rustdesk custom flutter engine + run: | + flutter doctor -v + flutter precache --windows + Invoke-WebRequest -Uri https://github.com/rustdesk/engine/releases/download/main/windows-x64-release.zip -OutFile windows-x64-release.zip + Expand-Archive -Path windows-x64-release.zip -DestinationPath windows-x64-release + mv -Force windows-x64-release/*  C:/hostedtoolcache/windows/flutter/stable-${{ env.FLUTTER_VERSION }}-x64/bin/cache/artifacts/engine/windows-x64-release/ + + - name: Patch flutter + shell: bash + run: | + cp .github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff $(dirname $(dirname $(which flutter))) + cd $(dirname $(dirname $(which flutter))) + [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply flutter_3.24.4_dropdown_menu_enableFilter.diff + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@v1 + with: + toolchain: ${{ env.SCITER_RUST_VERSION }} + targets: ${{ matrix.job.target }} + components: "rustfmt" + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: ${{ matrix.job.os }} + + - name: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 + with: + vcpkgDirectory: C:\vcpkg + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + doNotCache: false + + - name: Install vcpkg dependencies + env: + VCPKG_DEFAULT_HOST_TRIPLET: ${{ matrix.job.vcpkg-triplet }} + run: | + if ! $VCPKG_ROOT/vcpkg \ + install \ + --triplet ${{ matrix.job.vcpkg-triplet }} \ + --x-install-root="$VCPKG_ROOT/installed"; then + find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do + echo "$_1:" + echo "======" + cat "$_1" + echo "======" + echo "" + done + exit 1 + fi + head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true + shell: bash + + - name: Build rustdesk + run: | + Invoke-WebRequest -Uri https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip -OutFile usbmmidd_v2.zip + Expand-Archive usbmmidd_v2.zip -DestinationPath . + python3 .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack + Remove-Item -Path usbmmidd_v2\Win32 -Recurse + Remove-Item -Path "usbmmidd_v2\deviceinstaller64.exe", "usbmmidd_v2\deviceinstaller.exe", "usbmmidd_v2\usbmmidd.bat" + mv ./flutter/build/windows/x64/runner/Release ./rustdesk + mv -Force .\usbmmidd_v2 ./rustdesk + + - name: find Runner.res + # Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res + # Runner.rc does not contain actual version, but Runner.res does + continue-on-error: true + shell: bash + run: | + runner_res=$(find . -name "Runner.res"); + if [ "$runner_res" == "" ]; then + echo "Runner.res: not found"; + else + echo "Runner.res: $runner_res"; + cp $runner_res ./libs/portable/Runner.res; + echo "list ./libs/portable/Runner.res"; + ls -l ./libs/portable/Runner.res; + fi + + - name: Download RustDeskTempTopMostWindow artifacts + uses: actions/download-artifact@master + if: ${{ inputs.upload-artifact }} + with: + name: topmostwindow-artifacts + path: "./rustdesk" + + - name: Upload unsigned + if: env.UPLOAD_ARTIFACT == 'true' + uses: actions/upload-artifact@master + with: + name: rustdesk-unsigned-windows-${{ matrix.job.arch }} + path: rustdesk + + - name: Sign rustdesk files + if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != '' + shell: bash + run: | + pip3 install requests argparse + BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./rustdesk/ + + - name: Build self-extracted executable + shell: bash + if: env.UPLOAD_ARTIFACT == 'true' + run: | + sed -i '/dpiAware/d' res/manifest.xml + pushd ./libs/portable + pip3 install -r requirements.txt + python3 ./generate.py -f ../../rustdesk/ -o . -e ../../rustdesk/rustdesk.exe + popd + mkdir -p ./SignOutput + mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.exe + + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v2 + + - name: Build msi + if: env.UPLOAD_ARTIFACT == 'true' + run: | + pushd ./res/msi + python preprocess.py --arp -d ../../rustdesk + nuget restore msi.sln + msbuild msi.sln -p:Configuration=Release -p:Platform=x64 /p:TargetVersion=Windows10 + mv ./Package/bin/x64/Release/en-us/Package.msi ../../SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.msi + sha256sum ../../SignOutput/rustdesk-*.msi + + - name: Sign rustdesk self-extracted file + if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != '' + shell: bash + run: | + BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./SignOutput + + - name: Publish Release + uses: softprops/action-gh-release@v1 + if: env.UPLOAD_ARTIFACT == 'true' + with: + prerelease: true + tag_name: ${{ env.TAG_NAME }} + files: | + ./SignOutput/rustdesk-*.msi + ./SignOutput/rustdesk-*.exe + + # The fallback for the flutter version, we use Sciter for 32bit Windows. + build-for-windows-sciter: + name: ${{ matrix.job.target }} (${{ matrix.job.os }}) + runs-on: ${{ matrix.job.os }} + # Temporarily disable this action due to additional test is needed. + # if: false + strategy: + fail-fast: false + matrix: + job: + # - { target: i686-pc-windows-msvc , os: windows-2022 } + # - { target: x86_64-pc-windows-gnu , os: windows-2022 } + - { + target: i686-pc-windows-msvc, + os: windows-2022, + arch: x86, + vcpkg-triplet: x86-windows-static, + } + # - { target: aarch64-pc-windows-msvc, os: windows-2022 } + 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@v4 + + - name: Install LLVM and Clang + uses: rustdesk-org/install-llvm-action-32bit@master + with: + version: ${{ env.LLVM_VERSION }} + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@v1 + with: + toolchain: nightly-2023-10-13-${{ matrix.job.target }} # must use nightly here, because of abi_thiscall feature required + targets: ${{ matrix.job.target }} + components: "rustfmt" + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: ${{ matrix.job.os }}-sciter + + - name: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 + with: + vcpkgDirectory: C:\vcpkg + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + doNotCache: false + + - name: Install vcpkg dependencies + env: + VCPKG_DEFAULT_HOST_TRIPLET: ${{ matrix.job.vcpkg-triplet }} + run: | + if ! $VCPKG_ROOT/vcpkg \ + install \ + --triplet ${{ matrix.job.vcpkg-triplet }} \ + --x-install-root="$VCPKG_ROOT/installed"; then + find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do + echo "$_1:" + echo "======" + cat "$_1" + echo "======" + echo "" + done + exit 1 + fi + head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true + shell: bash + + - name: Build rustdesk + id: build + shell: bash + run: | + python3 res/inline-sciter.py + # Patch sciter x86 + sed -i 's/branch = "dyn"/branch = "dyn_x86"/g' ./Cargo.toml + cargo build --features inline,vram,hwcodec --release --bins + mkdir -p ./Release + mv ./target/release/rustdesk.exe ./Release/rustdesk.exe + curl -LJ -o ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll + echo "output_folder=./Release" >> $GITHUB_OUTPUT + curl -LJ -o ./usbmmidd_v2.zip https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip + unzip usbmmidd_v2.zip + # Do not remove x64 files, because the user may run the 32bit version on a 64bit system. + # Do not remove ./usbmmidd_v2/deviceinstaller64.exe, as x86 exe cannot install and uninstall drivers when running on x64, + # we need the x64 exe to install and uninstall the driver. + rm -rf ./usbmmidd_v2/deviceinstaller.exe ./usbmmidd_v2/usbmmidd.bat + mv ./usbmmidd_v2 ./Release || true + + - name: find Runner.res + # Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res + # Runner.rc does not contain actual version, but Runner.res does + continue-on-error: true + shell: bash + run: | + runner_res=$(find . -name "Runner.res"); + if [ "$runner_res" == "" ]; then + echo "Runner.res: not found"; + else + echo "Runner.res: $runner_res"; + cp $runner_res ./libs/portable/Runner.res; + echo "list ./libs/portable/Runner.res"; + ls -l ./libs/portable/Runner.res; + fi + + - name: Sign rustdesk files + if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != '' + shell: bash + run: | + pip3 install requests argparse + BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./Release/ + + - name: Build self-extracted executable + shell: bash + run: | + sed -i '/dpiAware/d' res/manifest.xml + pushd ./libs/portable + pip3 install -r requirements.txt + python3 ./generate.py -f ../../Release/ -o . -e ../../Release/rustdesk.exe + 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 + if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != '' + shell: bash + run: | + BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./SignOutput/ + + - name: Publish Release + uses: softprops/action-gh-release@v1 + if: env.UPLOAD_ARTIFACT == 'true' + with: + prerelease: true + tag_name: ${{ env.TAG_NAME }} + files: | + ./SignOutput/rustdesk-*.exe + + build-for-macOS-arm64-selfhost: + # use build-for-macOS instead + if: false + runs-on: [self-hosted, macOS, ARM64] + needs: [generate-bridge] + 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@v4 + + - name: Restore bridge files + uses: actions/download-artifact@master + with: + name: bridge-artifact + path: ./ + + - name: Build rustdesk + run: | + ./build.py --flutter --hwcodec + + - name: create unsigned dmg + if: env.UPLOAD_ARTIFACT == 'true' + run: | + CREATE_DMG="$(command -v create-dmg)" + CREATE_DMG="$(readlink -f "$CREATE_DMG")" + sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG" + create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}-arm64.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app + + - name: Upload unsigned macOS app + if: env.UPLOAD_ARTIFACT == 'true' + uses: actions/upload-artifact@master + with: + name: rustdesk-unsigned-macos-arm64 + path: rustdesk-${{ env.VERSION }}-arm64.dmg # can not upload the directory directly or tar.gz file, which destroy the link structure, causing the codesign failed + + - name: Codesign app and create signed dmg + if: env.MACOS_P12_BASE64 != null && env.UPLOAD_ARTIFACT == 'true' + run: | + # Patch create-dmg to give more attempts to unmount image + CREATE_DMG="$(command -v create-dmg)" + CREATE_DMG="$(readlink -f "$CREATE_DMG")" + sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG" + # start sign the rustdesk.app and dmg + rm -rf *.dmg || true + codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict ./flutter/build/macos/Build/Products/Release/RustDesk.app -vvv + create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app + codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict rustdesk-${{ env.VERSION }}.dmg -vvv + # notarize the rustdesk-${{ env.VERSION }}.dmg + rcodesign notary-submit --api-key-path ~/.p12/api-key.json --staple rustdesk-${{ env.VERSION }}.dmg + + - name: Rename rustdesk + if: env.UPLOAD_ARTIFACT == 'true' + run: | + for name in rustdesk*??.dmg; do + mv "$name" "${name%%.dmg}-aarch64.dmg" + done + + - name: Publish DMG package + if: env.UPLOAD_ARTIFACT == 'true' + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ env.TAG_NAME }} + files: | + rustdesk*-aarch64.dmg + + build-rustdesk-ios: + if: ${{ inputs.upload-artifact }} + name: build rustdesk ios ipa + runs-on: ${{ matrix.job.os }} + needs: [generate-bridge] + strategy: + fail-fast: false + matrix: + job: + - { + arch: aarch64, + target: aarch64-apple-ios, + os: macos-13, + vcpkg-triplet: arm64-ios, + } + 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 + - name: Checkout source code + uses: actions/checkout@v4 + - name: Install flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} + + - name: Patch flutter + run: | + cd $(dirname $(dirname $(which flutter))) + [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff + + - name: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 + with: + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + doNotCache: false + + - name: Install vcpkg dependencies + run: | + if ! $VCPKG_ROOT/vcpkg \ + install \ + --triplet ${{ matrix.job.vcpkg-triplet }} \ + --x-install-root="$VCPKG_ROOT/installed"; then + find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do + echo "$_1:" + echo "======" + cat "$_1" + echo "======" + echo "" + done + exit 1 + fi + head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true + shell: bash + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@v1 + with: + toolchain: ${{ env.RUST_VERSION }} + targets: ${{ matrix.job.target }} + components: "rustfmt" + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: rustdesk-lib-cache-ios + key: ${{ matrix.job.target }} + + - name: Restore bridge files + uses: actions/download-artifact@master + with: + name: bridge-artifact + path: ./ + + - name: Build rustdesk lib + run: | + rustup target add ${{ matrix.job.target }} + cargo build --features flutter,hwcodec --release --target aarch64-apple-ios --lib + + - name: Build rustdesk + shell: bash + run: | + pushd flutter + # 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' @@ -571,45 +571,45 @@ jobs: # files: | # flutter/build/ios/ipa/*.ipa - # build-rustdesk-ios-selfhost: - # #if: ${{ inputs.upload-artifact }} - # if: false - # runs-on: [self-hosted, macOS, ARM64] - # needs: [generate-bridge] - # strategy: - # fail-fast: false - # 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@v4 - - # # $VCPKG_ROOT/vcpkg install --triplet arm64-ios --x-install-root="$VCPKG_ROOT/installed" - - # - name: Restore bridge files - # uses: actions/download-artifact@master - # with: - # name: bridge-artifact - # path: ./ - - # - name: Build rustdesk lib - # run: | - # cargo build --features flutter,hwcodec --release --target aarch64-apple-ios --lib - - # - name: Build rustdesk - # # ios sdk not installed on this machine, I will install it later after I am back home - # if: false - # shell: bash - # run: | - # pushd flutter - # # flutter build ipa --release --obfuscate --split-debug-info=./split-debug-info --no-codesign - # # for easy debugging - # flutter build ipa --release --no-codesign + build-rustdesk-ios-selfhost: + #if: ${{ inputs.upload-artifact }} + if: false + runs-on: [self-hosted, macOS, ARM64] + needs: [generate-bridge] + strategy: + fail-fast: false + 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@v4 + + # $VCPKG_ROOT/vcpkg install --triplet arm64-ios --x-install-root="$VCPKG_ROOT/installed" + + - name: Restore bridge files + uses: actions/download-artifact@master + with: + name: bridge-artifact + path: ./ + + - name: Build rustdesk lib + run: | + cargo build --features flutter,hwcodec --release --target aarch64-apple-ios --lib + + - name: Build rustdesk + # ios sdk not installed on this machine, I will install it later after I am back home + if: false + shell: bash + run: | + pushd flutter + # 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' @@ -627,246 +627,246 @@ jobs: # files: | # flutter/build/ios/ipa/*.ipa - # build-for-macOS: - # name: ${{ matrix.job.target }} - # runs-on: ${{ matrix.job.os }} - # needs: [generate-bridge] - # strategy: - # fail-fast: false - # matrix: - # job: - # - { - # target: x86_64-apple-darwin, - # os: macos-13, #macos-latest or macos-14 use M1 now, https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#:~:text=14%20GB-,macos%2Dlatest%20or%20macos%2D14,-The%20macos%2Dlatestlabel - # extra-build-args: "", - # arch: x86_64, - # vcpkg-triplet: x64-osx, - # } - # - { - # target: aarch64-apple-darwin, - # os: macos-latest, - # # extra-build-args: "--disable-flutter-texture-render", # disable this for mac, because we see a lot of users reporting flickering both on arm and x64, and we can not confirm if texture rendering has better performance if htere is no vram, https://github.com/rustdesk/rustdesk/issues/6296 - # extra-build-args: "--screencapturekit", - # arch: aarch64, - # vcpkg-triplet: arm64-osx, - # } - # 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@v4 - - # - name: Import the codesign cert - # if: env.MACOS_P12_BASE64 != null - # uses: apple-actions/import-codesign-certs@v1 - # 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: | - # security default-keychain -s rustdesk.keychain - # security find-identity -v - - # - name: Import notarize key - # if: env.MACOS_P12_BASE64 != null - # uses: timheuer/base64-to-file@v1.2 - # with: - # # https://gregoryszorc.com/docs/apple-codesign/stable/apple_codesign_rcodesign.html#notarizing-and-stapling - # fileName: rustdesk.json - # fileDir: ${{ github.workspace }} - # encodedString: ${{ secrets.MACOS_NOTARIZE_JSON }} - - # - name: Install rcodesign tool - # if: env.MACOS_P12_BASE64 != null - # shell: bash - # 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 - # mv apple-codesign-0.22.0-macos-universal/rcodesign /usr/local/bin - # popd - - # - name: Install build runtime - # run: | - # brew install llvm create-dmg nasm cmake gcc wget ninja - # # pkg-config is handled in a separate step, because it may be already installed by `macos-latest`(14.7.1) runner - # if command -v pkg-config &>/dev/null; then - # echo "pkg-config is already installed" - # else - # brew install pkg-config - # fi - - # - name: Install flutter - # uses: subosito/flutter-action@v2 - # with: - # channel: "stable" - # flutter-version: ${{ env.FLUTTER_VERSION }} - - # - name: Patch flutter - # run: | - # cd $(dirname $(dirname $(which flutter))) - # [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff - - # - name: Workaround for flutter issue - # shell: bash - # run: | - # cd "$(dirname "$(which flutter)")" - # # https://github.com/flutter/flutter/issues/1.3.53 - # sed -i -e 's/_setFramesEnabledState(false);/\/\/_setFramesEnabledState(false);/g' ../packages/flutter/lib/src/scheduler/binding.dart - # grep -n '_setFramesEnabledState(false);' ../packages/flutter/lib/src/scheduler/binding.dart - - # - name: Install Rust toolchain - # uses: dtolnay/rust-toolchain@v1 - # with: - # toolchain: ${{ env.MAC_RUST_VERSION }} - # targets: ${{ matrix.job.target }} - # components: "rustfmt" - - # - uses: Swatinem/rust-cache@v2 - # with: - # prefix-key: ${{ matrix.job.os }} - - # - name: Restore bridge files - # uses: actions/download-artifact@master - # with: - # name: bridge-artifact - # path: ./ - - # - name: Setup vcpkg with Github Actions binary cache - # uses: lukka/run-vcpkg@v11 - # with: - # vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} - # doNotCache: false - - # - name: Install vcpkg dependencies - # run: | - # if ! $VCPKG_ROOT/vcpkg \ - # install \ - # --x-install-root="$VCPKG_ROOT/installed"; then - # find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do - # echo "$_1:" - # echo "======" - # cat "$_1" - # echo "======" - # echo "" - # done - # exit 1 - # fi - # head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true - - # - name: Show version information (Rust, cargo, Clang) - # shell: bash - # run: | - # clang --version || true - # rustup -V - # rustup toolchain list - # rustup default - # cargo -V - # rustc -V - - # - name: Build rustdesk - # run: | - # if [ "${{ matrix.job.target }}" = "aarch64-apple-darwin" ]; then - # MIN_MACOS_VERSION="12.3" - # sed -i -e "s/MACOSX_DEPLOYMENT_TARGET\=[0-9]*.[0-9]*/MACOSX_DEPLOYMENT_TARGET=${MIN_MACOS_VERSION}/" build.py - # sed -i -e "s/platform :osx, '.*'/platform :osx, '${MIN_MACOS_VERSION}'/" flutter/macos/Podfile - # sed -i -e "s/osx_minimum_system_version = \"[0-9]*.[0-9]*\"/osx_minimum_system_version = \"${MIN_MACOS_VERSION}\"/" Cargo.toml - # sed -i -e "s/MACOSX_DEPLOYMENT_TARGET = [0-9]*.[0-9]*;/MACOSX_DEPLOYMENT_TARGET = ${MIN_MACOS_VERSION};/" flutter/macos/Runner.xcodeproj/project.pbxproj - # fi - # ./build.py --flutter --hwcodec ${{ matrix.job.extra-build-args }} - - # - name: create unsigned dmg - # if: env.UPLOAD_ARTIFACT == 'true' - # run: | - # CREATE_DMG="$(command -v create-dmg)" - # CREATE_DMG="$(readlink -f "$CREATE_DMG")" - # sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG" - # create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app - - # - name: Upload unsigned macOS app - # if: env.UPLOAD_ARTIFACT == 'true' - # uses: actions/upload-artifact@master - # with: - # name: rustdesk-unsigned-macos-${{ matrix.job.arch }} - # path: rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.dmg # can not upload the directory directly or tar.gz, which destroy the link structure, causing the codesign failed - - # - name: Codesign app and create signed dmg - # if: env.MACOS_P12_BASE64 != null && env.UPLOAD_ARTIFACT == 'true' - # run: | - # # Patch create-dmg to give more attempts to unmount image - # CREATE_DMG="$(command -v create-dmg)" - # CREATE_DMG="$(readlink -f "$CREATE_DMG")" - # sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG" - # # Unlock keychain - # security default-keychain -s rustdesk.keychain - # security unlock-keychain -p ${{ secrets.MACOS_P12_PASSWORD }} rustdesk.keychain - # # start sign the rustdesk.app and dmg - # rm -rf *.dmg || true - # codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict ./flutter/build/macos/Build/Products/Release/RustDesk.app -vvv - # create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app - # codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict rustdesk-${{ env.VERSION }}.dmg -vvv - # # notarize the rustdesk-${{ env.VERSION }}.dmg - # rcodesign notary-submit --api-key-path ${{ github.workspace }}/rustdesk.json --staple rustdesk-${{ env.VERSION }}.dmg - - # - name: Rename rustdesk - # if: env.UPLOAD_ARTIFACT == 'true' - # run: | - # for name in rustdesk*??.dmg; do - # mv "$name" "${name%%.dmg}-${{ matrix.job.arch }}.dmg" - # done - - # - name: Publish DMG package - # if: env.UPLOAD_ARTIFACT == 'true' - # uses: softprops/action-gh-release@v1 - # with: - # prerelease: true - # tag_name: ${{ env.TAG_NAME }} - # files: | - # rustdesk*-${{ matrix.job.arch }}.dmg - - # publish_unsigned: - # needs: - # - build-for-macOS - # - build-for-windows-flutter - # runs-on: ubuntu-latest - # if: ${{ inputs.upload-artifact }} - # steps: - # - name: Download artifacts - # uses: actions/download-artifact@master - # with: - # name: rustdesk-unsigned-macos-x86_64 - # path: ./ - - # - name: Download Artifacts - # uses: actions/download-artifact@master - # with: - # name: rustdesk-unsigned-macos-aarch64 - # path: ./ - - # - name: Download Artifacts - # uses: actions/download-artifact@master - # with: - # name: rustdesk-unsigned-windows-x86_64 - # path: ./windows-x86_64/ - - # - name: Combine unsigned app - # run: | - # tar czf rustdesk-${{ env.VERSION }}-unsigned.tar.gz *.dmg windows-x86_64 - - # - name: Publish unsigned app - # uses: softprops/action-gh-release@v1 - # with: - # prerelease: true - # tag_name: ${{ env.TAG_NAME }} - # files: rustdesk-${{ env.VERSION }}-unsigned.tar.gz + build-for-macOS: + name: ${{ matrix.job.target }} + runs-on: ${{ matrix.job.os }} + needs: [generate-bridge] + strategy: + fail-fast: false + matrix: + job: + - { + target: x86_64-apple-darwin, + os: macos-13, #macos-latest or macos-14 use M1 now, https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#:~:text=14%20GB-,macos%2Dlatest%20or%20macos%2D14,-The%20macos%2Dlatestlabel + extra-build-args: "", + arch: x86_64, + vcpkg-triplet: x64-osx, + } + - { + target: aarch64-apple-darwin, + os: macos-latest, + # extra-build-args: "--disable-flutter-texture-render", # disable this for mac, because we see a lot of users reporting flickering both on arm and x64, and we can not confirm if texture rendering has better performance if htere is no vram, https://github.com/rustdesk/rustdesk/issues/6296 + extra-build-args: "--screencapturekit", + arch: aarch64, + vcpkg-triplet: arm64-osx, + } + 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@v4 + + - name: Import the codesign cert + if: env.MACOS_P12_BASE64 != null + uses: apple-actions/import-codesign-certs@v1 + 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: | + security default-keychain -s rustdesk.keychain + security find-identity -v + + - name: Import notarize key + if: env.MACOS_P12_BASE64 != null + uses: timheuer/base64-to-file@v1.2 + with: + # https://gregoryszorc.com/docs/apple-codesign/stable/apple_codesign_rcodesign.html#notarizing-and-stapling + fileName: rustdesk.json + fileDir: ${{ github.workspace }} + encodedString: ${{ secrets.MACOS_NOTARIZE_JSON }} + + - name: Install rcodesign tool + if: env.MACOS_P12_BASE64 != null + shell: bash + 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 + mv apple-codesign-0.22.0-macos-universal/rcodesign /usr/local/bin + popd + + - name: Install build runtime + run: | + brew install llvm create-dmg nasm cmake gcc wget ninja + # pkg-config is handled in a separate step, because it may be already installed by `macos-latest`(14.7.1) runner + if command -v pkg-config &>/dev/null; then + echo "pkg-config is already installed" + else + brew install pkg-config + fi + + - name: Install flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} + + - name: Patch flutter + run: | + cd $(dirname $(dirname $(which flutter))) + [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff + + - name: Workaround for flutter issue + shell: bash + run: | + cd "$(dirname "$(which flutter)")" + # https://github.com/flutter/flutter/issues/1.3.53 + sed -i -e 's/_setFramesEnabledState(false);/\/\/_setFramesEnabledState(false);/g' ../packages/flutter/lib/src/scheduler/binding.dart + grep -n '_setFramesEnabledState(false);' ../packages/flutter/lib/src/scheduler/binding.dart + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@v1 + with: + toolchain: ${{ env.MAC_RUST_VERSION }} + targets: ${{ matrix.job.target }} + components: "rustfmt" + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: ${{ matrix.job.os }} + + - name: Restore bridge files + uses: actions/download-artifact@master + with: + name: bridge-artifact + path: ./ + + - name: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 + with: + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + doNotCache: false + + - name: Install vcpkg dependencies + run: | + if ! $VCPKG_ROOT/vcpkg \ + install \ + --x-install-root="$VCPKG_ROOT/installed"; then + find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do + echo "$_1:" + echo "======" + cat "$_1" + echo "======" + echo "" + done + exit 1 + fi + head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true + + - name: Show version information (Rust, cargo, Clang) + shell: bash + run: | + clang --version || true + rustup -V + rustup toolchain list + rustup default + cargo -V + rustc -V + + - name: Build rustdesk + run: | + if [ "${{ matrix.job.target }}" = "aarch64-apple-darwin" ]; then + MIN_MACOS_VERSION="12.3" + sed -i -e "s/MACOSX_DEPLOYMENT_TARGET\=[0-9]*.[0-9]*/MACOSX_DEPLOYMENT_TARGET=${MIN_MACOS_VERSION}/" build.py + sed -i -e "s/platform :osx, '.*'/platform :osx, '${MIN_MACOS_VERSION}'/" flutter/macos/Podfile + sed -i -e "s/osx_minimum_system_version = \"[0-9]*.[0-9]*\"/osx_minimum_system_version = \"${MIN_MACOS_VERSION}\"/" Cargo.toml + sed -i -e "s/MACOSX_DEPLOYMENT_TARGET = [0-9]*.[0-9]*;/MACOSX_DEPLOYMENT_TARGET = ${MIN_MACOS_VERSION};/" flutter/macos/Runner.xcodeproj/project.pbxproj + fi + ./build.py --flutter --hwcodec ${{ matrix.job.extra-build-args }} + + - name: create unsigned dmg + if: env.UPLOAD_ARTIFACT == 'true' + run: | + CREATE_DMG="$(command -v create-dmg)" + CREATE_DMG="$(readlink -f "$CREATE_DMG")" + sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG" + create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app + + - name: Upload unsigned macOS app + if: env.UPLOAD_ARTIFACT == 'true' + uses: actions/upload-artifact@master + with: + name: rustdesk-unsigned-macos-${{ matrix.job.arch }} + path: rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.dmg # can not upload the directory directly or tar.gz, which destroy the link structure, causing the codesign failed + + - name: Codesign app and create signed dmg + if: env.MACOS_P12_BASE64 != null && env.UPLOAD_ARTIFACT == 'true' + run: | + # Patch create-dmg to give more attempts to unmount image + CREATE_DMG="$(command -v create-dmg)" + CREATE_DMG="$(readlink -f "$CREATE_DMG")" + sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG" + # Unlock keychain + security default-keychain -s rustdesk.keychain + security unlock-keychain -p ${{ secrets.MACOS_P12_PASSWORD }} rustdesk.keychain + # start sign the rustdesk.app and dmg + rm -rf *.dmg || true + codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict ./flutter/build/macos/Build/Products/Release/RustDesk.app -vvv + create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app + codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict rustdesk-${{ env.VERSION }}.dmg -vvv + # notarize the rustdesk-${{ env.VERSION }}.dmg + rcodesign notary-submit --api-key-path ${{ github.workspace }}/rustdesk.json --staple rustdesk-${{ env.VERSION }}.dmg + + - name: Rename rustdesk + if: env.UPLOAD_ARTIFACT == 'true' + run: | + for name in rustdesk*??.dmg; do + mv "$name" "${name%%.dmg}-${{ matrix.job.arch }}.dmg" + done + + - name: Publish DMG package + if: env.UPLOAD_ARTIFACT == 'true' + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ env.TAG_NAME }} + files: | + rustdesk*-${{ matrix.job.arch }}.dmg + + publish_unsigned: + needs: + - build-for-macOS + - build-for-windows-flutter + runs-on: ubuntu-latest + if: ${{ inputs.upload-artifact }} + steps: + - name: Download artifacts + uses: actions/download-artifact@master + with: + name: rustdesk-unsigned-macos-x86_64 + path: ./ + + - name: Download Artifacts + uses: actions/download-artifact@master + with: + name: rustdesk-unsigned-macos-aarch64 + path: ./ + + - name: Download Artifacts + uses: actions/download-artifact@master + with: + name: rustdesk-unsigned-windows-x86_64 + path: ./windows-x86_64/ + + - name: Combine unsigned app + run: | + tar czf rustdesk-${{ env.VERSION }}-unsigned.tar.gz *.dmg windows-x86_64 + + - name: Publish unsigned app + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ env.TAG_NAME }} + files: rustdesk-${{ env.VERSION }}-unsigned.tar.gz build-rustdesk-android: needs: [generate-bridge] @@ -1369,14 +1369,14 @@ jobs: deb_arch: amd64, vcpkg-triplet: x64-linux, } - # - { - # arch: aarch64, - # target: aarch64-unknown-linux-gnu, - # distro: ubuntu18.04, - # on: [self-hosted, Linux, ARM64], - # deb_arch: arm64, - # vcpkg-triplet: arm64-linux, - # } + - { + arch: aarch64, + target: aarch64-unknown-linux-gnu, + distro: ubuntu18.04, + on: [self-hosted, Linux, ARM64], + deb_arch: arm64, + vcpkg-triplet: arm64-linux, + } steps: - name: Export GitHub Actions cache environment variables uses: actions/github-script@v6 @@ -2049,8 +2049,6 @@ jobs: files: | flatpak/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}${{ matrix.job.suffix }}.flatpak -# super important comment - build-rustdesk-web: if: False name: build-rustdesk-web diff --git a/.github/workflows/playground.yml b/.github/workflows/playground.yml new file mode 100644 index 000000000000..d60d6f7b1370 --- /dev/null +++ b/.github/workflows/playground.yml @@ -0,0 +1,416 @@ +name: playground + +on: + #schedule: + # schedule build every night + # - cron: "0/6 * * * *" + workflow_dispatch: + +env: + RUST_VERSION: "1.75" # https://github.com/rustdesk/rustdesk/discussions/7503 + CARGO_NDK_VERSION: "3.1.2" + LLVM_VERSION: "15.0.6" + FLUTTER_VERSION: "3.22.2" + FLUTTER_RUST_BRIDGE_VERSION: "1.80.1" + # for arm64 linux because official Dart SDK does not work + FLUTTER_ELINUX_VERSION: "3.16.9" + TAG_NAME: "nightly" + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" + # vcpkg version: 2024.06.15 + VCPKG_COMMIT_ID: "f7423ee180c4b7f40d43402c2feb3859161ef625" + VERSION: "1.3.5" + NDK_VERSION: "r26d" + #signing keys env variable checks + ANDROID_SIGNING_KEY: "${{ secrets.ANDROID_SIGNING_KEY }}" + MACOS_P12_BASE64: "${{ secrets.MACOS_P12_BASE64 }}" + # To make a custom build with your own servers set the below secret values + RS_PUB_KEY: "${{ secrets.RS_PUB_KEY }}" + RENDEZVOUS_SERVER: "${{ secrets.RENDEZVOUS_SERVER }}" + API_SERVER: "${{ secrets.API_SERVER }}" + UPLOAD_ARTIFACT: "${{ inputs.upload-artifact }}" + SIGN_BASE_URL: "${{ secrets.SIGN_BASE_URL }}" + +jobs: + build-for-macOS: + name: ${{ matrix.job.target }} + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + - { + target: x86_64-apple-darwin, + os: macos-13, #macos-latest or macos-14 use M1 now, https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#:~:text=14%20GB-,macos%2Dlatest%20or%20macos%2D14,-The%20macos%2Dlatestlabel + extra-build-args: "", + arch: x86_64, + flutter: "3.13.9", + ref: "f6509e3fd6917aa976bad2fc684182601ebf2434", + bridge: "1.80.1", + date: "20231219" + } + - { + target: x86_64-apple-darwin, + os: macos-13, #macos-latest or macos-14 use M1 now, https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#:~:text=14%20GB-,macos%2Dlatest%20or%20macos%2D14,-The%20macos%2Dlatestlabel + extra-build-args: "", + arch: x86_64, + flutter: "3.10.6", + ref: "f6509e3fd6917aa976bad2fc684182601ebf2434", + bridge: "1.80.1", + date: "20231219" + } + - { + target: x86_64-apple-darwin, + os: macos-13, #macos-latest or macos-14 use M1 now, https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#:~:text=14%20GB-,macos%2Dlatest%20or%20macos%2D14,-The%20macos%2Dlatestlabel + extra-build-args: "", + arch: x86_64, + flutter: "3.10.6", + ref: "85ddfc0739f052cab0029c46b899b959ee94eeb8", + bridge: "1.80.1", + date: "20231119" + } + - { + target: x86_64-apple-darwin, + os: macos-13, #macos-latest or macos-14 use M1 now, https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#:~:text=14%20GB-,macos%2Dlatest%20or%20macos%2D14,-The%20macos%2Dlatestlabel + extra-build-args: "", + arch: x86_64, + flutter: "3.13.9", + ref: "85ddfc0739f052cab0029c46b899b959ee94eeb8", + bridge: "1.80.1", + date: "20231119" + } + 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 + with: + ref: ${{ matrix.job.ref }} + + - name: Import the codesign cert + if: env.MACOS_P12_BASE64 != null + uses: apple-actions/import-codesign-certs@v1 + 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: | + security default-keychain -s rustdesk.keychain + security find-identity -v + + - name: Import notarize key + if: env.MACOS_P12_BASE64 != null + uses: timheuer/base64-to-file@v1.2 + with: + # https://gregoryszorc.com/docs/apple-codesign/stable/apple_codesign_rcodesign.html#notarizing-and-stapling + fileName: rustdesk.json + fileDir: ${{ github.workspace }} + encodedString: ${{ secrets.MACOS_NOTARIZE_JSON }} + + - name: Install rcodesign tool + if: env.MACOS_P12_BASE64 != null + shell: bash + 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 + mv apple-codesign-0.22.0-macos-universal/rcodesign /usr/local/bin + popd + + - name: Install build runtime + run: | + brew install llvm create-dmg nasm cmake gcc wget ninja pkg-config + + - name: Install flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + flutter-version: ${{ matrix.job.flutter }} + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@v1 + with: + toolchain: ${{ env.RUST_VERSION }} + targets: ${{ matrix.job.target }} + components: "rustfmt" + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: ${{ matrix.job.os }} + + - name: Install flutter rust bridge deps + shell: bash + run: | + sed -i '' 's/3.1.0/2.17.0/g' flutter/pubspec.yaml; + cargo install flutter_rust_bridge_codegen --version ${{ matrix.job.bridge }} --features "uuid" --locked + # below works for mac to make buildable on 3.13.9 + # pushd flutter/lib; find . -name "*.dart" | xargs -I{} sed -i '' 's/textScaler: TextScaler.linear(\(.*\)),/textScaleFactor: \1,/g' {}; popd; + 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: Setup vcpkg with Github Actions binary cache + uses: lukka/run-vcpkg@v11 + with: + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + + - name: Install vcpkg dependencies + run: | + $VCPKG_ROOT/vcpkg install --x-install-root="$VCPKG_ROOT/installed" + + - name: Restore from cache and install vcpkg + uses: lukka/run-vcpkg@v7 + if: false + with: + setupOnly: true + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + + - name: Install vcpkg dependencies + if: false + run: | + $VCPKG_ROOT/vcpkg install libvpx libyuv opus aom + + - name: Show version information (Rust, cargo, Clang) + shell: bash + run: | + clang --version || true + rustup -V + rustup toolchain list + rustup default + cargo -V + rustc -V + + - name: Build rustdesk + run: | + ./build.py --flutter ${{ matrix.job.extra-build-args }} + + - name: create unsigned dmg + run: | + CREATE_DMG="$(command -v create-dmg)" + CREATE_DMG="$(readlink -f "$CREATE_DMG")" + sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG" + create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app + + - name: Codesign app and create signed dmg + if: env.MACOS_P12_BASE64 != null + run: | + # Patch create-dmg to give more attempts to unmount image + CREATE_DMG="$(command -v create-dmg)" + CREATE_DMG="$(readlink -f "$CREATE_DMG")" + sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG" + # Unlock keychain + security default-keychain -s rustdesk.keychain + security unlock-keychain -p ${{ secrets.MACOS_P12_PASSWORD }} rustdesk.keychain + # start sign the rustdesk.app and dmg + rm -rf *.dmg || true + codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict ./flutter/build/macos/Build/Products/Release/RustDesk.app -vvv + create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app + codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict rustdesk-${{ env.VERSION }}.dmg -vvv + # notarize the rustdesk-${{ env.VERSION }}.dmg + rcodesign notary-submit --api-key-path ${{ github.workspace }}/rustdesk.json --staple rustdesk-${{ env.VERSION }}.dmg + + - name: Rename rustdesk + run: | + for name in rustdesk*??.dmg; do + mv "$name" "${name%%.dmg}-${{ matrix.job.arch }}-flutter${{ matrix.job.flutter }}-flutter${{ matrix.job.date }}.dmg" + done + + - name: Publish DMG package + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ env.TAG_NAME }} + files: | + rustdesk*-${{ matrix.job.arch }}*.dmg + + + build-rustdesk-android: + if: false + name: build rustdesk android apk ${{ matrix.job.target }} + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + - { + arch: aarch64, + target: aarch64-linux-android, + os: ubuntu-20.04, + openssl-arch: android-arm64, + ref: master, # latest + } + steps: + - name: Checkout source code + uses: actions/checkout@v3 + with: + ref: ${{ matrix.job.ref }} + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + clang \ + cmake \ + curl \ + gcc-multilib \ + git \ + g++ \ + g++-multilib \ + libayatana-appindicator3-dev\ + libasound2-dev \ + libc6-dev \ + libclang-10-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 \ + nasm \ + yasm \ + ninja-build \ + openjdk-11-jdk-headless \ + pkg-config \ + tree \ + wget + + - name: Install flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@v1 + with: + toolchain: ${{ env.RUST_VERSION }} + components: "rustfmt" + + - name: Install flutter rust bridge deps + run: | + git config --global core.longpaths true + cargo install flutter_rust_bridge_codegen --version ${{ env.FLUTTER_RUST_BRIDGE_VERSION }} --features "uuid" --locked + sed -i 's/uni_links_desktop/#uni_links_desktop/g' flutter/pubspec.yaml + pushd flutter/lib; find . | grep dart | xargs sed -i 's/textScaler: TextScaler.linear(\(.*\)),/textScaleFactor: \1,/g'; popd; + 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 + + - uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: ${{ env.NDK_VERSION }} + add-to-path: true + + - 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: | + 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: Clone deps + shell: bash + run: | + pushd /opt + git clone https://github.com/rustdesk-org/rustdesk_thirdparty_lib.git --depth=1 + ls -ls /opt/artifacts/vcpkg/installed/arm64-android/lib/ + # cp -rf /opt/rustdesk_thirdparty_lib/vcpkg/* /opt/artifacts/vcpkg/ + ls -ls /opt/artifacts/vcpkg/installed/arm64-android/lib/ + + - name: Build rustdesk lib + env: + ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} + ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }} + run: | + rustup target add ${{ matrix.job.target }} + cargo install cargo-ndk --version ${{ env.CARGO_NDK_VERSION }} --locked + case ${{ matrix.job.target }} in + aarch64-linux-android) + ./flutter/ndk_arm64.sh + mkdir -p ./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 + ;; + armv7-linux-androideabi) + ./flutter/ndk_arm.sh + mkdir -p ./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 + ;; + esac + + - name: Build rustdesk + shell: bash + env: + JAVA_HOME: /usr/lib/jvm/java-11-openjdk-amd64 + run: | + export PATH=/usr/lib/jvm/java-11-openjdk-amd64/bin:$PATH + # temporary use debug sign config + sed -i "s/signingConfigs.release/signingConfigs.debug/g" ./flutter/android/app/build.gradle + case ${{ matrix.job.target }} in + aarch64-linux-android) + mkdir -p ./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 + flutter build apk --release --target-platform android-arm64 --split-per-abi + mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ../rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.apk + ;; + armv7-linux-androideabi) + mkdir -p ./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 + flutter build apk --release --target-platform android-arm --split-per-abi + mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ../rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.apk + ;; + esac + popd + mkdir -p signed-apk; pushd signed-apk + mv ../rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.apk ./rustdesk-test-${{ matrix.job.ref }}-${{ matrix.job.ndk }}.apk + + - uses: r0adkll/sign-android-release@v1 + name: Sign app APK + if: env.ANDROID_SIGNING_KEY != null + id: sign-rustdesk + with: + releaseDirectory: ./signed-apk + signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }} + alias: ${{ secrets.ANDROID_ALIAS }} + keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }} + keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }} + env: + # override default build-tools version (29.0.3) -- optional + BUILD_TOOLS_VERSION: "30.0.2" + + - name: Publish signed apk package + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ env.TAG_NAME }} + files: | + ${{steps.sign-rustdesk.outputs.signedReleaseFile}} diff --git a/.github/workflows/third-party-RustDeskTempTopMostWindow.yml b/.github/workflows/third-party-RustDeskTempTopMostWindow.yml new file mode 100644 index 000000000000..2f89092b76bf --- /dev/null +++ b/.github/workflows/third-party-RustDeskTempTopMostWindow.yml @@ -0,0 +1,60 @@ +name: build RustDeskTempTopMostWindow + +on: + workflow_call: + inputs: + upload-artifact: + type: boolean + default: true + target: + description: 'Target' + required: true + type: string + default: 'windows-2022' + configuration: + description: 'Configuration' + required: true + type: string + default: 'Release' + platform: + description: 'Platform' + required: true + type: string + default: 'x64' + target_version: + description: 'TargetVersion' + required: true + type: string + default: 'Windows10' + +env: + project_path: WindowInjection/WindowInjection.vcxproj + +jobs: + build-RustDeskTempTopMostWindow: + runs-on: ${{ inputs.target }} + strategy: + fail-fast: false + env: + build_output_dir: RustDeskTempTopMostWindow/WindowInjection/${{ inputs.platform }}/${{ inputs.configuration }} + steps: + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v2 + + - name: Download the source code + run: | + git clone https://github.com/rustdesk-org/RustDeskTempTopMostWindow RustDeskTempTopMostWindow + + # Build. commit 53b548a5398624f7149a382000397993542ad796 is tag v0.3 + - name: Build the project + run: | + cd RustDeskTempTopMostWindow && git checkout 53b548a5398624f7149a382000397993542ad796 + msbuild ${{ env.project_path }} -p:Configuration=${{ inputs.configuration }} -p:Platform=${{ inputs.platform }} /p:TargetVersion=${{ inputs.target_version }} + + - name: Archive build artifacts + uses: actions/upload-artifact@master + if: ${{ inputs.upload-artifact }} + with: + name: topmostwindow-artifacts + path: | + ./${{ env.build_output_dir }}/WindowInjection.dll