flutter-build.yml 81 KB

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