build.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. name: Package-Build
  2. on: [push, pull_request]
  3. jobs:
  4. Lint:
  5. runs-on: ubuntu-20.04
  6. steps:
  7. - name: Checkout
  8. uses: actions/checkout@v3
  9. with:
  10. fetch-depth: 0
  11. - name: Installing Node
  12. uses: actions/[email protected]
  13. with:
  14. node-version: 16
  15. - name: Install deps
  16. run: |
  17. npm i -g [email protected]
  18. cd app
  19. yarn
  20. cd ..
  21. rm app/node_modules/.yarn-integrity
  22. yarn
  23. - name: Build typings
  24. run: yarn run build:typings
  25. - name: Lint
  26. run: yarn run lint
  27. macOS-Build:
  28. runs-on: macos-12
  29. needs: Lint
  30. strategy:
  31. matrix:
  32. include:
  33. - arch: x86_64
  34. - arch: arm64
  35. fail-fast: false
  36. steps:
  37. - name: Checkout
  38. uses: actions/checkout@v3
  39. with:
  40. fetch-depth: 0
  41. - name: Installing Node
  42. uses: actions/[email protected]
  43. with:
  44. node-version: 16
  45. - name: Install deps
  46. run: |
  47. sudo -H pip install setuptools
  48. sudo npm i -g [email protected] node-gyp@10
  49. yarn --network-timeout 1000000
  50. env:
  51. ARCH: ${{matrix.arch}}
  52. - name: Fix cross build
  53. run: |
  54. rm -rf app/node_modules/cpu-features
  55. rm -rf app/node_modules/ssh2/crypto/build
  56. if: matrix.arch == 'arm64'
  57. - name: Webpack
  58. run: yarn run build
  59. - name: Prepackage plugins
  60. run: scripts/prepackage-plugins.mjs
  61. env:
  62. ARCH: ${{matrix.arch}}
  63. - run: sed -i '' 's/updateInfo = await/\/\/updateInfo = await/g' node_modules/app-builder-lib/out/targets/ArchiveTarget.js
  64. # Work around electron-builder beta bug
  65. - run: ln -s ../../node_modules/electron app/node_modules
  66. - name: Build and sign packages
  67. run: scripts/build-macos.mjs
  68. if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags'))
  69. env:
  70. ARCH: ${{matrix.arch}}
  71. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  72. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  73. CSC_LINK: ${{ secrets.CSC_LINK }}
  74. CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
  75. APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
  76. APPSTORE_USERNAME: ${{ secrets.APPSTORE_USERNAME }}
  77. APPSTORE_PASSWORD: ${{ secrets.APPSTORE_PASSWORD }}
  78. USE_HARD_LINKS: false
  79. # DEBUG: electron-builder,electron-builder:*
  80. - name: Build packages without signing
  81. run: scripts/build-macos.mjs
  82. if: "! (github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))"
  83. env:
  84. ARCH: ${{matrix.arch}}
  85. # DEBUG: electron-builder,electron-builder:*
  86. - name: Upload symbols
  87. run: |
  88. sudo npm install -g @sentry/cli --unsafe-perm
  89. ./scripts/sentry-upload.mjs
  90. env:
  91. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  92. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  93. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  94. - name: Package artifacts
  95. run: |
  96. mkdir artifact-dmg
  97. mv dist/*.dmg artifact-dmg/
  98. mkdir artifact-zip
  99. mv dist/*.zip artifact-zip/
  100. - uses: actions/upload-artifact@master
  101. name: Upload DMG
  102. with:
  103. name: macOS .dmg (${{matrix.arch}})
  104. path: artifact-dmg
  105. - uses: actions/upload-artifact@master
  106. name: Upload ZIP
  107. with:
  108. name: macOS .zip (${{matrix.arch}})
  109. path: artifact-zip
  110. Linux-Build:
  111. runs-on: ubuntu-20.04
  112. needs: Lint
  113. strategy:
  114. matrix:
  115. include:
  116. - build-arch: x64
  117. arch: amd64
  118. - build-arch: arm64
  119. arch: arm64
  120. triplet: aarch64-linux-gnu-
  121. - build-arch: arm
  122. arch: armhf
  123. triplet: arm-linux-gnueabihf-
  124. env:
  125. CC: ${{matrix.triplet}}gcc
  126. CXX: ${{matrix.triplet}}g++
  127. ARCH: ${{matrix.build-arch}}
  128. npm_config_arch: ${{matrix.build-arch}}
  129. npm_config_target_arch: ${{matrix.build-arch}}
  130. steps:
  131. - name: Checkout
  132. uses: actions/checkout@v3
  133. with:
  134. fetch-depth: 0
  135. - name: Install Node
  136. uses: actions/[email protected]
  137. with:
  138. node-version: 18
  139. - name: Install deps (amd64)
  140. run: |
  141. sudo apt-get update
  142. sudo apt-get install libarchive-tools zsh python3-distutils
  143. - name: Install npm_modules (amd64)
  144. run: |
  145. npm i -g yarn
  146. yarn --network-timeout 1000000
  147. if: matrix.build-arch == 'x64'
  148. - name: Setup Crossbuild (${{matrix.arch}})
  149. run: |
  150. sudo apt-get update -y && sudo apt-get install schroot sbuild debootstrap -y
  151. sudo debootstrap --include=git,curl,gnupg,ca-certificates,crossbuild-essential-${{matrix.arch}},python-dev,python3-dev,libarchive-tools,cmake --variant=buildd --exclude=snapd --components=main,restricted,universe,multiverse --extractor=dpkg-deb bionic /build-chroot/
  152. echo 'deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse' | sudo tee /build-chroot/etc/apt/sources.list >/dev/null
  153. echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports bionic main restricted universe multiverse' | sudo tee -a /build-chroot/etc/apt/sources.list >/dev/null
  154. curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee /build-chroot/etc/apt/trusted.gpg.d/nodesource.gpg >/dev/null
  155. echo 'deb http://deb.nodesource.com/node_16.x bionic main' | sudo tee /build-chroot/etc/apt/sources.list.d/nodesource.list >/dev/null
  156. echo "[build-chroot]
  157. description=Ubuntu 18.04 Build chroot
  158. type=directory
  159. directory=/build-chroot
  160. root-groups=root,sudo
  161. profile=buildd
  162. personality=linux
  163. union-type=overlay" | sudo tee /etc/schroot/chroot.d/build-chroot.pref >/dev/null
  164. echo "/home /home none rw,bind 0 0" | sudo tee -a /etc/schroot/buildd/fstab >/dev/null
  165. if: matrix.build-arch != 'x64'
  166. - name: Install node_modules & CrossBuild native modules for ${{matrix.arch}}
  167. run: |
  168. sudo schroot -c build-chroot -u root -- bash -c "apt-get update -y
  169. dpkg --add-architecture ${{matrix.arch}}
  170. apt-get install -y nodejs libfontconfig-dev:${{matrix.arch}} libsecret-1-dev:${{matrix.arch}} libnss3:${{matrix.arch}} libatk1.0-0:${{matrix.arch}} libatk-bridge2.0-0:${{matrix.arch}} libgdk-pixbuf2.0-0:${{matrix.arch}} libgtk-3-0:${{matrix.arch}} libgbm1:${{matrix.arch}}
  171. export CC=${{matrix.triplet}}gcc CXX=${{matrix.triplet}}g++ LD=${{matrix.triplet}}ld
  172. if [[ ${{matrix.arch}} == 'arm64' ]]; then
  173. export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/aarch64-linux-gnu/pkgconfig/
  174. elif [[ ${{matrix.arch}} == 'armhf' ]]; then
  175. export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/arm-linux-gnueabihf/pkgconfig/
  176. fi
  177. export ARCH=${{matrix.build-arch}} npm_config_arch=${{matrix.build-arch}} npm_config_target_arch=${{matrix.build-arch}}
  178. npm i -g yarn
  179. yarn --network-timeout 1000000 --arch=${{matrix.build-arch}} --target_arch=${{matrix.build-arch}}"
  180. if: matrix.build-arch != 'x64'
  181. - name: Webpack (${{matrix.arch}})
  182. run: yarn run build --arch=${{matrix.build-arch}} --target_arch=${{matrix.build-arch}}
  183. - name: Prepackage plugins (${{matrix.arch}})
  184. run: scripts/prepackage-plugins.mjs
  185. - name: Build packages (${{matrix.arch}})
  186. run: scripts/build-linux.mjs
  187. env:
  188. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  189. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  190. USE_HARD_LINKS: false
  191. # DEBUG: electron-builder,electron-builder:*
  192. - name: Build web resources
  193. run: zsh -c 'tar czf tabby-web.tar.gz (tabby-*|web)/dist'
  194. if: matrix.build-arch == 'x64'
  195. # - name: Install deps and Build (arm64)
  196. # uses: docker://multiarch/ubuntu-core:arm64-bionic
  197. # with:
  198. # args: >
  199. # bash -c
  200. # "apt update && apt install curl lsb-release gnupg -y &&
  201. # curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&
  202. # apt install make build-essential git ruby libarchive-tools nodejs rpm libsecret-1-dev libfontconfig1-dev -y &&
  203. # git config --global --add safe.directory /github/workspace &&
  204. # gem install public_suffix -v 4.0.7 &&
  205. # gem install fpm --no-document &&
  206. # npm i -g yarn &&
  207. # cd /github/workspace &&
  208. # yarn --network-timeout 1000000 &&
  209. # yarn run build &&
  210. # scripts/prepackage-plugins.mjs &&
  211. # USE_SYSTEM_FPM=true scripts/build-linux.mjs"
  212. # env:
  213. # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  214. # KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  215. # USE_HARD_LINKS: false
  216. # if: matrix.build-arch == 'arm64' && github.repository == 'Eugeny/tabby' && startsWith(github.ref, 'refs/tags')
  217. # - name: Install deps and Build (armv7l)
  218. # uses: docker://multiarch/ubuntu-core:armhf-bionic
  219. # with:
  220. # args: >
  221. # bash -c
  222. # "apt update && apt install curl lsb-release gnupg -y &&
  223. # curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&
  224. # apt install make build-essential git ruby libarchive-tools nodejs rpm libsecret-1-dev libfontconfig1-dev -y &&
  225. # git config --global --add safe.directory /github/workspace &&
  226. # gem install public_suffix -v 4.0.7 &&
  227. # gem install fpm --no-document &&
  228. # npm i -g yarn &&
  229. # cd /github/workspace &&
  230. # sed -i '/ \"electron\":/c\ \"electron\": \"17.0.0\",' package.json &&
  231. # yarn --network-timeout 1000000 &&
  232. # yarn run build &&
  233. # scripts/prepackage-plugins.mjs &&
  234. # USE_SYSTEM_FPM=true scripts/build-linux.mjs"
  235. # env:
  236. # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  237. # KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  238. # USE_HARD_LINKS: false
  239. # if: matrix.build-arch == 'arm' && github.repository == 'Eugeny/tabby' && startsWith(github.ref, 'refs/tags')
  240. - name: Upload symbols (amd64 only)
  241. run: |
  242. sudo npm install -g @sentry/cli --unsafe-perm
  243. ./scripts/sentry-upload.mjs
  244. if: matrix.build-arch == 'x64'
  245. env:
  246. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  247. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  248. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  249. - name: Upload packages to packagecloud.io
  250. uses: Eugeny/packagecloud-action@main
  251. if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
  252. env:
  253. PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
  254. with:
  255. repo: 'eugeny/tabby'
  256. dir: 'dist'
  257. - uses: actions/upload-artifact@master
  258. name: Upload AppImage (${{matrix.arch}})
  259. with:
  260. name: Linux AppImage (${{matrix.arch}})
  261. path: dist/*.AppImage
  262. - uses: actions/upload-artifact@master
  263. name: Upload DEB (${{matrix.arch}})
  264. with:
  265. name: Linux DEB (${{matrix.arch}})
  266. path: dist/*.deb
  267. - uses: actions/upload-artifact@master
  268. name: Upload RPM (${{matrix.arch}})
  269. with:
  270. name: Linux RPM (${{matrix.arch}})
  271. path: dist/*.rpm
  272. - uses: actions/upload-artifact@master
  273. name: Upload Pacman Package (${{matrix.arch}})
  274. with:
  275. name: Linux Pacman (${{matrix.arch}})
  276. path: dist/*.pacman
  277. - uses: actions/upload-artifact@master
  278. name: Upload Linux tarball (${{matrix.arch}})
  279. with:
  280. name: Linux tarball (${{matrix.arch}})
  281. path: dist/*.tar.gz
  282. - uses: actions/upload-artifact@master
  283. name: Upload web tarball (amd64 only)
  284. with:
  285. name: Web tarball
  286. path: tabby-web.tar.gz
  287. if: matrix.build-arch == 'x64'
  288. Windows-Build:
  289. runs-on: windows-2022
  290. needs: Lint
  291. strategy:
  292. matrix:
  293. include:
  294. - arch: x64
  295. - arch: arm64
  296. fail-fast: false
  297. steps:
  298. - name: Checkout
  299. uses: actions/checkout@v3
  300. with:
  301. fetch-depth: 0
  302. - name: Installing Node
  303. uses: actions/[email protected]
  304. with:
  305. node-version: 16
  306. - name: Update node-gyp
  307. run: |
  308. npm install --global [email protected]
  309. npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
  310. - name: Build
  311. shell: powershell
  312. run: |
  313. npm i -g [email protected]
  314. yarn --network-timeout 1000000
  315. yarn run build
  316. node scripts/prepackage-plugins.mjs
  317. env:
  318. ARCH: ${{matrix.arch}}
  319. - name: Build and sign packages
  320. run: node scripts/build-windows.mjs
  321. if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags'))
  322. env:
  323. ARCH: ${{matrix.arch}}
  324. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  325. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  326. WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
  327. WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
  328. DEBUG: electron-builder,electron-builder:*
  329. - name: Build packages without signing
  330. run: node scripts/build-windows.mjs
  331. if: "!(github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))"
  332. env:
  333. ARCH: ${{matrix.arch}}
  334. - name: Upload symbols
  335. run: |
  336. npm install @sentry/cli
  337. node scripts/sentry-upload.mjs
  338. env:
  339. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  340. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  341. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  342. - name: Package artifacts
  343. run: |
  344. mkdir artifact-setup
  345. mv dist/*-setup-*.exe artifact-setup/
  346. mkdir artifact-portable
  347. mv dist/*-portable-*.zip artifact-portable/
  348. - uses: actions/upload-artifact@master
  349. name: Upload installer
  350. with:
  351. name: Windows installer (${{matrix.arch}})
  352. path: artifact-setup
  353. - uses: actions/upload-artifact@master
  354. name: Upload portable build
  355. with:
  356. name: Windows portable build (${{matrix.arch}})
  357. path: artifact-portable