flutter-build.yml 80 KB

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