build.yml 14 KB

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