From e1ca674a54ba31f33ad55cedd15afb433886c4bd Mon Sep 17 00:00:00 2001 From: Mike Mueller Date: Mon, 4 May 2026 18:46:01 +0200 Subject: [PATCH] ci: add Gitea Actions workflow for Windows pro-features build --- .gitea/workflows/build-windows.yml | 158 +++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 .gitea/workflows/build-windows.yml diff --git a/.gitea/workflows/build-windows.yml b/.gitea/workflows/build-windows.yml new file mode 100644 index 000000000..4b40aad06 --- /dev/null +++ b/.gitea/workflows/build-windows.yml @@ -0,0 +1,158 @@ +name: build-windows + +on: + push: + branches: [pro-features] + workflow_dispatch: + inputs: + build-msi: + description: "Also build MSI installer" + type: boolean + default: false + +env: + RUST_VERSION: "1.75" + LLVM_VERSION: "15.0.6" + FLUTTER_VERSION: "3.24.5" + VCPKG_COMMIT_ID: "120deac3062162151622ca4860575a33844ba10b" + CARGO_EXPAND_VERSION: "1.0.95" + FLUTTER_RUST_BRIDGE_VERSION: "1.80.1" + VERSION: "1.4.6" + +jobs: + build-x64: + name: build-windows-x64 + runs-on: [self-hosted, windows-10] + timeout-minutes: 240 + env: + VCPKG_ROOT: C:\vcpkg + VCPKG_BINARY_SOURCES: "clear;files,C:\\vcpkg-cache,readwrite" + steps: + - name: Checkout source + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Show toolchain versions + shell: bash + run: | + rustc --version + cargo --version + clang --version + flutter --version + python --version + + - name: Install flutter_rust_bridge codegen tools + shell: bash + run: | + cargo install cargo-expand --version "${CARGO_EXPAND_VERSION}" --locked || true + cargo install flutter_rust_bridge_codegen --version "${FLUTTER_RUST_BRIDGE_VERSION}" --features uuid --locked || true + + - name: Generate Rust <-> Dart bridge + shell: bash + run: | + pushd flutter && flutter pub get && popd + 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 + cp ./flutter/macos/Runner/bridge_generated.h ./flutter/ios/Runner/bridge_generated.h + + - name: Replace Flutter engine with rustdesk custom engine + shell: pwsh + run: | + 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 -Force -Path windows-x64-release.zip -DestinationPath windows-x64-release + $engineDir = "C:\tools\flutter\bin\cache\artifacts\engine\windows-x64-release" + New-Item -ItemType Directory -Force -Path $engineDir | Out-Null + Move-Item -Force windows-x64-release\* $engineDir\ + + - name: Patch Flutter (dropdown_menu enableFilter) + shell: bash + run: | + patch_file=".github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff" + if [ -f "$patch_file" ]; then + flutter_root="$(dirname "$(dirname "$(which flutter)")")" + cp "$patch_file" "$flutter_root/" + (cd "$flutter_root" && git apply "$(basename "$patch_file")" || true) + fi + + - name: vcpkg install dependencies (x64-windows-static) + shell: bash + env: + VCPKG_DEFAULT_HOST_TRIPLET: x64-windows-static + run: | + mkdir -p /c/vcpkg-cache + if ! "$VCPKG_ROOT/vcpkg" install \ + --triplet x64-windows-static \ + --x-install-root="$VCPKG_ROOT/installed"; then + find "$VCPKG_ROOT/" -name "*.log" -exec sh -c 'echo "===== {} ====="; cat "{}"' \; + exit 1 + fi + + - name: Build RustDesk (build.py --portable --hwcodec --flutter --vram) + shell: pwsh + run: | + python .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack + Move-Item -Force .\flutter\build\windows\x64\runner\Release .\rustdesk + + - name: Bundle usbmmidd_v2 + printer driver + shell: pwsh + continue-on-error: true + run: | + Invoke-WebRequest -Uri https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip -OutFile usbmmidd_v2.zip + Expand-Archive -Force usbmmidd_v2.zip -DestinationPath . + Remove-Item -Recurse -Force usbmmidd_v2\Win32 + Remove-Item -Force usbmmidd_v2\deviceinstaller64.exe, usbmmidd_v2\deviceinstaller.exe, usbmmidd_v2\usbmmidd.bat + Move-Item -Force .\usbmmidd_v2 .\rustdesk\ + + Invoke-WebRequest -Uri https://github.com/rustdesk/hbb_common/releases/download/driver/rustdesk_printer_driver_v4-1.4.zip -OutFile printer.zip + Invoke-WebRequest -Uri https://github.com/rustdesk/hbb_common/releases/download/driver/printer_driver_adapter.zip -OutFile printer_adapter.zip + Expand-Archive -Force printer.zip -DestinationPath . + Expand-Archive -Force printer_adapter.zip -DestinationPath . + New-Item -ItemType Directory -Force -Path .\rustdesk\drivers | Out-Null + Move-Item -Force .\rustdesk_printer_driver_v4-1.4 .\rustdesk\drivers\RustDeskPrinterDriver + Move-Item -Force .\printer_driver_adapter.dll .\rustdesk\ + + - name: Copy Runner.res for portable packer + shell: bash + continue-on-error: true + run: | + runner_res=$(find . -name Runner.res | head -1) + [ -n "$runner_res" ] && cp "$runner_res" ./libs/portable/Runner.res + + - name: Build portable self-extracting exe + shell: bash + run: | + sed -i '/dpiAware/d' res/manifest.xml + pushd ./libs/portable + pip install -r requirements.txt + python ./generate.py -f ../../rustdesk/ -o . -e ../../rustdesk/rustdesk.exe + popd + mkdir -p ./SignOutput + mv ./target/release/rustdesk-portable-packer.exe "./SignOutput/rustdesk-${VERSION}-x86_64.exe" + + - name: Build MSI installer + if: ${{ inputs.build-msi == true }} + shell: pwsh + run: | + Push-Location .\res\msi + python preprocess.py --arp -d ..\..\rustdesk + # vswhere finds VS install; use it to locate MSBuild + $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" + $msbuild = & $vswhere -latest -requires Microsoft.Component.MSBuild -find "MSBuild\**\Bin\MSBuild.exe" | Select-Object -First 1 + nuget restore msi.sln + & $msbuild msi.sln -p:Configuration=Release -p:Platform=x64 /p:TargetVersion=Windows10 + Move-Item -Force .\Package\bin\x64\Release\en-us\Package.msi "..\..\SignOutput\rustdesk-${env:VERSION}-x86_64.msi" + Pop-Location + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: rustdesk-windows-x64-${{ github.sha }} + path: | + SignOutput/rustdesk-*.exe + SignOutput/rustdesk-*.msi + if-no-files-found: warn + retention-days: 14