build.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  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: 18
  15. - name: Install deps
  16. run: |
  17. npm i -g yarn
  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. rust_triple: x86_64-apple-darwin
  35. - arch: arm64
  36. rust_triple: aarch64-apple-darwin
  37. fail-fast: false
  38. env:
  39. ARCH: ${{matrix.arch}}
  40. RUST_TARGET_TRIPLE: ${{matrix.rust_triple}}
  41. steps:
  42. - name: Checkout
  43. uses: actions/checkout@v3
  44. with:
  45. fetch-depth: 0
  46. - name: Installing Node
  47. uses: actions/[email protected]
  48. with:
  49. node-version: 18
  50. - run: rustup target add ${{matrix.rust_triple}}
  51. - name: Install deps
  52. run: |
  53. sudo -H pip3 install setuptools
  54. sudo npm i -g yarn
  55. yarn --network-timeout 1000000
  56. env:
  57. ARCH: ${{matrix.arch}}
  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. rust_triple: x86_64-unknown-linux-gnu
  120. - build-arch: arm64
  121. arch: arm64
  122. rust_triple: aarch64-unknown-linux-gnu
  123. triplet: aarch64-linux-gnu-
  124. - build-arch: arm
  125. arch: armhf
  126. rust_triple: arm-unknown-linux-gnueabihf
  127. triplet: arm-linux-gnueabihf-
  128. fail-fast: false
  129. env:
  130. CC: ${{matrix.triplet}}gcc
  131. CXX: ${{matrix.triplet}}g++
  132. ARCH: ${{matrix.build-arch}}
  133. npm_config_arch: ${{matrix.build-arch}}
  134. npm_config_target_arch: ${{matrix.build-arch}}
  135. RUST_TARGET_TRIPLE: ${{matrix.rust_triple}}
  136. steps:
  137. - name: Checkout
  138. uses: actions/checkout@v3
  139. with:
  140. fetch-depth: 0
  141. - name: Install Node
  142. uses: actions/[email protected]
  143. with:
  144. node-version: 18
  145. - run: rustup target add ${{matrix.rust_triple}}
  146. - name: Install dependencies
  147. run: |
  148. sudo apt-get update
  149. sudo apt-get install libarchive-tools zsh crossbuild-essential-${{matrix.arch}}
  150. - name: Setup tar to run as root
  151. run: sudo chmod u+s "$(command -v tar)"
  152. if: matrix.build-arch != 'x64'
  153. - name: Download cached sysroot
  154. uses: actions/cache@v3
  155. id: dl-cached-sysroot
  156. if: matrix.build-arch !='x64'
  157. with:
  158. key: sysroot-${{matrix.build-arch}}
  159. path: /${{matrix.build-arch}}-sysroot
  160. - name: Setup crossbuild sysroot
  161. run: |
  162. sudo apt-get update -y && sudo apt-get install debootstrap qemu-user-static binfmt-support -y
  163. sudo qemu-debootstrap --include=libfontconfig1-dev,libsecret-1-dev,libnss3,libatk1.0-0,libatk-bridge2.0-0,libgdk-pixbuf2.0-0,libgtk-3-0,libgbm1 --variant=buildd --exclude=snapd --components=main,restricted,universe,multiverse --extractor=dpkg-deb --arch ${{matrix.arch}} bionic /${{matrix.build-arch}}-sysroot/ http://ports.ubuntu.com/ubuntu-ports/
  164. sudo find /${{matrix.build-arch}}-sysroot -type l -lname '/*' -exec sh -c 'file="$0"; dir=$(dirname "$file"); target=$(readlink "$0"); prefix=$(dirname "$dir" | sed 's@[^/]*@\.\.@g'); newtarget="$prefix$target"; ln -snf $newtarget $file' {} \; ;
  165. if: matrix.build-arch != 'x64' && steps.dl-cached-sysroot.outputs.cache-hit != 'true'
  166. - name: Setup env to use ${{matrix.build-arch}} sysroot
  167. run: |
  168. echo "CFLAGS=--sysroot=/${{matrix.build-arch}}-sysroot/" >> $GITHUB_ENV
  169. echo "CXXFLAGS=--sysroot=/${{matrix.build-arch}}-sysroot/" >> $GITHUB_ENV
  170. echo "LDFLAGS=--sysroot=/${{matrix.build-arch}}-sysroot/" >> $GITHUB_ENV
  171. [[ ${npm_config_arch} == 'arm' ]] && echo "npm_config_arch=armv7l" >> $GITHUB_ENV
  172. if [[ ${{matrix.arch}} == 'armhf' ]]; then
  173. echo "PKG_CONFIG_PATH=/${{matrix.build-arch}}-sysroot/usr/lib/pkgconfig/:/${{matrix.build-arch}}-sysroot/usr/lib/arm-linux-gnueabihf/pkgconfig/" >> $GITHUB_ENV
  174. elif [[ ${{matrix.arch}} == 'arm64' ]]; then
  175. echo "PKG_CONFIG_PATH=/${{matrix.build-arch}}-sysroot/usr/lib/pkgconfig/:/${{matrix.build-arch}}-sysroot/usr/lib/aarch64-linux-gnu/pkgconfig/" >> $GITHUB_ENV
  176. fi
  177. if: matrix.build-arch != 'x64'
  178. - name: Install npm_modules (amd64)
  179. run: |
  180. npm i -g yarn node-gyp
  181. yarn --network-timeout 1000000 --arch=${{matrix.build-arch}} --target-arch=${{matrix.build-arch}}
  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 (amd64 only)
  194. run: zsh -c 'tar czf tabby-web.tar.gz (tabby-*|web)/dist'
  195. if: matrix.build-arch == 'x64'
  196. - name: Upload symbols (amd64 only)
  197. run: |
  198. sudo npm install -g @sentry/cli --unsafe-perm
  199. ./scripts/sentry-upload.mjs
  200. if: matrix.build-arch == 'x64'
  201. env:
  202. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  203. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  204. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  205. - name: Upload packages to packagecloud.io
  206. uses: TykTechnologies/packagecloud-action@main
  207. if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
  208. env:
  209. PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
  210. with:
  211. repo: 'eugeny/tabby'
  212. dir: 'dist'
  213. rpmvers: 'el/9 el/8 ol/6 ol/7'
  214. debvers: 'ubuntu/bionic ubuntu/focal ubuntu/hirsute ubuntu/impish ubuntu/jammy ubuntu/kinetic ubuntu/noble debian/jessie debian/stretch debian/buster'
  215. - uses: actions/upload-artifact@master
  216. name: Upload AppImage (${{matrix.arch}})
  217. with:
  218. name: Linux AppImage (${{matrix.arch}})
  219. path: dist/*.AppImage
  220. - uses: actions/upload-artifact@master
  221. name: Upload DEB (${{matrix.arch}})
  222. with:
  223. name: Linux DEB (${{matrix.arch}})
  224. path: dist/*.deb
  225. - uses: actions/upload-artifact@master
  226. name: Upload RPM (${{matrix.arch}})
  227. with:
  228. name: Linux RPM (${{matrix.arch}})
  229. path: dist/*.rpm
  230. - uses: actions/upload-artifact@master
  231. name: Upload Pacman Package (${{matrix.arch}})
  232. with:
  233. name: Linux Pacman (${{matrix.arch}})
  234. path: dist/*.pacman
  235. - uses: actions/upload-artifact@master
  236. name: Upload Linux tarball (${{matrix.arch}})
  237. with:
  238. name: Linux tarball (${{matrix.arch}})
  239. path: dist/*.tar.gz
  240. - uses: actions/upload-artifact@master
  241. name: Upload web tarball (amd64 only)
  242. with:
  243. name: Web tarball
  244. path: tabby-web.tar.gz
  245. if: matrix.build-arch == 'x64'
  246. Windows-Build:
  247. runs-on: windows-latest
  248. needs: Lint
  249. strategy:
  250. matrix:
  251. include:
  252. - arch: x64
  253. rust_triple: x86_64-pc-windows-msvc
  254. - arch: arm64
  255. rust_triple: aarch64-pc-windows-msvc
  256. fail-fast: false
  257. env:
  258. RUST_TARGET_TRIPLE: ${{matrix.rust_triple}}
  259. ARCH: ${{matrix.arch}}
  260. steps:
  261. - name: Checkout
  262. uses: actions/checkout@v3
  263. with:
  264. fetch-depth: 0
  265. - name: Installing Node
  266. uses: actions/[email protected]
  267. with:
  268. node-version: 18
  269. - run: npm i -g npx
  270. - run: rustup target add ${{matrix.rust_triple}}
  271. - name: Update node-gyp
  272. run: |
  273. npm install --global [email protected]
  274. npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
  275. - name: Build
  276. shell: powershell
  277. run: |
  278. npm i -g yar node-gyp
  279. yarn --network-timeout 1000000
  280. yarn run build
  281. node scripts/prepackage-plugins.mjs
  282. env:
  283. ARCH: ${{matrix.arch}}
  284. - name: Build and sign packages
  285. run: node scripts/build-windows.mjs
  286. if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags'))
  287. env:
  288. ARCH: ${{matrix.arch}}
  289. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  290. KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
  291. WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
  292. WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
  293. DEBUG: electron-builder,electron-builder:*
  294. - name: Build packages without signing
  295. run: node scripts/build-windows.mjs
  296. if: "! (github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))"
  297. env:
  298. ARCH: ${{matrix.arch}}
  299. - name: Upload symbols
  300. run: |
  301. npm install @sentry/cli
  302. node scripts/sentry-upload.mjs
  303. env:
  304. SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
  305. SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
  306. SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
  307. - name: Package artifacts
  308. run: |
  309. mkdir artifact-setup
  310. mv dist/*-setup-*.exe artifact-setup/
  311. mkdir artifact-portable
  312. mv dist/*-portable-*.zip artifact-portable/
  313. - uses: actions/upload-artifact@master
  314. name: Upload installer
  315. with:
  316. name: Windows installer (${{matrix.arch}})
  317. path: artifact-setup
  318. - uses: actions/upload-artifact@master
  319. name: Upload portable build
  320. with:
  321. name: Windows portable build (${{matrix.arch}})
  322. path: artifact-portable