flutter-build.yml 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153
  1. name: Build the flutter version of the RustDesk
  2. on:
  3. workflow_call:
  4. inputs:
  5. upload-artifact:
  6. type: boolean
  7. default: true
  8. upload-tag:
  9. type: string
  10. default: "nightly"
  11. # NOTE: F-Droid builder script 'flutter/build_fdroid.sh' reads environment
  12. # variables from this workflow!
  13. #
  14. # It does NOT read build steps, however, so please fix 'flutter/build_fdroid.sh
  15. # whenever you add changes to Android CI build action ('build-rustdesk-android')
  16. # in this file!
  17. env:
  18. 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
  19. 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
  20. MAC_RUST_VERSION: "1.81" # 1.81 is requred for macos, because of https://github.com/yury/cidre requires 1.81
  21. CARGO_NDK_VERSION: "3.1.2"
  22. SCITER_ARMV7_CMAKE_VERSION: "3.29.7"
  23. SCITER_NASM_DEBVERSION: "2.14-1"
  24. LLVM_VERSION: "15.0.6"
  25. FLUTTER_VERSION: "3.24.5"
  26. ANDROID_FLUTTER_VERSION: "3.24.5"
  27. # for arm64 linux because official Dart SDK does not work
  28. FLUTTER_ELINUX_VERSION: "3.16.9"
  29. TAG_NAME: "${{ inputs.upload-tag }}"
  30. VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
  31. # vcpkg version: 2025.01.13
  32. # If we change the `VCPKG COMMIT_ID`, please remember:
  33. # 1. Call `$VCPKG_ROOT/vcpkg x-update-baseline` to update the baseline in `vcpkg.json`.
  34. # Or we may face build issue like
  35. # https://github.com/rustdesk/rustdesk/actions/runs/14414119794/job/40427970174
  36. # 2. Update the `VCPKG_COMMIT_ID` in `ci.yml` and `playground.yml`.
  37. VCPKG_COMMIT_ID: "6f29f12e82a8293156836ad81cc9bf5af41fe836"
  38. VERSION: "1.4.0"
  39. NDK_VERSION: "r27c"
  40. #signing keys env variable checks
  41. ANDROID_SIGNING_KEY: "${{ secrets.ANDROID_SIGNING_KEY }}"
  42. MACOS_P12_BASE64: "${{ secrets.MACOS_P12_BASE64 }}"
  43. UPLOAD_ARTIFACT: "${{ inputs.upload-artifact }}"
  44. SIGN_BASE_URL: "${{ secrets.SIGN_BASE_URL }}"
  45. jobs:
  46. generate-bridge:
  47. uses: ./.github/workflows/bridge.yml
  48. build-RustDeskTempTopMostWindow:
  49. uses: ./.github/workflows/third-party-RustDeskTempTopMostWindow.yml
  50. with:
  51. upload-artifact: ${{ inputs.upload-artifact }}
  52. target: windows-2022
  53. configuration: Release
  54. platform: x64
  55. target_version: Windows10
  56. strategy:
  57. fail-fast: false
  58. build-for-windows-flutter:
  59. name: ${{ matrix.job.target }}
  60. needs: [build-RustDeskTempTopMostWindow, generate-bridge]
  61. runs-on: ${{ matrix.job.os }}
  62. strategy:
  63. fail-fast: false
  64. matrix:
  65. job:
  66. # - { target: i686-pc-windows-msvc , os: windows-2022 }
  67. # - { target: x86_64-pc-windows-gnu , os: windows-2022 }
  68. - {
  69. target: x86_64-pc-windows-msvc,
  70. os: windows-2022,
  71. arch: x86_64,
  72. vcpkg-triplet: x64-windows-static,
  73. }
  74. # - { target: aarch64-pc-windows-msvc, os: windows-2022, arch: aarch64 }
  75. steps:
  76. - name: Export GitHub Actions cache environment variables
  77. uses: actions/github-script@v6
  78. with:
  79. script: |
  80. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  81. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  82. - name: Checkout source code
  83. uses: actions/checkout@v4
  84. with:
  85. submodules: recursive
  86. - name: Restore bridge files
  87. uses: actions/download-artifact@master
  88. with:
  89. name: bridge-artifact
  90. path: ./
  91. - name: Install LLVM and Clang
  92. uses: KyleMayes/install-llvm-action@v1
  93. with:
  94. version: ${{ env.LLVM_VERSION }}
  95. - name: Install flutter
  96. uses: subosito/flutter-action@v2.12.0 #https://github.com/subosito/flutter-action/issues/277
  97. with:
  98. channel: "stable"
  99. flutter-version: ${{ env.FLUTTER_VERSION }}
  100. # https://github.com/flutter/flutter/issues/155685
  101. - name: Replace engine with rustdesk custom flutter engine
  102. run: |
  103. flutter doctor -v
  104. flutter precache --windows
  105. Invoke-WebRequest -Uri https://github.com/rustdesk/engine/releases/download/main/windows-x64-release.zip -OutFile windows-x64-release.zip
  106. Expand-Archive -Path windows-x64-release.zip -DestinationPath windows-x64-release
  107. mv -Force windows-x64-release/*  C:/hostedtoolcache/windows/flutter/stable-${{ env.FLUTTER_VERSION }}-x64/bin/cache/artifacts/engine/windows-x64-release/
  108. - name: Patch flutter
  109. shell: bash
  110. run: |
  111. cp .github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff $(dirname $(dirname $(which flutter)))
  112. cd $(dirname $(dirname $(which flutter)))
  113. [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply flutter_3.24.4_dropdown_menu_enableFilter.diff
  114. - name: Install Rust toolchain
  115. uses: dtolnay/rust-toolchain@v1
  116. with:
  117. toolchain: ${{ env.SCITER_RUST_VERSION }}
  118. targets: ${{ matrix.job.target }}
  119. components: "rustfmt"
  120. - uses: Swatinem/rust-cache@v2
  121. with:
  122. prefix-key: ${{ matrix.job.os }}
  123. - name: Setup vcpkg with Github Actions binary cache
  124. uses: lukka/run-vcpkg@v11
  125. with:
  126. vcpkgDirectory: C:\vcpkg
  127. vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}
  128. doNotCache: false
  129. - name: Install vcpkg dependencies
  130. env:
  131. VCPKG_DEFAULT_HOST_TRIPLET: ${{ matrix.job.vcpkg-triplet }}
  132. run: |
  133. if ! $VCPKG_ROOT/vcpkg \
  134. install \
  135. --triplet ${{ matrix.job.vcpkg-triplet }} \
  136. --x-install-root="$VCPKG_ROOT/installed"; then
  137. find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do
  138. echo "$_1:"
  139. echo "======"
  140. cat "$_1"
  141. echo "======"
  142. echo ""
  143. done
  144. exit 1
  145. fi
  146. head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true
  147. shell: bash
  148. - name: Build rustdesk
  149. run: |
  150. # Windows: build RustDesk
  151. python3 .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack
  152. mv ./flutter/build/windows/x64/runner/Release ./rustdesk
  153. # Download usbmmidd_v2.zip and extract it to ./rustdesk
  154. Invoke-WebRequest -Uri https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip -OutFile usbmmidd_v2.zip
  155. Expand-Archive usbmmidd_v2.zip -DestinationPath .
  156. Remove-Item -Path usbmmidd_v2\Win32 -Recurse
  157. Remove-Item -Path "usbmmidd_v2\deviceinstaller64.exe", "usbmmidd_v2\deviceinstaller.exe", "usbmmidd_v2\usbmmidd.bat"
  158. mv -Force .\usbmmidd_v2 ./rustdesk
  159. # Download printer driver files and extract them to ./rustdesk
  160. try {
  161. Invoke-WebRequest -Uri https://github.com/rustdesk/hbb_common/releases/download/driver/rustdesk_printer_driver_v4.zip -OutFile rustdesk_printer_driver_v4.zip
  162. Invoke-WebRequest -Uri https://github.com/rustdesk/hbb_common/releases/download/driver/printer_driver_adapter.zip -OutFile printer_driver_adapter.zip
  163. Invoke-WebRequest -Uri https://github.com/rustdesk/hbb_common/releases/download/driver/sha256sums -OutFile sha256sums
  164. # Check and move the files
  165. $checksum_driver = (Select-String -Path .\sha256sums -Pattern '^([a-fA-F0-9]{64}) \*rustdesk_printer_driver_v4\.zip$').Matches.Groups[1].Value
  166. $downloadsum_driver = Get-FileHash -Path rustdesk_printer_driver_v4.zip -Algorithm SHA256
  167. $checksum_dll = (Select-String -Path .\sha256sums -Pattern '^([a-fA-F0-9]{64}) \*printer_driver_adapter\.zip$').Matches.Groups[1].Value
  168. $downloadsum_dll = Get-FileHash -Path printer_driver_adapter.zip -Algorithm SHA256
  169. if ($checksum_driver -eq $downloadsum_driver.Hash -and $checksum_dll -eq $downloadsum_dll.Hash) {
  170. Write-Output "rustdesk_printer_driver_v4, checksums match, extract the file."
  171. Expand-Archive rustdesk_printer_driver_v4.zip -DestinationPath .
  172. mkdir ./rustdesk/drivers
  173. mv -Force .\rustdesk_printer_driver_v4 ./rustdesk/drivers/RustDeskPrinterDriver
  174. Expand-Archive printer_driver_adapter.zip -DestinationPath .
  175. mv -Force .\printer_driver_adapter.dll ./rustdesk
  176. } elseif ($checksum_driver -ne $downloadsum_driver.Hash) {
  177. Write-Output "rustdesk_printer_driver_v4, checksums do not match, ignore the file."
  178. } else {
  179. Write-Output "printer_driver_adapter.dll, checksums do not match, ignore the file."
  180. }
  181. } catch {
  182. Write-Host "Ingore the printer driver error."
  183. }
  184. - name: find Runner.res
  185. # Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res
  186. # Runner.rc does not contain actual version, but Runner.res does
  187. continue-on-error: true
  188. shell: bash
  189. run: |
  190. runner_res=$(find . -name "Runner.res");
  191. if [ "$runner_res" == "" ]; then
  192. echo "Runner.res: not found";
  193. else
  194. echo "Runner.res: $runner_res";
  195. cp $runner_res ./libs/portable/Runner.res;
  196. echo "list ./libs/portable/Runner.res";
  197. ls -l ./libs/portable/Runner.res;
  198. fi
  199. - name: Download RustDeskTempTopMostWindow artifacts
  200. uses: actions/download-artifact@master
  201. if: ${{ inputs.upload-artifact }}
  202. with:
  203. name: topmostwindow-artifacts
  204. path: "./rustdesk"
  205. - name: Upload unsigned
  206. if: env.UPLOAD_ARTIFACT == 'true'
  207. uses: actions/upload-artifact@master
  208. with:
  209. name: rustdesk-unsigned-windows-${{ matrix.job.arch }}
  210. path: rustdesk
  211. - name: Sign rustdesk files
  212. if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != ''
  213. shell: bash
  214. run: |
  215. pip3 install requests argparse
  216. BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./rustdesk/
  217. - name: Build self-extracted executable
  218. shell: bash
  219. if: env.UPLOAD_ARTIFACT == 'true'
  220. run: |
  221. sed -i '/dpiAware/d' res/manifest.xml
  222. pushd ./libs/portable
  223. pip3 install -r requirements.txt
  224. python3 ./generate.py -f ../../rustdesk/ -o . -e ../../rustdesk/rustdesk.exe
  225. popd
  226. mkdir -p ./SignOutput
  227. mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.exe
  228. - name: Add MSBuild to PATH
  229. uses: microsoft/setup-msbuild@v2
  230. - name: Build msi
  231. if: env.UPLOAD_ARTIFACT == 'true'
  232. run: |
  233. pushd ./res/msi
  234. python preprocess.py --arp -d ../../rustdesk
  235. nuget restore msi.sln
  236. msbuild msi.sln -p:Configuration=Release -p:Platform=x64 /p:TargetVersion=Windows10
  237. mv ./Package/bin/x64/Release/en-us/Package.msi ../../SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.msi
  238. sha256sum ../../SignOutput/rustdesk-*.msi
  239. - name: Sign rustdesk self-extracted file
  240. if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != ''
  241. shell: bash
  242. run: |
  243. BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./SignOutput
  244. - name: Publish Release
  245. uses: softprops/action-gh-release@v1
  246. if: env.UPLOAD_ARTIFACT == 'true'
  247. with:
  248. prerelease: true
  249. tag_name: ${{ env.TAG_NAME }}
  250. files: |
  251. ./SignOutput/rustdesk-*.msi
  252. ./SignOutput/rustdesk-*.exe
  253. # The fallback for the flutter version, we use Sciter for 32bit Windows.
  254. build-for-windows-sciter:
  255. name: ${{ matrix.job.target }} (${{ matrix.job.os }})
  256. runs-on: ${{ matrix.job.os }}
  257. # Temporarily disable this action due to additional test is needed.
  258. # if: false
  259. strategy:
  260. fail-fast: false
  261. matrix:
  262. job:
  263. # - { target: i686-pc-windows-msvc , os: windows-2022 }
  264. # - { target: x86_64-pc-windows-gnu , os: windows-2022 }
  265. - {
  266. target: i686-pc-windows-msvc,
  267. os: windows-2022,
  268. arch: x86,
  269. vcpkg-triplet: x86-windows-static,
  270. }
  271. # - { target: aarch64-pc-windows-msvc, os: windows-2022 }
  272. steps:
  273. - name: Export GitHub Actions cache environment variables
  274. uses: actions/github-script@v6
  275. with:
  276. script: |
  277. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  278. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  279. - name: Checkout source code
  280. uses: actions/checkout@v4
  281. with:
  282. submodules: recursive
  283. - name: Install LLVM and Clang
  284. uses: rustdesk-org/install-llvm-action-32bit@master
  285. with:
  286. version: ${{ env.LLVM_VERSION }}
  287. - name: Install Rust toolchain
  288. uses: dtolnay/rust-toolchain@v1
  289. with:
  290. toolchain: nightly-2023-10-13-${{ matrix.job.target }} # must use nightly here, because of abi_thiscall feature required
  291. targets: ${{ matrix.job.target }}
  292. components: "rustfmt"
  293. - uses: Swatinem/rust-cache@v2
  294. with:
  295. prefix-key: ${{ matrix.job.os }}-sciter
  296. - name: Setup vcpkg with Github Actions binary cache
  297. uses: lukka/run-vcpkg@v11
  298. with:
  299. vcpkgDirectory: C:\vcpkg
  300. vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}
  301. doNotCache: false
  302. - name: Install vcpkg dependencies
  303. env:
  304. VCPKG_DEFAULT_HOST_TRIPLET: ${{ matrix.job.vcpkg-triplet }}
  305. run: |
  306. if ! $VCPKG_ROOT/vcpkg \
  307. install \
  308. --triplet ${{ matrix.job.vcpkg-triplet }} \
  309. --x-install-root="$VCPKG_ROOT/installed"; then
  310. find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do
  311. echo "$_1:"
  312. echo "======"
  313. cat "$_1"
  314. echo "======"
  315. echo ""
  316. done
  317. exit 1
  318. fi
  319. head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true
  320. shell: bash
  321. - name: Build rustdesk
  322. id: build
  323. shell: bash
  324. run: |
  325. python3 res/inline-sciter.py
  326. # Patch sciter x86
  327. sed -i 's/branch = "dyn"/branch = "dyn_x86"/g' ./Cargo.toml
  328. cargo build --features inline,vram,hwcodec --release --bins
  329. mkdir -p ./Release
  330. mv ./target/release/rustdesk.exe ./Release/rustdesk.exe
  331. curl -LJ -o ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll
  332. echo "output_folder=./Release" >> $GITHUB_OUTPUT
  333. curl -LJ -o ./usbmmidd_v2.zip https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip
  334. unzip usbmmidd_v2.zip
  335. # Do not remove x64 files, because the user may run the 32bit version on a 64bit system.
  336. # Do not remove ./usbmmidd_v2/deviceinstaller64.exe, as x86 exe cannot install and uninstall drivers when running on x64,
  337. # we need the x64 exe to install and uninstall the driver.
  338. rm -rf ./usbmmidd_v2/deviceinstaller.exe ./usbmmidd_v2/usbmmidd.bat
  339. mv ./usbmmidd_v2 ./Release || true
  340. - name: find Runner.res
  341. # Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res
  342. # Runner.rc does not contain actual version, but Runner.res does
  343. continue-on-error: true
  344. shell: bash
  345. run: |
  346. runner_res=$(find . -name "Runner.res");
  347. if [ "$runner_res" == "" ]; then
  348. echo "Runner.res: not found";
  349. else
  350. echo "Runner.res: $runner_res";
  351. cp $runner_res ./libs/portable/Runner.res;
  352. echo "list ./libs/portable/Runner.res";
  353. ls -l ./libs/portable/Runner.res;
  354. fi
  355. - name: Sign rustdesk files
  356. if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != ''
  357. shell: bash
  358. run: |
  359. pip3 install requests argparse
  360. BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./Release/
  361. - name: Build self-extracted executable
  362. shell: bash
  363. run: |
  364. sed -i '/dpiAware/d' res/manifest.xml
  365. pushd ./libs/portable
  366. pip3 install -r requirements.txt
  367. python3 ./generate.py -f ../../Release/ -o . -e ../../Release/rustdesk.exe
  368. popd
  369. mkdir -p ./SignOutput
  370. mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}-sciter.exe
  371. - name: Sign rustdesk self-extracted file
  372. if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != ''
  373. shell: bash
  374. run: |
  375. BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./SignOutput/
  376. - name: Publish Release
  377. uses: softprops/action-gh-release@v1
  378. if: env.UPLOAD_ARTIFACT == 'true'
  379. with:
  380. prerelease: true
  381. tag_name: ${{ env.TAG_NAME }}
  382. files: |
  383. ./SignOutput/rustdesk-*.exe
  384. build-for-macOS-arm64-selfhost:
  385. # use build-for-macOS instead
  386. if: false
  387. runs-on: [self-hosted, macOS, ARM64]
  388. needs: [generate-bridge]
  389. steps:
  390. - name: Export GitHub Actions cache environment variables
  391. uses: actions/github-script@v6
  392. with:
  393. script: |
  394. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  395. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  396. - name: Checkout source code
  397. uses: actions/checkout@v4
  398. with:
  399. submodules: recursive
  400. - name: Restore bridge files
  401. uses: actions/download-artifact@master
  402. with:
  403. name: bridge-artifact
  404. path: ./
  405. - name: Build rustdesk
  406. run: |
  407. ./build.py --flutter --hwcodec --unix-file-copy-paste
  408. - name: create unsigned dmg
  409. if: env.UPLOAD_ARTIFACT == 'true'
  410. run: |
  411. CREATE_DMG="$(command -v create-dmg)"
  412. CREATE_DMG="$(readlink -f "$CREATE_DMG")"
  413. sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG"
  414. 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
  415. - name: Upload unsigned macOS app
  416. if: env.UPLOAD_ARTIFACT == 'true'
  417. uses: actions/upload-artifact@master
  418. with:
  419. name: rustdesk-unsigned-macos-arm64
  420. 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
  421. - name: Codesign app and create signed dmg
  422. if: env.MACOS_P12_BASE64 != null && env.UPLOAD_ARTIFACT == 'true'
  423. run: |
  424. # Patch create-dmg to give more attempts to unmount image
  425. CREATE_DMG="$(command -v create-dmg)"
  426. CREATE_DMG="$(readlink -f "$CREATE_DMG")"
  427. sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG"
  428. # start sign the rustdesk.app and dmg
  429. rm -rf *.dmg || true
  430. codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict ./flutter/build/macos/Build/Products/Release/RustDesk.app -vvv
  431. 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
  432. codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict rustdesk-${{ env.VERSION }}.dmg -vvv
  433. # notarize the rustdesk-${{ env.VERSION }}.dmg
  434. rcodesign notary-submit --api-key-path ~/.p12/api-key.json --staple rustdesk-${{ env.VERSION }}.dmg
  435. - name: Rename rustdesk
  436. if: env.UPLOAD_ARTIFACT == 'true'
  437. run: |
  438. for name in rustdesk*??.dmg; do
  439. mv "$name" "${name%%.dmg}-aarch64.dmg"
  440. done
  441. - name: Publish DMG package
  442. if: env.UPLOAD_ARTIFACT == 'true'
  443. uses: softprops/action-gh-release@v1
  444. with:
  445. prerelease: true
  446. tag_name: ${{ env.TAG_NAME }}
  447. files: |
  448. rustdesk*-aarch64.dmg
  449. build-rustdesk-ios:
  450. if: ${{ inputs.upload-artifact }}
  451. name: build rustdesk ios ipa
  452. runs-on: ${{ matrix.job.os }}
  453. needs: [generate-bridge]
  454. strategy:
  455. fail-fast: false
  456. matrix:
  457. job:
  458. - {
  459. arch: aarch64,
  460. target: aarch64-apple-ios,
  461. os: macos-13,
  462. vcpkg-triplet: arm64-ios,
  463. }
  464. steps:
  465. - name: Export GitHub Actions cache environment variables
  466. uses: actions/github-script@v6
  467. with:
  468. script: |
  469. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  470. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  471. - name: Install dependencies
  472. run: |
  473. brew install nasm yasm
  474. - name: Checkout source code
  475. uses: actions/checkout@v4
  476. with:
  477. submodules: recursive
  478. - name: Install flutter
  479. uses: subosito/flutter-action@v2
  480. with:
  481. channel: "stable"
  482. flutter-version: ${{ env.FLUTTER_VERSION }}
  483. - name: Patch flutter
  484. run: |
  485. cd $(dirname $(dirname $(which flutter)))
  486. [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff
  487. - name: Setup vcpkg with Github Actions binary cache
  488. uses: lukka/run-vcpkg@v11
  489. with:
  490. vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}
  491. doNotCache: false
  492. - name: Install vcpkg dependencies
  493. run: |
  494. if ! $VCPKG_ROOT/vcpkg \
  495. install \
  496. --triplet ${{ matrix.job.vcpkg-triplet }} \
  497. --x-install-root="$VCPKG_ROOT/installed"; then
  498. find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do
  499. echo "$_1:"
  500. echo "======"
  501. cat "$_1"
  502. echo "======"
  503. echo ""
  504. done
  505. exit 1
  506. fi
  507. head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true
  508. shell: bash
  509. - name: Install Rust toolchain
  510. uses: dtolnay/rust-toolchain@v1
  511. with:
  512. toolchain: ${{ env.RUST_VERSION }}
  513. targets: ${{ matrix.job.target }}
  514. components: "rustfmt"
  515. - uses: Swatinem/rust-cache@v2
  516. with:
  517. prefix-key: rustdesk-lib-cache-ios
  518. key: ${{ matrix.job.target }}
  519. - name: Restore bridge files
  520. uses: actions/download-artifact@master
  521. with:
  522. name: bridge-artifact
  523. path: ./
  524. - name: Build rustdesk lib
  525. run: |
  526. rustup target add ${{ matrix.job.target }}
  527. cargo build --features flutter,hwcodec --release --target aarch64-apple-ios --lib
  528. - name: Upload liblibrustdesk.a Artifacts
  529. uses: actions/upload-artifact@master
  530. with:
  531. name: liblibrustdesk.a
  532. path: target/aarch64-apple-ios/release/liblibrustdesk.a
  533. - name: Build rustdesk
  534. shell: bash
  535. run: |
  536. pushd flutter
  537. # flutter build ipa --release --obfuscate --split-debug-info=./split-debug-info --no-codesign
  538. # for easy debugging
  539. flutter build ipa --release --no-codesign
  540. # - name: Upload Artifacts
  541. # # if: env.ANDROID_SIGNING_KEY != null && env.UPLOAD_ARTIFACT == 'true'
  542. # uses: actions/upload-artifact@master
  543. # with:
  544. # name: rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.apk
  545. # path: flutter/build/ios/ipa/*.ipa
  546. # - name: Publish ipa package
  547. # # if: env.ANDROID_SIGNING_KEY != null && env.UPLOAD_ARTIFACT == 'true'
  548. # uses: softprops/action-gh-release@v1
  549. # with:
  550. # prerelease: true
  551. # tag_name: ${{ env.TAG_NAME }}
  552. # files: |
  553. # flutter/build/ios/ipa/*.ipa
  554. build-rustdesk-ios-selfhost:
  555. #if: ${{ inputs.upload-artifact }}
  556. if: false
  557. runs-on: [self-hosted, macOS, ARM64]
  558. needs: [generate-bridge]
  559. strategy:
  560. fail-fast: false
  561. steps:
  562. - name: Export GitHub Actions cache environment variables
  563. uses: actions/github-script@v6
  564. with:
  565. script: |
  566. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  567. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  568. - name: Checkout source code
  569. uses: actions/checkout@v4
  570. with:
  571. submodules: recursive
  572. # $VCPKG_ROOT/vcpkg install --triplet arm64-ios --x-install-root="$VCPKG_ROOT/installed"
  573. - name: Restore bridge files
  574. uses: actions/download-artifact@master
  575. with:
  576. name: bridge-artifact
  577. path: ./
  578. - name: Build rustdesk lib
  579. run: |
  580. cargo build --features flutter,hwcodec --release --target aarch64-apple-ios --lib
  581. - name: Build rustdesk
  582. # ios sdk not installed on this machine, I will install it later after I am back home
  583. if: false
  584. shell: bash
  585. run: |
  586. pushd flutter
  587. # flutter build ipa --release --obfuscate --split-debug-info=./split-debug-info --no-codesign
  588. # for easy debugging
  589. flutter build ipa --release --no-codesign
  590. # - name: Upload Artifacts
  591. # # if: env.ANDROID_SIGNING_KEY != null && env.UPLOAD_ARTIFACT == 'true'
  592. # uses: actions/upload-artifact@master
  593. # with:
  594. # name: rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.apk
  595. # path: flutter/build/ios/ipa/*.ipa
  596. # - name: Publish ipa package
  597. # # if: env.ANDROID_SIGNING_KEY != null && env.UPLOAD_ARTIFACT == 'true'
  598. # uses: softprops/action-gh-release@v1
  599. # with:
  600. # prerelease: true
  601. # tag_name: ${{ env.TAG_NAME }}
  602. # files: |
  603. # flutter/build/ios/ipa/*.ipa
  604. build-for-macOS:
  605. name: ${{ matrix.job.target }}
  606. runs-on: ${{ matrix.job.os }}
  607. needs: [generate-bridge]
  608. strategy:
  609. fail-fast: false
  610. matrix:
  611. job:
  612. - {
  613. target: x86_64-apple-darwin,
  614. 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
  615. extra-build-args: "",
  616. arch: x86_64,
  617. vcpkg-triplet: x64-osx,
  618. }
  619. - {
  620. target: aarch64-apple-darwin,
  621. os: macos-latest,
  622. # 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
  623. extra-build-args: "--screencapturekit",
  624. arch: aarch64,
  625. vcpkg-triplet: arm64-osx,
  626. }
  627. steps:
  628. - name: Export GitHub Actions cache environment variables
  629. uses: actions/github-script@v6
  630. with:
  631. script: |
  632. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  633. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  634. - name: Checkout source code
  635. uses: actions/checkout@v4
  636. with:
  637. submodules: recursive
  638. - name: Import the codesign cert
  639. if: env.MACOS_P12_BASE64 != null
  640. uses: apple-actions/import-codesign-certs@v1
  641. with:
  642. p12-file-base64: ${{ secrets.MACOS_P12_BASE64 }}
  643. p12-password: ${{ secrets.MACOS_P12_PASSWORD }}
  644. keychain: rustdesk
  645. - name: Check sign and import sign key
  646. if: env.MACOS_P12_BASE64 != null
  647. run: |
  648. security default-keychain -s rustdesk.keychain
  649. security find-identity -v
  650. - name: Import notarize key
  651. if: env.MACOS_P12_BASE64 != null
  652. uses: timheuer/base64-to-file@v1.2
  653. with:
  654. # https://gregoryszorc.com/docs/apple-codesign/stable/apple_codesign_rcodesign.html#notarizing-and-stapling
  655. fileName: rustdesk.json
  656. fileDir: ${{ github.workspace }}
  657. encodedString: ${{ secrets.MACOS_NOTARIZE_JSON }}
  658. - name: Install rcodesign tool
  659. if: env.MACOS_P12_BASE64 != null
  660. shell: bash
  661. run: |
  662. pushd /tmp
  663. wget https://github.com/indygreg/apple-platform-rs/releases/download/apple-codesign%2F0.22.0/apple-codesign-0.22.0-macos-universal.tar.gz
  664. tar -zxvf apple-codesign-0.22.0-macos-universal.tar.gz
  665. mv apple-codesign-0.22.0-macos-universal/rcodesign /usr/local/bin
  666. popd
  667. - name: Install build runtime
  668. run: |
  669. brew install llvm create-dmg nasm cmake gcc wget ninja
  670. # pkg-config is handled in a separate step, because it may be already installed by `macos-latest`(14.7.1) runner
  671. if command -v pkg-config &>/dev/null; then
  672. echo "pkg-config is already installed"
  673. else
  674. brew install pkg-config
  675. fi
  676. - name: Install flutter
  677. uses: subosito/flutter-action@v2
  678. with:
  679. channel: "stable"
  680. flutter-version: ${{ env.FLUTTER_VERSION }}
  681. - name: Patch flutter
  682. run: |
  683. cd $(dirname $(dirname $(which flutter)))
  684. [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff
  685. - name: Workaround for flutter issue
  686. shell: bash
  687. run: |
  688. cd "$(dirname "$(which flutter)")"
  689. # https://github.com/flutter/flutter/issues/133533
  690. sed -i -e 's/_setFramesEnabledState(false);/\/\/_setFramesEnabledState(false);/g' ../packages/flutter/lib/src/scheduler/binding.dart
  691. grep -n '_setFramesEnabledState(false);' ../packages/flutter/lib/src/scheduler/binding.dart
  692. - name: Install Rust toolchain
  693. uses: dtolnay/rust-toolchain@v1
  694. with:
  695. toolchain: ${{ env.MAC_RUST_VERSION }}
  696. targets: ${{ matrix.job.target }}
  697. components: "rustfmt"
  698. - uses: Swatinem/rust-cache@v2
  699. with:
  700. prefix-key: ${{ matrix.job.os }}
  701. - name: Restore bridge files
  702. uses: actions/download-artifact@master
  703. with:
  704. name: bridge-artifact
  705. path: ./
  706. - name: Setup vcpkg with Github Actions binary cache
  707. uses: lukka/run-vcpkg@v11
  708. with:
  709. vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}
  710. doNotCache: false
  711. - name: Install vcpkg dependencies
  712. run: |
  713. if ! $VCPKG_ROOT/vcpkg \
  714. install \
  715. --x-install-root="$VCPKG_ROOT/installed"; then
  716. find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do
  717. echo "$_1:"
  718. echo "======"
  719. cat "$_1"
  720. echo "======"
  721. echo ""
  722. done
  723. exit 1
  724. fi
  725. head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true
  726. - name: Show version information (Rust, cargo, Clang)
  727. shell: bash
  728. run: |
  729. clang --version || true
  730. rustup -V
  731. rustup toolchain list
  732. rustup default
  733. cargo -V
  734. rustc -V
  735. - name: Build rustdesk
  736. run: |
  737. if [ "${{ matrix.job.target }}" = "aarch64-apple-darwin" ]; then
  738. MIN_MACOS_VERSION="12.3"
  739. sed -i -e "s/MACOSX_DEPLOYMENT_TARGET\=[0-9]*.[0-9]*/MACOSX_DEPLOYMENT_TARGET=${MIN_MACOS_VERSION}/" build.py
  740. sed -i -e "s/platform :osx, '.*'/platform :osx, '${MIN_MACOS_VERSION}'/" flutter/macos/Podfile
  741. sed -i -e "s/osx_minimum_system_version = \"[0-9]*.[0-9]*\"/osx_minimum_system_version = \"${MIN_MACOS_VERSION}\"/" Cargo.toml
  742. sed -i -e "s/MACOSX_DEPLOYMENT_TARGET = [0-9]*.[0-9]*;/MACOSX_DEPLOYMENT_TARGET = ${MIN_MACOS_VERSION};/" flutter/macos/Runner.xcodeproj/project.pbxproj
  743. fi
  744. ./build.py --flutter --hwcodec --unix-file-copy-paste ${{ matrix.job.extra-build-args }}
  745. - name: create unsigned dmg
  746. if: env.UPLOAD_ARTIFACT == 'true'
  747. run: |
  748. CREATE_DMG="$(command -v create-dmg)"
  749. CREATE_DMG="$(readlink -f "$CREATE_DMG")"
  750. sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG"
  751. 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
  752. - name: Upload unsigned macOS app
  753. if: env.UPLOAD_ARTIFACT == 'true'
  754. uses: actions/upload-artifact@master
  755. with:
  756. name: rustdesk-unsigned-macos-${{ matrix.job.arch }}
  757. 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
  758. - name: Codesign app and create signed dmg
  759. if: env.MACOS_P12_BASE64 != null && env.UPLOAD_ARTIFACT == 'true'
  760. run: |
  761. # Patch create-dmg to give more attempts to unmount image
  762. CREATE_DMG="$(command -v create-dmg)"
  763. CREATE_DMG="$(readlink -f "$CREATE_DMG")"
  764. sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG"
  765. # Unlock keychain
  766. security default-keychain -s rustdesk.keychain
  767. security unlock-keychain -p ${{ secrets.MACOS_P12_PASSWORD }} rustdesk.keychain
  768. # start sign the rustdesk.app and dmg
  769. rm -rf *.dmg || true
  770. codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict ./flutter/build/macos/Build/Products/Release/RustDesk.app -vvv
  771. 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
  772. codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict rustdesk-${{ env.VERSION }}.dmg -vvv
  773. # notarize the rustdesk-${{ env.VERSION }}.dmg
  774. rcodesign notary-submit --api-key-path ${{ github.workspace }}/rustdesk.json --staple rustdesk-${{ env.VERSION }}.dmg
  775. - name: Rename rustdesk
  776. if: env.UPLOAD_ARTIFACT == 'true'
  777. run: |
  778. for name in rustdesk*??.dmg; do
  779. mv "$name" "${name%%.dmg}-${{ matrix.job.arch }}.dmg"
  780. done
  781. - name: Publish DMG package
  782. if: env.UPLOAD_ARTIFACT == 'true'
  783. uses: softprops/action-gh-release@v1
  784. with:
  785. prerelease: true
  786. tag_name: ${{ env.TAG_NAME }}
  787. files: |
  788. rustdesk*-${{ matrix.job.arch }}.dmg
  789. publish_unsigned:
  790. needs:
  791. - build-for-macOS
  792. - build-for-windows-flutter
  793. runs-on: ubuntu-latest
  794. if: ${{ inputs.upload-artifact }}
  795. steps:
  796. - name: Download artifacts
  797. uses: actions/download-artifact@master
  798. with:
  799. name: rustdesk-unsigned-macos-x86_64
  800. path: ./
  801. - name: Download Artifacts
  802. uses: actions/download-artifact@master
  803. with:
  804. name: rustdesk-unsigned-macos-aarch64
  805. path: ./
  806. - name: Download Artifacts
  807. uses: actions/download-artifact@master
  808. with:
  809. name: rustdesk-unsigned-windows-x86_64
  810. path: ./windows-x86_64/
  811. - name: Combine unsigned app
  812. run: |
  813. tar czf rustdesk-${{ env.VERSION }}-unsigned.tar.gz *.dmg windows-x86_64
  814. - name: Publish unsigned app
  815. uses: softprops/action-gh-release@v1
  816. with:
  817. prerelease: true
  818. tag_name: ${{ env.TAG_NAME }}
  819. files: rustdesk-${{ env.VERSION }}-unsigned.tar.gz
  820. build-rustdesk-android:
  821. needs: [generate-bridge]
  822. name: build rustdesk android apk ${{ matrix.job.target }}
  823. runs-on: ${{ matrix.job.os }}
  824. strategy:
  825. fail-fast: false
  826. matrix:
  827. job:
  828. - {
  829. arch: aarch64,
  830. target: aarch64-linux-android,
  831. os: ubuntu-24.04,
  832. reltype: release,
  833. suffix: "",
  834. }
  835. - {
  836. arch: armv7,
  837. target: armv7-linux-androideabi,
  838. os: ubuntu-24.04,
  839. reltype: release,
  840. suffix: "",
  841. }
  842. - {
  843. arch: x86_64,
  844. target: x86_64-linux-android,
  845. os: ubuntu-24.04,
  846. reltype: release,
  847. suffix: "",
  848. }
  849. steps:
  850. - name: Free Disk Space (Ubuntu)
  851. uses: jlumbroso/free-disk-space@main
  852. with:
  853. tool-cache: false
  854. android: false
  855. dotnet: true
  856. haskell: true
  857. large-packages: false
  858. docker-images: true
  859. swap-storage: false
  860. - name: Export GitHub Actions cache environment variables
  861. uses: actions/github-script@v6
  862. with:
  863. script: |
  864. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  865. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  866. - name: Install dependencies
  867. run: |
  868. sudo apt-get update
  869. sudo apt-get install -y \
  870. clang \
  871. cmake \
  872. curl \
  873. gcc-multilib \
  874. git \
  875. g++ \
  876. g++-multilib \
  877. libayatana-appindicator3-dev \
  878. libasound2-dev \
  879. libc6-dev \
  880. libclang-dev \
  881. libunwind-dev \
  882. libgstreamer1.0-dev \
  883. libgstreamer-plugins-base1.0-dev \
  884. libgtk-3-dev \
  885. libpam0g-dev \
  886. libpulse-dev \
  887. libva-dev \
  888. libxcb-randr0-dev \
  889. libxcb-shape0-dev \
  890. libxcb-xfixes0-dev \
  891. libxdo-dev \
  892. libxfixes-dev \
  893. llvm-dev \
  894. nasm \
  895. ninja-build \
  896. openjdk-17-jdk-headless \
  897. pkg-config \
  898. tree \
  899. wget
  900. - name: Checkout source code
  901. uses: actions/checkout@v4
  902. with:
  903. submodules: recursive
  904. - name: Install flutter
  905. uses: subosito/flutter-action@v2
  906. with:
  907. channel: "stable"
  908. flutter-version: ${{ env.ANDROID_FLUTTER_VERSION }}
  909. - name: Patch flutter
  910. run: |
  911. cd $(dirname $(dirname $(which flutter)))
  912. [[ "3.24.5" == ${{env.ANDROID_FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff
  913. - uses: nttld/setup-ndk@v1
  914. id: setup-ndk
  915. with:
  916. ndk-version: ${{ env.NDK_VERSION }}
  917. add-to-path: true
  918. - name: Setup vcpkg with Github Actions binary cache
  919. uses: lukka/run-vcpkg@v11
  920. with:
  921. vcpkgDirectory: /opt/artifacts/vcpkg
  922. vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}
  923. doNotCache: false
  924. - name: Install vcpkg dependencies
  925. run: |
  926. case ${{ matrix.job.target }} in
  927. aarch64-linux-android)
  928. ANDROID_TARGET=arm64-v8a
  929. ;;
  930. armv7-linux-androideabi)
  931. ANDROID_TARGET=armeabi-v7a
  932. ;;
  933. x86_64-linux-android)
  934. ANDROID_TARGET=x86_64
  935. ;;
  936. i686-linux-android)
  937. ANDROID_TARGET=x86
  938. ;;
  939. esac
  940. if ! ./flutter/build_android_deps.sh "${ANDROID_TARGET}"; then
  941. find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do
  942. echo "$_1:"
  943. echo "======"
  944. cat "$_1"
  945. echo "======"
  946. echo ""
  947. done
  948. exit 1
  949. fi
  950. shell: bash
  951. - name: Restore bridge files
  952. uses: actions/download-artifact@master
  953. with:
  954. name: bridge-artifact
  955. path: ./
  956. - name: Install Rust toolchain
  957. uses: dtolnay/rust-toolchain@v1
  958. with:
  959. toolchain: ${{ env.RUST_VERSION }}
  960. components: "rustfmt"
  961. - uses: Swatinem/rust-cache@v2
  962. with:
  963. prefix-key: rustdesk-lib-cache-android # TODO: drop '-android' part after caches are invalidated
  964. key: ${{ matrix.job.target }}
  965. - name: Build rustdesk lib
  966. env:
  967. ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
  968. ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
  969. run: |
  970. rustup target add ${{ matrix.job.target }}
  971. cargo install cargo-ndk --version ${{ env.CARGO_NDK_VERSION }} --locked
  972. case ${{ matrix.job.target }} in
  973. aarch64-linux-android)
  974. ./flutter/ndk_arm64.sh
  975. mkdir -p ./flutter/android/app/src/main/jniLibs/arm64-v8a
  976. cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/librustdesk.so
  977. ;;
  978. armv7-linux-androideabi)
  979. ./flutter/ndk_arm.sh
  980. mkdir -p ./flutter/android/app/src/main/jniLibs/armeabi-v7a
  981. cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/librustdesk.so
  982. ;;
  983. x86_64-linux-android)
  984. ./flutter/ndk_x64.sh
  985. mkdir -p ./flutter/android/app/src/main/jniLibs/x86_64
  986. cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/x86_64/librustdesk.so
  987. ;;
  988. i686-linux-android)
  989. ./flutter/ndk_x86.sh
  990. mkdir -p ./flutter/android/app/src/main/jniLibs/x86
  991. cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/x86/librustdesk.so
  992. ;;
  993. esac
  994. - name: Upload Rustdesk library to Artifacts
  995. uses: actions/upload-artifact@master
  996. with:
  997. name: librustdesk.so.${{ matrix.job.target }}
  998. path: ./target/${{ matrix.job.target }}/release/liblibrustdesk.so
  999. - name: Build rustdesk
  1000. shell: bash
  1001. env:
  1002. JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64
  1003. run: |
  1004. export PATH=/usr/lib/jvm/java-17-openjdk-amd64/bin:$PATH
  1005. # temporary use debug sign config
  1006. sed -i "s/signingConfigs.release/signingConfigs.debug/g" ./flutter/android/app/build.gradle
  1007. case ${{ matrix.job.target }} in
  1008. aarch64-linux-android)
  1009. mkdir -p ./flutter/android/app/src/main/jniLibs/arm64-v8a
  1010. 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/
  1011. cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/librustdesk.so
  1012. # build flutter
  1013. pushd flutter
  1014. flutter build apk "--${{ matrix.job.reltype }}" --target-platform android-arm64 --split-per-abi
  1015. mv build/app/outputs/flutter-apk/app-arm64-v8a-${{ matrix.job.reltype }}.apk ../rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}${{ matrix.job.suffix }}.apk
  1016. ;;
  1017. armv7-linux-androideabi)
  1018. mkdir -p ./flutter/android/app/src/main/jniLibs/armeabi-v7a
  1019. 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/
  1020. cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/librustdesk.so
  1021. # build flutter
  1022. pushd flutter
  1023. flutter build apk "--${{ matrix.job.reltype }}" --target-platform android-arm --split-per-abi
  1024. mv build/app/outputs/flutter-apk/app-armeabi-v7a-${{ matrix.job.reltype }}.apk ../rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}${{ matrix.job.suffix }}.apk
  1025. ;;
  1026. x86_64-linux-android)
  1027. mkdir -p ./flutter/android/app/src/main/jniLibs/x86_64
  1028. cp ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so ./flutter/android/app/src/main/jniLibs/x86_64/
  1029. cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/x86_64/librustdesk.so
  1030. # build flutter
  1031. pushd flutter
  1032. flutter build apk "--${{ matrix.job.reltype }}" --target-platform android-x64 --split-per-abi
  1033. mv build/app/outputs/flutter-apk/app-x86_64-${{ matrix.job.reltype }}.apk ../rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}${{ matrix.job.suffix }}.apk
  1034. ;;
  1035. i686-linux-android)
  1036. mkdir -p ./flutter/android/app/src/main/jniLibs/x86
  1037. cp ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/i686-linux-android/libc++_shared.so ./flutter/android/app/src/main/jniLibs/x86/
  1038. cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/x86/librustdesk.so
  1039. # build flutter
  1040. pushd flutter
  1041. flutter build apk "--${{ matrix.job.reltype }}" --target-platform android-x86 --split-per-abi
  1042. mv build/app/outputs/flutter-apk/app-x86-${{ matrix.job.reltype }}.apk ../rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}${{ matrix.job.suffix }}.apk
  1043. ;;
  1044. esac
  1045. popd
  1046. mkdir -p signed-apk; pushd signed-apk
  1047. mv ../rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}${{ matrix.job.suffix }}.apk .
  1048. # https://github.com/r0adkll/sign-android-release/issues/84#issuecomment-1889636075
  1049. - name: Setup sign tool version variable
  1050. shell: bash
  1051. run: |
  1052. BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
  1053. echo "ANDROID_SIGN_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
  1054. echo Last build tool version is: $BUILD_TOOL_VERSION
  1055. - uses: r0adkll/sign-android-release@v1
  1056. name: Sign app APK
  1057. if: env.ANDROID_SIGNING_KEY != null
  1058. id: sign-rustdesk
  1059. with:
  1060. releaseDirectory: ./signed-apk
  1061. signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
  1062. alias: ${{ secrets.ANDROID_ALIAS }}
  1063. keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
  1064. keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
  1065. env:
  1066. # env.ANDROID_SIGN_TOOL_VERSION is set by Step "Setup sign tool version variable"
  1067. BUILD_TOOLS_VERSION: ${{ env.ANDROID_SIGN_TOOL_VERSION }}
  1068. - name: Upload Artifacts
  1069. if: env.ANDROID_SIGNING_KEY != null && env.UPLOAD_ARTIFACT == 'true'
  1070. uses: actions/upload-artifact@master
  1071. with:
  1072. name: rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.apk
  1073. path: ${{steps.sign-rustdesk.outputs.signedReleaseFile}}
  1074. - name: Publish signed apk package
  1075. if: env.ANDROID_SIGNING_KEY != null && env.UPLOAD_ARTIFACT == 'true'
  1076. uses: softprops/action-gh-release@v1
  1077. with:
  1078. prerelease: true
  1079. tag_name: ${{ env.TAG_NAME }}
  1080. files: |
  1081. ${{steps.sign-rustdesk.outputs.signedReleaseFile}}
  1082. - name: Publish unsigned apk package
  1083. if: env.ANDROID_SIGNING_KEY == null && env.UPLOAD_ARTIFACT == 'true'
  1084. uses: softprops/action-gh-release@v1
  1085. with:
  1086. prerelease: true
  1087. tag_name: ${{ env.TAG_NAME }}
  1088. files: |
  1089. signed-apk/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.apk
  1090. build-rustdesk-android-universal:
  1091. needs: [build-rustdesk-android]
  1092. name: build rustdesk android universal apk
  1093. if: ${{ inputs.upload-artifact }}
  1094. runs-on: ubuntu-24.04
  1095. env:
  1096. reltype: release
  1097. x86_target: "" # can be ",android-x86"
  1098. suffix: ""
  1099. steps:
  1100. - name: Free Disk Space (Ubuntu)
  1101. uses: jlumbroso/free-disk-space@main
  1102. with:
  1103. tool-cache: false
  1104. android: false
  1105. dotnet: true
  1106. haskell: true
  1107. large-packages: false
  1108. docker-images: true
  1109. swap-storage: false
  1110. - name: Export GitHub Actions cache environment variables
  1111. uses: actions/github-script@v6
  1112. with:
  1113. script: |
  1114. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  1115. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  1116. - name: Install dependencies
  1117. run: |
  1118. sudo apt-get update
  1119. sudo apt-get install -y \
  1120. clang \
  1121. cmake \
  1122. curl \
  1123. gcc-multilib \
  1124. git \
  1125. g++ \
  1126. g++-multilib \
  1127. libayatana-appindicator3-dev \
  1128. libasound2-dev \
  1129. libc6-dev \
  1130. libclang-dev \
  1131. libunwind-dev \
  1132. libgstreamer1.0-dev \
  1133. libgstreamer-plugins-base1.0-dev \
  1134. libgtk-3-dev \
  1135. libpam0g-dev \
  1136. libpulse-dev \
  1137. libva-dev \
  1138. libxcb-randr0-dev \
  1139. libxcb-shape0-dev \
  1140. libxcb-xfixes0-dev \
  1141. libxdo-dev \
  1142. libxfixes-dev \
  1143. llvm-dev \
  1144. nasm \
  1145. ninja-build \
  1146. openjdk-17-jdk-headless \
  1147. pkg-config \
  1148. tree \
  1149. wget
  1150. - name: Checkout source code
  1151. uses: actions/checkout@v4
  1152. with:
  1153. submodules: recursive
  1154. - name: Install flutter
  1155. uses: subosito/flutter-action@v2
  1156. with:
  1157. channel: "stable"
  1158. flutter-version: ${{ env.ANDROID_FLUTTER_VERSION }}
  1159. - name: Patch flutter
  1160. run: |
  1161. cd $(dirname $(dirname $(which flutter)))
  1162. [[ "3.24.5" == ${{env.ANDROID_FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff
  1163. - name: Restore bridge files
  1164. uses: actions/download-artifact@master
  1165. with:
  1166. name: bridge-artifact
  1167. path: ./
  1168. - name: Download Rustdesk library from Artifacts
  1169. uses: actions/download-artifact@master
  1170. with:
  1171. name: librustdesk.so.aarch64-linux-android
  1172. path: ./flutter/android/app/src/main/jniLibs/arm64-v8a
  1173. - name: Download Rustdesk library from Artifacts
  1174. uses: actions/download-artifact@master
  1175. with:
  1176. name: librustdesk.so.armv7-linux-androideabi
  1177. path: ./flutter/android/app/src/main/jniLibs/armeabi-v7a
  1178. - name: Download Rustdesk library from Artifacts
  1179. uses: actions/download-artifact@master
  1180. with:
  1181. name: librustdesk.so.x86_64-linux-android
  1182. path: ./flutter/android/app/src/main/jniLibs/x86_64
  1183. - name: Download Rustdesk library from Artifacts
  1184. if: ${{ env.reltype == 'debug' }}
  1185. uses: actions/download-artifact@master
  1186. with:
  1187. name: librustdesk.so.i686-linux-android
  1188. path: ./flutter/android/app/src/main/jniLibs/x86
  1189. - name: Build rustdesk
  1190. shell: bash
  1191. env:
  1192. JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64
  1193. run: |
  1194. export PATH=/usr/lib/jvm/java-17-openjdk-amd64/bin:$PATH
  1195. # temporary use debug sign config
  1196. sed -i "s/signingConfigs.release/signingConfigs.debug/g" ./flutter/android/app/build.gradle
  1197. mv ./flutter/android/app/src/main/jniLibs/arm64-v8a/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/librustdesk.so
  1198. 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/
  1199. mv ./flutter/android/app/src/main/jniLibs/armeabi-v7a/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/librustdesk.so
  1200. 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/
  1201. mv ./flutter/android/app/src/main/jniLibs/x86_64/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/x86_64/librustdesk.so
  1202. cp ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so ./flutter/android/app/src/main/jniLibs/x86_64/
  1203. if [ "${{ env.reltype }}" = "debug" ]; then
  1204. mv ./flutter/android/app/src/main/jniLibs/x86/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/x86/librustdesk.so
  1205. cp ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/i686-linux-android/libc++_shared.so ./flutter/android/app/src/main/jniLibs/x86/
  1206. fi
  1207. # build flutter
  1208. pushd flutter
  1209. flutter build apk "--${{ env.reltype }}" --target-platform android-arm64,android-arm,android-x64${{ env.x86_target }}
  1210. popd
  1211. mkdir -p signed-apk
  1212. mv ./flutter/build/app/outputs/flutter-apk/app-${{ env.reltype }}.apk signed-apk/rustdesk-${{ env.VERSION }}-universal${{ env.suffix }}.apk
  1213. # https://github.com/r0adkll/sign-android-release/issues/84#issuecomment-1889636075
  1214. - name: Setup sign tool version variable
  1215. shell: bash
  1216. run: |
  1217. BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
  1218. echo "ANDROID_SIGN_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
  1219. echo Last build tool version is: $BUILD_TOOL_VERSION
  1220. - uses: r0adkll/sign-android-release@v1
  1221. name: Sign app APK
  1222. if: env.ANDROID_SIGNING_KEY != null
  1223. id: sign-rustdesk
  1224. with:
  1225. releaseDirectory: ./signed-apk
  1226. signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
  1227. alias: ${{ secrets.ANDROID_ALIAS }}
  1228. keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
  1229. keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
  1230. env:
  1231. # env.ANDROID_SIGN_TOOL_VERSION is set by Step "Setup sign tool version variable"
  1232. BUILD_TOOLS_VERSION: ${{ env.ANDROID_SIGN_TOOL_VERSION }}
  1233. - name: Upload Artifacts
  1234. if: env.ANDROID_SIGNING_KEY != null && env.UPLOAD_ARTIFACT == 'true'
  1235. uses: actions/upload-artifact@master
  1236. with:
  1237. name: rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.apk
  1238. path: ${{steps.sign-rustdesk.outputs.signedReleaseFile}}
  1239. - name: Publish signed apk package
  1240. if: env.ANDROID_SIGNING_KEY != null && env.UPLOAD_ARTIFACT == 'true'
  1241. uses: softprops/action-gh-release@v1
  1242. with:
  1243. prerelease: true
  1244. tag_name: ${{ env.TAG_NAME }}
  1245. files: |
  1246. ${{steps.sign-rustdesk.outputs.signedReleaseFile}}
  1247. - name: Publish unsigned apk package
  1248. if: env.ANDROID_SIGNING_KEY == null && env.UPLOAD_ARTIFACT == 'true'
  1249. uses: softprops/action-gh-release@v1
  1250. with:
  1251. prerelease: true
  1252. tag_name: ${{ env.TAG_NAME }}
  1253. files: |
  1254. signed-apk/rustdesk-${{ env.VERSION }}-universal${{ env.suffix }}.apk
  1255. build-rustdesk-linux:
  1256. needs: [generate-bridge]
  1257. name: build rustdesk linux ${{ matrix.job.target }}
  1258. runs-on: ${{ matrix.job.on }}
  1259. strategy:
  1260. fail-fast: false
  1261. matrix:
  1262. # use a high level qemu-user-static
  1263. job:
  1264. - {
  1265. arch: x86_64,
  1266. target: x86_64-unknown-linux-gnu,
  1267. distro: ubuntu18.04,
  1268. on: ubuntu-22.04,
  1269. deb_arch: amd64,
  1270. vcpkg-triplet: x64-linux,
  1271. }
  1272. - {
  1273. arch: aarch64,
  1274. target: aarch64-unknown-linux-gnu,
  1275. distro: ubuntu18.04,
  1276. on: ubuntu-22.04-arm,
  1277. deb_arch: arm64,
  1278. vcpkg-triplet: arm64-linux,
  1279. }
  1280. steps:
  1281. - name: Export GitHub Actions cache environment variables
  1282. uses: actions/github-script@v6
  1283. with:
  1284. script: |
  1285. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  1286. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  1287. - name: Maximize build space
  1288. run: |
  1289. sudo rm -rf /opt/ghc
  1290. sudo rm -rf /usr/local/lib/android
  1291. sudo rm -rf /usr/share/dotnet
  1292. sudo apt-get update -y
  1293. sudo apt-get install -y nasm
  1294. if [[ "${{ matrix.job.arch }}" == "x86_64" ]]; then
  1295. sudo apt-get install -y qemu-user-static
  1296. fi
  1297. - name: Checkout source code
  1298. uses: actions/checkout@v4
  1299. with:
  1300. submodules: recursive
  1301. - name: Set Swap Space
  1302. if: ${{ matrix.job.arch == 'x86_64' }}
  1303. uses: pierotofy/set-swap-space@master
  1304. with:
  1305. swap-size-gb: 12
  1306. - name: Free Space
  1307. run: |
  1308. df -h
  1309. free -m
  1310. - name: Install Rust toolchain
  1311. uses: dtolnay/rust-toolchain@v1
  1312. if: matrix.job.arch == 'x86_64' || env.UPLOAD_ARTIFACT == 'true'
  1313. with:
  1314. toolchain: ${{ env.RUST_VERSION }}
  1315. targets: ${{ matrix.job.target }}
  1316. components: "rustfmt"
  1317. - name: Save Rust toolchain version
  1318. run: |
  1319. RUST_TOOLCHAIN_VERSION=$(cargo --version | awk '{print $2}')
  1320. echo "RUST_TOOLCHAIN_VERSION=$RUST_TOOLCHAIN_VERSION" >> $GITHUB_ENV
  1321. - name: Disable rust bridge build
  1322. run: |
  1323. # only build cdylib
  1324. sed -i "s/\[\"cdylib\", \"staticlib\", \"rlib\"\]/\[\"cdylib\"\]/g" Cargo.toml
  1325. - name: Restore bridge files
  1326. if: matrix.job.arch == 'x86_64' || env.UPLOAD_ARTIFACT == 'true'
  1327. uses: actions/download-artifact@master
  1328. with:
  1329. name: bridge-artifact
  1330. path: ./
  1331. - name: Setup vcpkg with Github Actions binary cache
  1332. if: matrix.job.arch == 'x86_64' || env.UPLOAD_ARTIFACT == 'true'
  1333. uses: lukka/run-vcpkg@v11
  1334. with:
  1335. vcpkgDirectory: /opt/artifacts/vcpkg
  1336. vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}
  1337. doNotCache: false
  1338. - name: Install vcpkg dependencies
  1339. if: matrix.job.arch == 'x86_64' || env.UPLOAD_ARTIFACT == 'true'
  1340. run: |
  1341. sudo apt install -y libva-dev && apt show libva-dev
  1342. if ! $VCPKG_ROOT/vcpkg \
  1343. install \
  1344. --triplet ${{ matrix.job.vcpkg-triplet }} \
  1345. --x-install-root="$VCPKG_ROOT/installed"; then
  1346. find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do
  1347. echo "$_1:"
  1348. echo "======"
  1349. cat "$_1"
  1350. echo "======"
  1351. echo ""
  1352. done
  1353. exit 1
  1354. fi
  1355. head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true
  1356. shell: bash
  1357. - name: Restore bridge files
  1358. if: matrix.job.arch == 'x86_64' || env.UPLOAD_ARTIFACT == 'true'
  1359. uses: actions/download-artifact@master
  1360. with:
  1361. name: bridge-artifact
  1362. path: ./
  1363. - uses: rustdesk-org/run-on-arch-action@amd64-support
  1364. name: Build rustdesk
  1365. id: vcpkg
  1366. if: matrix.job.arch == 'x86_64' || env.UPLOAD_ARTIFACT == 'true'
  1367. with:
  1368. arch: ${{ matrix.job.arch }}
  1369. distro: ${{ matrix.job.distro }}
  1370. githubToken: ${{ github.token }}
  1371. setup: |
  1372. ls -l "${PWD}"
  1373. ls -l /opt/artifacts/vcpkg/installed
  1374. dockerRunArgs: |
  1375. --volume "${PWD}:/workspace"
  1376. --volume "/opt/artifacts:/opt/artifacts"
  1377. shell: /bin/bash
  1378. install: |
  1379. apt-get update -y
  1380. echo -e "installing deps"
  1381. apt-get install -y \
  1382. build-essential \
  1383. clang \
  1384. cmake \
  1385. curl \
  1386. gcc \
  1387. git \
  1388. g++ \
  1389. libayatana-appindicator3-dev \
  1390. libasound2-dev \
  1391. libclang-10-dev \
  1392. libgstreamer1.0-dev \
  1393. libgstreamer-plugins-base1.0-dev \
  1394. libgtk-3-dev \
  1395. libpam0g-dev \
  1396. libpulse-dev \
  1397. libva-dev \
  1398. libxcb-randr0-dev \
  1399. libxcb-shape0-dev \
  1400. libxcb-xfixes0-dev \
  1401. libxdo-dev \
  1402. libxfixes-dev \
  1403. llvm-10-dev \
  1404. nasm \
  1405. ninja-build \
  1406. pkg-config \
  1407. tree \
  1408. python3 \
  1409. rpm \
  1410. unzip \
  1411. wget \
  1412. xz-utils
  1413. # we have libopus compiled by us.
  1414. apt-get remove -y libopus-dev || true
  1415. # output devs
  1416. ls -l ./
  1417. tree -L 3 /opt/artifacts/vcpkg/installed
  1418. run: |
  1419. # disable git safe.directory
  1420. git config --global --add safe.directory "*"
  1421. # rust
  1422. pushd /opt
  1423. # do not use rustup, because memory overflow in qemu
  1424. wget -O rust.tar.gz https://static.rust-lang.org/dist/rust-${{env.RUST_TOOLCHAIN_VERSION}}-${{ matrix.job.target }}.tar.gz
  1425. tar -zxvf rust.tar.gz > /dev/null && rm rust.tar.gz
  1426. cd rust-${{env.RUST_TOOLCHAIN_VERSION}}-${{ matrix.job.target }} && ./install.sh
  1427. rm -rf rust-${{env.RUST_TOOLCHAIN_VERSION}}-${{ matrix.job.target }}
  1428. # edit config
  1429. mkdir -p ~/.cargo/
  1430. echo """
  1431. [source.crates-io]
  1432. registry = 'https://github.com/rust-lang/crates.io-index'
  1433. """ > ~/.cargo/config
  1434. cat ~/.cargo/config
  1435. # start build
  1436. pushd /workspace
  1437. export VCPKG_ROOT=/opt/artifacts/vcpkg
  1438. if [[ "${{ matrix.job.arch }}" == "aarch64" ]]; then
  1439. export JOBS="--jobs 3"
  1440. else
  1441. export JOBS=""
  1442. fi
  1443. echo $JOBS
  1444. cargo build --lib $JOBS --features hwcodec,flutter,unix-file-copy-paste --release
  1445. rm -rf target/release/deps target/release/build
  1446. rm -rf ~/.cargo
  1447. # Setup Flutter
  1448. # disable git safe.directory
  1449. git config --global --add safe.directory "*"
  1450. pushd /workspace
  1451. case ${{ matrix.job.arch }} in
  1452. aarch64)
  1453. export PATH=/opt/flutter-elinux/bin:$PATH
  1454. sed -i "s/flutter build linux --release/flutter-elinux build linux --verbose/g" ./build.py
  1455. sed -i "s/x64\/release/arm64\/release/g" ./build.py
  1456. ;;
  1457. x86_64)
  1458. export PATH=/opt/flutter/bin:$PATH
  1459. ;;
  1460. esac
  1461. popd
  1462. pushd /opt
  1463. wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${{ env.FLUTTER_VERSION }}-stable.tar.xz
  1464. tar xf flutter_linux_${{ env.FLUTTER_VERSION }}-stable.tar.xz
  1465. case ${{ matrix.job.arch }} in
  1466. aarch64)
  1467. # clone repo and reset to flutter ${{ env.FLUTTER_VERSION }}
  1468. git clone https://github.com/sony/flutter-elinux.git || true
  1469. pushd flutter-elinux
  1470. git fetch
  1471. git reset --hard ${{ env.FLUTTER_VERSION }}
  1472. bin/flutter-elinux doctor -v
  1473. bin/flutter-elinux precache --linux
  1474. popd
  1475. cp -R flutter/bin/cache/artifacts/engine/linux-x64/shader_lib flutter-elinux/flutter/bin/cache/artifacts/engine/linux-arm64
  1476. rm -rf flutter
  1477. ;;
  1478. x86_64)
  1479. flutter doctor -v
  1480. ;;
  1481. esac
  1482. if [[ "3.24.5" == ${{ env.FLUTTER_VERSION }} ]]; then
  1483. case ${{ matrix.job.arch }} in
  1484. aarch64)
  1485. pushd /opt/flutter-elinux/flutter
  1486. ;;
  1487. x86_64)
  1488. pushd /opt/flutter
  1489. ;;
  1490. esac
  1491. git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff
  1492. popd
  1493. fi
  1494. # build flutter
  1495. pushd /workspace
  1496. export CARGO_INCREMENTAL=0
  1497. export DEB_ARCH=${{ matrix.job.deb_arch }}
  1498. python3 ./build.py --flutter --skip-cargo
  1499. for name in rustdesk*??.deb; do
  1500. mv "$name" "${name%%.deb}-${{ matrix.job.arch }}.deb"
  1501. done
  1502. # rpm package
  1503. echo -e "start packaging fedora package"
  1504. pushd /workspace
  1505. case ${{ matrix.job.arch }} in
  1506. aarch64)
  1507. sed -i "s/linux\/x64/linux\/arm64/g" ./res/rpm-flutter.spec
  1508. ;;
  1509. esac
  1510. HBB=`pwd` rpmbuild ./res/rpm-flutter.spec -bb
  1511. pushd ~/rpmbuild/RPMS/${{ matrix.job.arch }}
  1512. for name in rustdesk*??.rpm; do
  1513. mv "$name" /workspace/"${name%%.rpm}.rpm"
  1514. done
  1515. # rpm suse package
  1516. echo -e "start packaging suse package"
  1517. pushd /workspace
  1518. case ${{ matrix.job.arch }} in
  1519. aarch64)
  1520. sed -i "s/linux\/x64/linux\/arm64/g" ./res/rpm-flutter-suse.spec
  1521. ;;
  1522. esac
  1523. HBB=`pwd` rpmbuild ./res/rpm-flutter-suse.spec -bb
  1524. pushd ~/rpmbuild/RPMS/${{ matrix.job.arch }}
  1525. for name in rustdesk*??.rpm; do
  1526. mv "$name" /workspace/"${name%%.rpm}-suse.rpm"
  1527. done
  1528. - name: Publish debian/rpm package
  1529. if: env.UPLOAD_ARTIFACT == 'true'
  1530. uses: softprops/action-gh-release@v1
  1531. with:
  1532. prerelease: true
  1533. tag_name: ${{ env.TAG_NAME }}
  1534. files: |
  1535. rustdesk-*.deb
  1536. rustdesk-*.rpm
  1537. - name: Upload deb
  1538. uses: actions/upload-artifact@master
  1539. if: env.UPLOAD_ARTIFACT == 'true'
  1540. with:
  1541. name: rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.deb
  1542. path: rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.deb
  1543. # only x86_64 for arch since we can not find newest arm64 docker image to build
  1544. # old arch image does not make sense for arch since it is "arch" which always update to date
  1545. # and failed to makepkg arm64 on x86_64
  1546. - name: Patch archlinux PKGBUILD
  1547. if: matrix.job.arch == 'x86_64' && env.UPLOAD_ARTIFACT == 'true'
  1548. run: |
  1549. sed -i "s/x86_64/${{ matrix.job.arch }}/g" res/PKGBUILD
  1550. if [[ "${{ matrix.job.arch }}" == "aarch64" ]]; then
  1551. sed -i "s/x86_64/aarch64/g" ./res/PKGBUILD
  1552. fi
  1553. - name: Build archlinux package
  1554. if: matrix.job.arch == 'x86_64' && env.UPLOAD_ARTIFACT == 'true'
  1555. uses: rustdesk-org/arch-makepkg-action@master
  1556. with:
  1557. packages:
  1558. scripts: |
  1559. cd res && HBB=`pwd`/.. FLUTTER=1 makepkg -f
  1560. - name: Publish archlinux package
  1561. if: matrix.job.arch == 'x86_64' && env.UPLOAD_ARTIFACT == 'true'
  1562. uses: softprops/action-gh-release@v1
  1563. with:
  1564. prerelease: true
  1565. tag_name: ${{ env.TAG_NAME }}
  1566. files: |
  1567. res/rustdesk-${{ env.VERSION }}*.zst
  1568. build-rustdesk-linux-sciter:
  1569. if: ${{ inputs.upload-artifact }}
  1570. runs-on: ${{ matrix.job.on }}
  1571. name: build-rustdesk-linux-sciter ${{ matrix.job.target }}
  1572. strategy:
  1573. fail-fast: false
  1574. matrix:
  1575. # use a high level qemu-user-static
  1576. job:
  1577. - {
  1578. arch: x86_64,
  1579. target: x86_64-unknown-linux-gnu,
  1580. on: ubuntu-22.04,
  1581. distro: ubuntu18.04,
  1582. deb_arch: amd64,
  1583. sciter_arch: x64,
  1584. vcpkg-triplet: x64-linux,
  1585. extra_features: ",hwcodec,unix-file-copy-paste",
  1586. }
  1587. - {
  1588. arch: armv7,
  1589. target: armv7-unknown-linux-gnueabihf,
  1590. on: ubuntu-22.04-arm,
  1591. distro: ubuntu18.04-rustdesk,
  1592. deb_arch: armhf,
  1593. sciter_arch: arm32,
  1594. vcpkg-triplet: arm-linux,
  1595. extra_features: ",unix-file-copy-paste",
  1596. }
  1597. steps:
  1598. - name: Export GitHub Actions cache environment variables
  1599. uses: actions/github-script@v6
  1600. with:
  1601. script: |
  1602. core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
  1603. core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
  1604. - name: Checkout source code
  1605. uses: actions/checkout@v4
  1606. with:
  1607. submodules: recursive
  1608. - name: Free Space
  1609. run: |
  1610. df -h
  1611. free -m
  1612. - name: Install Rust toolchain
  1613. uses: dtolnay/rust-toolchain@v1
  1614. with:
  1615. toolchain: ${{ env.SCITER_RUST_VERSION }}
  1616. targets: ${{ matrix.job.target }}
  1617. components: "rustfmt"
  1618. - name: Save Rust toolchain version
  1619. run: |
  1620. RUST_TOOLCHAIN_VERSION=$(cargo --version | awk '{print $2}')
  1621. echo "RUST_TOOLCHAIN_VERSION=$RUST_TOOLCHAIN_VERSION" >> $GITHUB_ENV
  1622. - uses: rustdesk-org/run-on-arch-action@amd64-support
  1623. name: Build rustdesk sciter binary for ${{ matrix.job.arch }}
  1624. id: vcpkg
  1625. with:
  1626. arch: ${{ matrix.job.arch }}
  1627. distro: ${{ matrix.job.distro }}
  1628. githubToken: ${{ github.token }}
  1629. setup: |
  1630. ls -l "${PWD}"
  1631. dockerRunArgs: |
  1632. --volume "${PWD}:/workspace"
  1633. shell: /bin/bash
  1634. install: |
  1635. apt-get update
  1636. apt-get install -y \
  1637. build-essential \
  1638. clang \
  1639. curl \
  1640. gcc \
  1641. git \
  1642. g++ \
  1643. libayatana-appindicator3-dev \
  1644. libasound2-dev \
  1645. libclang-dev \
  1646. libdbus-1-dev \
  1647. libglib2.0-dev \
  1648. libgstreamer1.0-dev \
  1649. libgstreamer-plugins-base1.0-dev \
  1650. libgtk-3-dev \
  1651. liblzma-dev \
  1652. libpam0g-dev \
  1653. libpulse-dev \
  1654. libva-dev \
  1655. libxcb-randr0-dev \
  1656. libxcb-shape0-dev \
  1657. libxcb-xfixes0-dev \
  1658. libxdo-dev \
  1659. libxfixes-dev \
  1660. ninja-build \
  1661. pkg-config \
  1662. python3 \
  1663. python3.7 \
  1664. rpm \
  1665. unzip \
  1666. wget \
  1667. xz-utils \
  1668. zip
  1669. # arm-linux needs CMake and vcokg built from source as there
  1670. # are no prebuilts available from Kitware and Microsoft
  1671. if [ "${{ matrix.job.vcpkg-triplet }}" = "arm-linux" ]; then
  1672. # install gcc/g++ 8 for vcpkg and OpenSSL headers for CMake
  1673. apt-get install -y gcc-8 g++-8 libssl-dev
  1674. # bootstrap CMake amd add it to PATH
  1675. git clone --depth 1 https://github.com/kitware/cmake -b "v${{ env.SCITER_ARMV7_CMAKE_VERSION }}" /tmp/cmake
  1676. pushd /tmp/cmake
  1677. ./bootstrap --generator='Unix Makefiles' "--prefix=/opt/cmake-${{ env.SCITER_ARMV7_CMAKE_VERSION }}-linux-armhf"
  1678. make -j1 install
  1679. popd
  1680. rm -rf /tmp/cmake
  1681. export PATH="/opt/cmake-${{ env.SCITER_ARMV7_CMAKE_VERSION }}-linux-armhf/bin:$PATH"
  1682. fi
  1683. # bootstrap vcpkg and set VCPKG_ROOT
  1684. export VCPKG_ROOT=/opt/artifacts/vcpkg
  1685. mkdir -p /opt/artifacts
  1686. pushd /opt/artifacts
  1687. rm -rf vcpkg
  1688. git clone https://github.com/microsoft/vcpkg
  1689. pushd vcpkg
  1690. git reset --hard ${{ env.VCPKG_COMMIT_ID }}
  1691. # build vcpkg helper executable with gcc-8 for arm-linux but use prebuilt one on x64-linux
  1692. if [ "${{ matrix.job.vcpkg-triplet }}" = "arm-linux" ]; then
  1693. CC=/usr/bin/gcc-8 CXX=/usr/bin/g++-8 sh bootstrap-vcpkg.sh -disableMetrics
  1694. else
  1695. sh bootstrap-vcpkg.sh -disableMetrics
  1696. fi
  1697. popd
  1698. popd
  1699. # rust
  1700. pushd /opt
  1701. # do not use rustup, because memory overflow in qemu
  1702. wget --output-document rust.tar.gz https://static.rust-lang.org/dist/rust-${{env.RUST_TOOLCHAIN_VERSION}}-${{ matrix.job.target }}.tar.gz
  1703. tar -zxvf rust.tar.gz > /dev/null && rm rust.tar.gz
  1704. pushd rust-${{env.RUST_TOOLCHAIN_VERSION}}-${{ matrix.job.target }}
  1705. ./install.sh
  1706. popd
  1707. rm -rf rust-${{env.RUST_TOOLCHAIN_VERSION}}-${{ matrix.job.target }}
  1708. popd
  1709. # install newer nasm for aom
  1710. wget --output-document nasm.deb "http://ftp.us.debian.org/debian/pool/main/n/nasm/nasm_${{ env.SCITER_NASM_DEBVERSION }}_${{ matrix.job.deb_arch }}.deb"
  1711. dpkg -i nasm.deb
  1712. rm -f nasm.deb
  1713. run: |
  1714. # disable git safe.directory
  1715. git config --global --add safe.directory "*"
  1716. # set python3.7 as default python3
  1717. update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
  1718. # add built CMake to PATH and set VCPKG_FORCE_SYSTEM_BINARIES Afor arm-linux
  1719. if [ "${{ matrix.job.vcpkg-triplet }}" = "arm-linux" ]; then
  1720. export PATH="/opt/cmake-${{ env.SCITER_ARMV7_CMAKE_VERSION }}-linux-armhf/bin:$PATH"
  1721. export VCPKG_FORCE_SYSTEM_BINARIES=1
  1722. fi
  1723. # edit cargo config
  1724. mkdir -p ~/.cargo/
  1725. echo """
  1726. [source.crates-io]
  1727. registry = 'https://github.com/rust-lang/crates.io-index'
  1728. """ > ~/.cargo/config
  1729. cat ~/.cargo/config
  1730. # install dependencies from vcpkg
  1731. export VCPKG_ROOT=/opt/artifacts/vcpkg
  1732. # remove this when support higher version
  1733. export USE_AOM_391=1
  1734. if ! $VCPKG_ROOT/vcpkg install --triplet ${{ matrix.job.vcpkg-triplet }} --x-install-root="$VCPKG_ROOT/installed"; then
  1735. find "${VCPKG_ROOT}/" -name "*.log" | while read -r _1; do
  1736. echo "$_1:"
  1737. echo "======"
  1738. cat "$_1"
  1739. echo "======"
  1740. echo ""
  1741. done
  1742. exit 1
  1743. fi
  1744. head -n 100 "${VCPKG_ROOT}/buildtrees/ffmpeg/build-${{ matrix.job.vcpkg-triplet }}-rel-out.log" || true
  1745. # build rustdesk
  1746. python3 ./res/inline-sciter.py
  1747. export CARGO_INCREMENTAL=0
  1748. cargo build --features inline${{ matrix.job.extra_features }} --release --bins --jobs 1
  1749. # make debian package
  1750. mkdir -p ./Release
  1751. mv ./target/release/rustdesk ./Release/rustdesk
  1752. wget -O ./Release/libsciter-gtk.so https://github.com/c-smile/sciter-sdk/raw/master/bin.lnx/${{ matrix.job.sciter_arch }}/libsciter-gtk.so
  1753. export DEB_ARCH=${{ matrix.job.deb_arch }}
  1754. ./build.py --package ./Release
  1755. - name: Rename rustdesk
  1756. shell: bash
  1757. run: |
  1758. for name in rustdesk*??.deb; do
  1759. # use cp to duplicate deb files to fit other packages.
  1760. cp "$name" "${name%%.deb}-${{ matrix.job.arch }}-sciter.deb"
  1761. done
  1762. - name: Publish debian package
  1763. if: env.UPLOAD_ARTIFACT == 'true'
  1764. uses: softprops/action-gh-release@v1
  1765. with:
  1766. prerelease: true
  1767. tag_name: ${{ env.TAG_NAME }}
  1768. files: |
  1769. rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}-sciter.deb
  1770. - name: Upload deb
  1771. uses: actions/upload-artifact@master
  1772. if: env.UPLOAD_ARTIFACT == 'true'
  1773. with:
  1774. name: rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}-sciter.deb
  1775. path: rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}-sciter.deb
  1776. build-appimage:
  1777. name: Build appimage ${{ matrix.job.target }}
  1778. needs: [build-rustdesk-linux]
  1779. runs-on: ubuntu-22.04
  1780. if: ${{ inputs.upload-artifact }}
  1781. strategy:
  1782. fail-fast: false
  1783. matrix:
  1784. job:
  1785. - { target: x86_64-unknown-linux-gnu, arch: x86_64 }
  1786. - { target: aarch64-unknown-linux-gnu, arch: aarch64 }
  1787. steps:
  1788. - name: Checkout source code
  1789. uses: actions/checkout@v4
  1790. with:
  1791. submodules: recursive
  1792. - name: Download Binary
  1793. uses: actions/download-artifact@master
  1794. with:
  1795. name: rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.deb
  1796. path: .
  1797. - name: Rename Binary
  1798. run: |
  1799. mv rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.deb appimage/rustdesk.deb
  1800. - name: Build appimage package
  1801. shell: bash
  1802. run: |
  1803. # install libarchive-tools for bsdtar command used in AppImageBuilder.yml
  1804. sudo apt-get update -y
  1805. # https://github.com/AppImage/AppImageKit/wiki/FUSE
  1806. sudo apt-get install -y libarchive-tools libfuse2
  1807. # set-up appimage-builder
  1808. pushd /tmp
  1809. wget -O appimage-builder-x86_64.AppImage https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage
  1810. chmod +x appimage-builder-x86_64.AppImage
  1811. sudo mv appimage-builder-x86_64.AppImage /usr/local/bin/appimage-builder
  1812. popd
  1813. # run appimage-builder
  1814. pushd appimage
  1815. sudo appimage-builder --skip-tests --recipe ./AppImageBuilder-${{ matrix.job.arch }}.yml
  1816. - name: Publish appimage package
  1817. if: env.UPLOAD_ARTIFACT == 'true'
  1818. uses: softprops/action-gh-release@v1
  1819. with:
  1820. prerelease: true
  1821. tag_name: ${{ env.TAG_NAME }}
  1822. files: |
  1823. ./appimage/rustdesk-${{ env.VERSION }}-*.AppImage
  1824. build-flatpak:
  1825. name: Build flatpak ${{ matrix.job.target }}${{ matrix.job.suffix }}
  1826. needs:
  1827. - build-rustdesk-linux
  1828. - build-rustdesk-linux-sciter
  1829. runs-on: ${{ matrix.job.on }}
  1830. if: ${{ inputs.upload-artifact }}
  1831. strategy:
  1832. fail-fast: false
  1833. matrix:
  1834. job:
  1835. - {
  1836. target: x86_64-unknown-linux-gnu,
  1837. distro: ubuntu18.04,
  1838. on: ubuntu-22.04,
  1839. arch: x86_64,
  1840. suffix: "",
  1841. }
  1842. - {
  1843. target: x86_64-unknown-linux-gnu,
  1844. distro: ubuntu18.04,
  1845. on: ubuntu-22.04,
  1846. arch: x86_64,
  1847. suffix: "-sciter",
  1848. }
  1849. - {
  1850. target: aarch64-unknown-linux-gnu,
  1851. # try out newer flatpak since error of "error: Nothing matches org.freedesktop.Platform in remote flathub"
  1852. distro: ubuntu22.04,
  1853. on: ubuntu-22.04-arm,
  1854. arch: aarch64,
  1855. suffix: "",
  1856. }
  1857. steps:
  1858. - name: Checkout source code
  1859. uses: actions/checkout@v4
  1860. with:
  1861. submodules: recursive
  1862. - name: Download Binary
  1863. uses: actions/download-artifact@master
  1864. with:
  1865. name: rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}${{ matrix.job.suffix }}.deb
  1866. path: .
  1867. - name: Rename Binary
  1868. run: |
  1869. mv rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}${{ matrix.job.suffix }}.deb flatpak/rustdesk.deb
  1870. - uses: rustdesk-org/run-on-arch-action@amd64-support
  1871. name: Build rustdesk flatpak package for ${{ matrix.job.arch }}
  1872. id: flatpak
  1873. with:
  1874. arch: ${{ matrix.job.arch }}
  1875. distro: ${{ matrix.job.distro }}
  1876. githubToken: ${{ github.token }}
  1877. setup: |
  1878. ls -l "${PWD}"
  1879. dockerRunArgs: |
  1880. --volume "${PWD}:/workspace"
  1881. shell: /bin/bash
  1882. install: |
  1883. apt-get update -y
  1884. apt-get install -y git flatpak flatpak-builder
  1885. run: |
  1886. # disable git safe.directory
  1887. git config --global --add safe.directory "*"
  1888. pushd /workspace
  1889. # flatpak deps
  1890. flatpak --user remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
  1891. # package
  1892. pushd flatpak
  1893. git clone https://github.com/flathub/shared-modules.git --depth=1
  1894. flatpak-builder --user --install-deps-from=flathub -y --force-clean --repo=repo ./build ./rustdesk.json
  1895. flatpak build-bundle ./repo rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}${{ matrix.job.suffix }}.flatpak com.rustdesk.RustDesk
  1896. - name: Publish flatpak package
  1897. uses: softprops/action-gh-release@v1
  1898. with:
  1899. prerelease: true
  1900. tag_name: ${{ env.TAG_NAME }}
  1901. files: |
  1902. flatpak/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}${{ matrix.job.suffix }}.flatpak
  1903. build-rustdesk-web:
  1904. if: False
  1905. name: build-rustdesk-web
  1906. runs-on: ubuntu-22.04
  1907. strategy:
  1908. fail-fast: false
  1909. env:
  1910. RELEASE_NAME: web-basic
  1911. steps:
  1912. - name: Checkout source code
  1913. uses: actions/checkout@v4
  1914. with:
  1915. submodules: recursive
  1916. - name: Prepare env
  1917. run: |
  1918. sudo apt-get update -y
  1919. sudo apt-get install -y wget npm
  1920. - name: Install flutter
  1921. uses: subosito/flutter-action@v2.12.0 #https://github.com/subosito/flutter-action/issues/277
  1922. with:
  1923. channel: "stable"
  1924. flutter-version: ${{ env.FLUTTER_VERSION }}
  1925. - name: Patch flutter
  1926. shell: bash
  1927. run: |
  1928. cd $(dirname $(dirname $(which flutter)))
  1929. [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]] && git apply ${{ github.workspace }}/.github/patches/flutter_3.24.4_dropdown_menu_enableFilter.diff
  1930. # https://rustdesk.com/docs/en/dev/build/web/
  1931. - name: Build web
  1932. shell: bash
  1933. run: |
  1934. pushd flutter/web/js
  1935. npm install yarn -g
  1936. npm install typescript -g
  1937. npm install protoc -g
  1938. # Install protoc first, see: https://google.github.io/proto-lens/installing-protoc.html
  1939. npm install ts-proto
  1940. # Only works with vite <= 2.8, see: https://github.com/vitejs/vite/blob/main/docs/guide/build.md#chunking-strategy
  1941. npm install vite@2.8
  1942. yarn install && yarn build
  1943. popd
  1944. pushd flutter/web
  1945. wget https://github.com/rustdesk/doc.rustdesk.com/releases/download/console/web_deps.tar.gz
  1946. tar xzf web_deps.tar.gz
  1947. popd
  1948. pushd flutter
  1949. flutter build web --release
  1950. cd build
  1951. cp ../web/README.md web
  1952. # TODO: Remove the following line when the web is almost complete.
  1953. echo -e "\n\nThis build is for preview and not full functionality." >> web/README.md
  1954. dir_name="rustdesk-${{ env.VERSION }}-${{ env.RELEASE_NAME }}"
  1955. mv web "${dir_name}" && tar czf "${dir_name}".tar.gz "${dir_name}"
  1956. sha256sum "${dir_name}".tar.gz
  1957. popd
  1958. - name: Publish web
  1959. if: env.UPLOAD_ARTIFACT == 'true'
  1960. uses: softprops/action-gh-release@v1
  1961. with:
  1962. prerelease: true
  1963. tag_name: ${{ env.TAG_NAME }}
  1964. files: |
  1965. flutter/build/rustdesk-${{ env.VERSION }}-${{ env.RELEASE_NAME }}.tar.gz