build.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. name: Build
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. build-image-sha:
  6. type: string
  7. description: 'SHA for electron/build image'
  8. default: 'bc2f48b2415a670de18d13605b1cf0eb5fdbaae1'
  9. required: true
  10. skip-macos:
  11. type: boolean
  12. description: 'Skip macOS builds'
  13. default: false
  14. required: false
  15. skip-linux:
  16. type: boolean
  17. description: 'Skip Linux builds'
  18. default: false
  19. required: false
  20. skip-windows:
  21. type: boolean
  22. description: 'Skip Windows builds'
  23. default: false
  24. required: false
  25. skip-lint:
  26. type: boolean
  27. description: 'Skip lint check'
  28. default: false
  29. required: false
  30. push:
  31. branches:
  32. - main
  33. - '[1-9][0-9]-x-y'
  34. pull_request:
  35. defaults:
  36. run:
  37. shell: bash
  38. jobs:
  39. setup:
  40. runs-on: ubuntu-latest
  41. permissions:
  42. pull-requests: read
  43. outputs:
  44. docs: ${{ steps.filter.outputs.docs }}
  45. src: ${{ steps.filter.outputs.src }}
  46. build-image-sha: ${{ steps.set-output.outputs.build-image-sha }}
  47. docs-only: ${{ steps.set-output.outputs.docs-only }}
  48. steps:
  49. - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.0.2
  50. with:
  51. ref: ${{ github.event.pull_request.head.sha }}
  52. - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
  53. id: filter
  54. with:
  55. filters: |
  56. docs:
  57. - 'docs/**'
  58. src:
  59. - '!docs/**'
  60. - name: Set Outputs for Build Image SHA & Docs Only
  61. id: set-output
  62. run: |
  63. if [ -z "${{ inputs.build-image-sha }}" ]; then
  64. echo "build-image-sha=bc2f48b2415a670de18d13605b1cf0eb5fdbaae1" >> "$GITHUB_OUTPUT"
  65. else
  66. echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
  67. fi
  68. echo "docs-only=${{ steps.filter.outputs.docs == 'true' && steps.filter.outputs.src == 'false' }}" >> "$GITHUB_OUTPUT"
  69. # Lint Jobs
  70. lint:
  71. needs: setup
  72. if: ${{ !inputs.skip-lint }}
  73. uses: ./.github/workflows/pipeline-electron-lint.yml
  74. with:
  75. container: '{"image":"ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}","options":"--user root"}'
  76. secrets: inherit
  77. # Docs Only Jobs
  78. docs-only:
  79. needs: setup
  80. if: ${{ needs.setup.outputs.docs-only == 'true' }}
  81. uses: ./.github/workflows/pipeline-electron-docs-only.yml
  82. with:
  83. container: '{"image":"ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}","options":"--user root"}'
  84. secrets: inherit
  85. # Checkout Jobs
  86. checkout-macos:
  87. needs: setup
  88. if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-macos}}
  89. runs-on: electron-arc-linux-amd64-32core
  90. container:
  91. image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
  92. options: --user root
  93. volumes:
  94. - /mnt/cross-instance-cache:/mnt/cross-instance-cache
  95. - /var/run/sas:/var/run/sas
  96. env:
  97. CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
  98. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
  99. outputs:
  100. build-image-sha: ${{ needs.setup.outputs.build-image-sha }}
  101. steps:
  102. - name: Checkout Electron
  103. uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
  104. with:
  105. path: src/electron
  106. fetch-depth: 0
  107. ref: ${{ github.event.pull_request.head.sha }}
  108. - name: Checkout & Sync & Save
  109. uses: ./src/electron/.github/actions/checkout
  110. with:
  111. generate-sas-token: 'true'
  112. checkout-linux:
  113. needs: setup
  114. if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-linux}}
  115. runs-on: electron-arc-linux-amd64-32core
  116. container:
  117. image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
  118. options: --user root
  119. volumes:
  120. - /mnt/cross-instance-cache:/mnt/cross-instance-cache
  121. - /var/run/sas:/var/run/sas
  122. env:
  123. CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
  124. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
  125. PATCH_UP_APP_CREDS: ${{ secrets.PATCH_UP_APP_CREDS }}
  126. outputs:
  127. build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
  128. steps:
  129. - name: Checkout Electron
  130. uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
  131. with:
  132. path: src/electron
  133. fetch-depth: 0
  134. ref: ${{ github.event.pull_request.head.sha }}
  135. - name: Checkout & Sync & Save
  136. uses: ./src/electron/.github/actions/checkout
  137. checkout-windows:
  138. needs: setup
  139. if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
  140. runs-on: electron-arc-linux-amd64-32core
  141. container:
  142. image: ghcr.io/electron/build:${{ needs.setup.outputs.build-image-sha }}
  143. options: --user root --device /dev/fuse --cap-add SYS_ADMIN
  144. volumes:
  145. - /mnt/cross-instance-cache:/mnt/cross-instance-cache
  146. env:
  147. CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }}
  148. CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}
  149. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True'
  150. TARGET_OS: 'win'
  151. ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'
  152. outputs:
  153. build-image-sha: ${{ needs.setup.outputs.build-image-sha}}
  154. steps:
  155. - name: Checkout Electron
  156. uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
  157. with:
  158. path: src/electron
  159. fetch-depth: 0
  160. ref: ${{ github.event.pull_request.head.sha }}
  161. - name: Checkout & Sync & Save
  162. uses: ./src/electron/.github/actions/checkout
  163. # GN Check Jobs
  164. macos-gn-check:
  165. uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
  166. needs: checkout-macos
  167. with:
  168. target-platform: macos
  169. target-archs: x64 arm64
  170. check-runs-on: macos-14
  171. gn-build-type: testing
  172. secrets: inherit
  173. linux-gn-check:
  174. uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
  175. needs: checkout-linux
  176. with:
  177. target-platform: linux
  178. target-archs: x64 arm arm64
  179. check-runs-on: electron-arc-linux-amd64-8core
  180. check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
  181. gn-build-type: testing
  182. secrets: inherit
  183. windows-gn-check:
  184. uses: ./.github/workflows/pipeline-segment-electron-gn-check.yml
  185. needs: checkout-windows
  186. with:
  187. target-platform: win
  188. target-archs: x64 x86 arm64
  189. check-runs-on: electron-arc-linux-amd64-8core
  190. check-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-windows.outputs.build-image-sha }}","options":"--user root --device /dev/fuse --cap-add SYS_ADMIN","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
  191. gn-build-type: testing
  192. secrets: inherit
  193. # Build Jobs - These cascade into testing jobs
  194. macos-x64:
  195. permissions:
  196. contents: read
  197. issues: read
  198. pull-requests: read
  199. uses: ./.github/workflows/pipeline-electron-build-and-test.yml
  200. needs: checkout-macos
  201. with:
  202. build-runs-on: macos-14-xlarge
  203. test-runs-on: macos-13
  204. target-platform: macos
  205. target-arch: x64
  206. is-release: false
  207. gn-build-type: testing
  208. generate-symbols: false
  209. upload-to-storage: '0'
  210. secrets: inherit
  211. macos-arm64:
  212. permissions:
  213. contents: read
  214. issues: read
  215. pull-requests: read
  216. uses: ./.github/workflows/pipeline-electron-build-and-test.yml
  217. needs: checkout-macos
  218. with:
  219. build-runs-on: macos-14-xlarge
  220. test-runs-on: macos-14
  221. target-platform: macos
  222. target-arch: arm64
  223. is-release: false
  224. gn-build-type: testing
  225. generate-symbols: false
  226. upload-to-storage: '0'
  227. secrets: inherit
  228. linux-x64:
  229. permissions:
  230. contents: read
  231. issues: read
  232. pull-requests: read
  233. uses: ./.github/workflows/pipeline-electron-build-and-test-and-nan.yml
  234. needs: checkout-linux
  235. with:
  236. build-runs-on: electron-arc-linux-amd64-32core
  237. test-runs-on: electron-arc-linux-amd64-4core
  238. build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
  239. test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
  240. target-platform: linux
  241. target-arch: x64
  242. is-release: false
  243. gn-build-type: testing
  244. generate-symbols: false
  245. upload-to-storage: '0'
  246. secrets: inherit
  247. linux-x64-asan:
  248. permissions:
  249. contents: read
  250. issues: read
  251. pull-requests: read
  252. uses: ./.github/workflows/pipeline-electron-build-and-test.yml
  253. needs: checkout-linux
  254. with:
  255. build-runs-on: electron-arc-linux-amd64-32core
  256. test-runs-on: electron-arc-linux-amd64-4core
  257. build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
  258. test-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
  259. target-platform: linux
  260. target-arch: x64
  261. is-release: false
  262. gn-build-type: testing
  263. generate-symbols: false
  264. upload-to-storage: '0'
  265. is-asan: true
  266. secrets: inherit
  267. linux-arm:
  268. permissions:
  269. contents: read
  270. issues: read
  271. pull-requests: read
  272. uses: ./.github/workflows/pipeline-electron-build-and-test.yml
  273. needs: checkout-linux
  274. with:
  275. build-runs-on: electron-arc-linux-amd64-32core
  276. test-runs-on: electron-arc-linux-arm64-4core
  277. build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
  278. test-container: '{"image":"ghcr.io/electron/test:arm32v7-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init","volumes":["/home/runner/externals:/mnt/runner-externals"]}'
  279. target-platform: linux
  280. target-arch: arm
  281. is-release: false
  282. gn-build-type: testing
  283. generate-symbols: false
  284. upload-to-storage: '0'
  285. secrets: inherit
  286. linux-arm64:
  287. permissions:
  288. contents: read
  289. issues: read
  290. pull-requests: read
  291. uses: ./.github/workflows/pipeline-electron-build-and-test.yml
  292. needs: checkout-linux
  293. with:
  294. build-runs-on: electron-arc-linux-amd64-32core
  295. test-runs-on: electron-arc-linux-arm64-4core
  296. build-container: '{"image":"ghcr.io/electron/build:${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root","volumes":["/mnt/cross-instance-cache:/mnt/cross-instance-cache"]}'
  297. test-container: '{"image":"ghcr.io/electron/test:arm64v8-${{ needs.checkout-linux.outputs.build-image-sha }}","options":"--user root --privileged --init"}'
  298. target-platform: linux
  299. target-arch: arm64
  300. is-release: false
  301. gn-build-type: testing
  302. generate-symbols: false
  303. upload-to-storage: '0'
  304. secrets: inherit
  305. windows-x64:
  306. permissions:
  307. contents: read
  308. issues: read
  309. pull-requests: read
  310. uses: ./.github/workflows/pipeline-electron-build-and-test.yml
  311. needs: setup
  312. if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
  313. with:
  314. build-runs-on: electron-arc-windows-amd64-16core
  315. test-runs-on: windows-latest
  316. target-platform: win
  317. target-arch: x64
  318. is-release: false
  319. gn-build-type: testing
  320. generate-symbols: false
  321. upload-to-storage: '0'
  322. secrets: inherit
  323. windows-x86:
  324. permissions:
  325. contents: read
  326. issues: read
  327. pull-requests: read
  328. uses: ./.github/workflows/pipeline-electron-build-and-test.yml
  329. needs: setup
  330. if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
  331. with:
  332. build-runs-on: electron-arc-windows-amd64-16core
  333. test-runs-on: windows-latest
  334. target-platform: win
  335. target-arch: x86
  336. is-release: false
  337. gn-build-type: testing
  338. generate-symbols: false
  339. upload-to-storage: '0'
  340. secrets: inherit
  341. windows-arm64:
  342. permissions:
  343. contents: read
  344. issues: read
  345. pull-requests: read
  346. uses: ./.github/workflows/pipeline-electron-build-and-test.yml
  347. needs: setup
  348. if: ${{ needs.setup.outputs.src == 'true' && !inputs.skip-windows }}
  349. with:
  350. build-runs-on: electron-arc-windows-amd64-16core
  351. test-runs-on: electron-hosted-windows-arm64-4core
  352. target-platform: win
  353. target-arch: arm64
  354. is-release: false
  355. gn-build-type: testing
  356. generate-symbols: false
  357. upload-to-storage: '0'
  358. secrets: inherit
  359. gha-done:
  360. name: GitHub Actions Completed
  361. runs-on: ubuntu-latest
  362. needs: [docs-only, macos-x64, macos-arm64, linux-x64, linux-x64-asan, linux-arm, linux-arm64, windows-x64, windows-x86, windows-arm64]
  363. if: always() && !contains(needs.*.result, 'failure')
  364. steps:
  365. - name: GitHub Actions Jobs Done
  366. run: |
  367. echo "All GitHub Actions Jobs are done"