base.yml 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497
  1. version: 2.1
  2. parameters:
  3. run-docs-only:
  4. type: boolean
  5. default: false
  6. upload-to-storage:
  7. type: string
  8. default: '1'
  9. run-build-linux:
  10. type: boolean
  11. default: false
  12. run-build-mac:
  13. type: boolean
  14. default: false
  15. run-linux-publish:
  16. type: boolean
  17. default: false
  18. linux-publish-arch-limit:
  19. type: enum
  20. default: all
  21. enum: ["all", "arm", "arm64", "x64"]
  22. run-macos-publish:
  23. type: boolean
  24. default: false
  25. macos-publish-arch-limit:
  26. type: enum
  27. default: all
  28. enum: ["all", "osx-x64", "osx-arm64", "mas-x64", "mas-arm64"]
  29. medium-linux-executor:
  30. type: enum
  31. default: electronjs/aks-linux-medium
  32. enum: ["electronjs/aks-linux-medium", "medium"]
  33. large-linux-executor:
  34. type: enum
  35. default: electronjs/aks-linux-large
  36. enum: ["electronjs/aks-linux-large", "2xlarge"]
  37. # Executors
  38. executors:
  39. linux-docker:
  40. parameters:
  41. size:
  42. description: "Docker executor size"
  43. type: enum
  44. # aks-linux-large === 32 core
  45. # 2xlarge should not be used directly, use the pipeline param instead
  46. enum: ["medium", "electronjs/aks-linux-medium", "xlarge", "electronjs/aks-linux-large", "2xlarge"]
  47. docker:
  48. - image: ghcr.io/electron/build:e6bebd08a51a0d78ec23e5b3fd7e7c0846412328
  49. resource_class: << parameters.size >>
  50. macos:
  51. parameters:
  52. size:
  53. description: "macOS executor size"
  54. type: enum
  55. enum: ["macos.x86.medium.gen2", "macos.m1.large.gen1", "macos.m1.medium.gen1"]
  56. version:
  57. description: "xcode version"
  58. type: enum
  59. enum: ["15.0.0", "14.0.0"]
  60. default: 15.0.0
  61. macos:
  62. xcode: << parameters.version >>
  63. resource_class: << parameters.size >>
  64. # Electron Runners
  65. apple-silicon:
  66. resource_class: electronjs/macos-arm64
  67. machine: true
  68. linux-arm:
  69. resource_class: electronjs/linux-arm
  70. machine: true
  71. linux-arm64:
  72. resource_class: electronjs/linux-arm64
  73. machine: true
  74. # The config expects the following environment variables to be set:
  75. # - "SLACK_WEBHOOK" Slack hook URL to send notifications.
  76. #
  77. # The publishing scripts expect access tokens to be defined as env vars,
  78. # but those are not covered here.
  79. #
  80. # CircleCI docs on variables:
  81. # https://circleci.com/docs/2.0/env-vars/
  82. # Build configurations options.
  83. env-testing-build: &env-testing-build
  84. GN_CONFIG: //electron/build/args/testing.gn
  85. CHECK_DIST_MANIFEST: '1'
  86. env-release-build: &env-release-build
  87. GN_CONFIG: //electron/build/args/release.gn
  88. STRIP_BINARIES: true
  89. GENERATE_SYMBOLS: true
  90. CHECK_DIST_MANIFEST: '1'
  91. IS_RELEASE: true
  92. env-headless-testing: &env-headless-testing
  93. DISPLAY: ':99.0'
  94. env-stack-dumping: &env-stack-dumping
  95. ELECTRON_ENABLE_STACK_DUMPING: '1'
  96. env-browsertests: &env-browsertests
  97. GN_CONFIG: //electron/build/args/native_tests.gn
  98. BUILD_TARGET: electron/spec:chromium_browsertests
  99. TESTS_CONFIG: src/electron/spec/configs/browsertests.yml
  100. env-unittests: &env-unittests
  101. GN_CONFIG: //electron/build/args/native_tests.gn
  102. BUILD_TARGET: electron/spec:chromium_unittests
  103. TESTS_CONFIG: src/electron/spec/configs/unittests.yml
  104. env-arm: &env-arm
  105. GN_EXTRA_ARGS: 'target_cpu = "arm"'
  106. MKSNAPSHOT_TOOLCHAIN: //build/toolchain/linux:clang_arm
  107. BUILD_NATIVE_MKSNAPSHOT: 1
  108. TARGET_ARCH: arm
  109. env-apple-silicon: &env-apple-silicon
  110. GN_EXTRA_ARGS: 'target_cpu = "arm64"'
  111. TARGET_ARCH: arm64
  112. npm_config_arch: arm64
  113. env-runner: &env-runner
  114. IS_ELECTRON_RUNNER: 1
  115. env-arm64: &env-arm64
  116. GN_EXTRA_ARGS: 'target_cpu = "arm64" fatal_linker_warnings = false enable_linux_installer = false'
  117. MKSNAPSHOT_TOOLCHAIN: //build/toolchain/linux:clang_arm64
  118. BUILD_NATIVE_MKSNAPSHOT: 1
  119. TARGET_ARCH: arm64
  120. env-mas: &env-mas
  121. GN_EXTRA_ARGS: 'is_mas_build = true'
  122. MAS_BUILD: 'true'
  123. env-mas-apple-silicon: &env-mas-apple-silicon
  124. GN_EXTRA_ARGS: 'target_cpu = "arm64" is_mas_build = true'
  125. MAS_BUILD: 'true'
  126. TARGET_ARCH: arm64
  127. npm_config_arch: arm64
  128. env-send-slack-notifications: &env-send-slack-notifications
  129. NOTIFY_SLACK: true
  130. env-global: &env-global
  131. ELECTRON_OUT_DIR: Default
  132. env-linux-medium: &env-linux-medium
  133. <<: *env-global
  134. NUMBER_OF_NINJA_PROCESSES: 3
  135. env-linux-2xlarge: &env-linux-2xlarge
  136. <<: *env-global
  137. NUMBER_OF_NINJA_PROCESSES: 34
  138. env-linux-2xlarge-release: &env-linux-2xlarge-release
  139. <<: *env-global
  140. NUMBER_OF_NINJA_PROCESSES: 16
  141. env-machine-mac: &env-machine-mac
  142. <<: *env-global
  143. NUMBER_OF_NINJA_PROCESSES: 6
  144. env-mac-large: &env-mac-large
  145. <<: *env-global
  146. NUMBER_OF_NINJA_PROCESSES: 18
  147. env-mac-large-release: &env-mac-large-release
  148. <<: *env-global
  149. NUMBER_OF_NINJA_PROCESSES: 8
  150. env-ninja-status: &env-ninja-status
  151. NINJA_STATUS: "[%r processes, %f/%t @ %o/s : %es] "
  152. env-32bit-release: &env-32bit-release
  153. # Set symbol level to 1 for 32 bit releases because of https://crbug.com/648948
  154. GN_BUILDFLAG_ARGS: 'symbol_level = 1'
  155. env-macos-build: &env-macos-build
  156. # Disable pre-compiled headers to reduce out size, only useful for rebuilds
  157. GN_BUILDFLAG_ARGS: 'enable_precompiled_headers = false'
  158. # Individual (shared) steps.
  159. step-maybe-notify-slack-failure: &step-maybe-notify-slack-failure
  160. run:
  161. name: Send a Slack notification on failure
  162. command: |
  163. if [ "$NOTIFY_SLACK" == "true" ]; then
  164. export MESSAGE="Build failed for *<$CIRCLE_BUILD_URL|$CIRCLE_JOB>* nightly build from *$CIRCLE_BRANCH*."
  165. curl -g -H "Content-Type: application/json" -X POST \
  166. -d "{\"text\": \"$MESSAGE\", \"attachments\": [{\"color\": \"#FC5C3C\",\"title\": \"$CIRCLE_JOB nightly build results\",\"title_link\": \"$CIRCLE_BUILD_URL\"}]}" $SLACK_WEBHOOK
  167. fi
  168. when: on_fail
  169. step-maybe-notify-slack-success: &step-maybe-notify-slack-success
  170. run:
  171. name: Send a Slack notification on success
  172. command: |
  173. if [ "$NOTIFY_SLACK" == "true" ]; then
  174. export MESSAGE="Build succeeded for *<$CIRCLE_BUILD_URL|$CIRCLE_JOB>* nightly build from *$CIRCLE_BRANCH*."
  175. curl -g -H "Content-Type: application/json" -X POST \
  176. -d "{\"text\": \"$MESSAGE\", \"attachments\": [{\"color\": \"good\",\"title\": \"$CIRCLE_JOB nightly build results\",\"title_link\": \"$CIRCLE_BUILD_URL\"}]}" $SLACK_WEBHOOK
  177. fi
  178. when: on_success
  179. step-maybe-cleanup-arm64-mac: &step-maybe-cleanup-arm64-mac
  180. run:
  181. name: Cleanup after testing
  182. command: |
  183. if [ "$TARGET_ARCH" == "arm64" ] &&[ "`uname`" == "Darwin" ]; then
  184. killall Electron || echo "No Electron processes left running"
  185. killall Safari || echo "No Safari processes left running"
  186. rm -rf ~/Library/Application\ Support/Electron*
  187. rm -rf ~/Library/Application\ Support/electron*
  188. security delete-generic-password -l "Chromium Safe Storage" || echo "✓ Keychain does not contain password from tests"
  189. security delete-generic-password -l "Electron Test Main Safe Storage" || echo "✓ Keychain does not contain password from tests"
  190. security delete-generic-password -a "electron-test-safe-storage" || echo "✓ Keychain does not contain password from tests"
  191. security delete-generic-password -l "electron-test-safe-storage Safe Storage" || echo "✓ Keychain does not contain password from tests"
  192. elif [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
  193. XVFB=/usr/bin/Xvfb
  194. /sbin/start-stop-daemon --stop --exec $XVFB || echo "Xvfb not running"
  195. pkill electron || echo "electron not running"
  196. rm -rf ~/.config/Electron*
  197. rm -rf ~/.config/electron*
  198. fi
  199. when: always
  200. step-checkout-electron: &step-checkout-electron
  201. checkout:
  202. path: src/electron
  203. step-depot-tools-get: &step-depot-tools-get
  204. run:
  205. name: Get depot tools
  206. command: |
  207. git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
  208. if [ "`uname`" == "Darwin" ]; then
  209. # remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
  210. sed -i '' '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
  211. else
  212. sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
  213. # Remove swift-format dep from cipd on macOS until we send a patch upstream.
  214. cd depot_tools
  215. cat > gclient.diff \<< 'EOF'
  216. diff --git a/gclient.py b/gclient.py
  217. index c305c248..e6e0fbdc 100755
  218. --- a/gclient.py
  219. +++ b/gclient.py
  220. @@ -735,7 +735,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
  221. if dep_type == 'cipd':
  222. cipd_root = self.GetCipdRoot()
  223. - for package in dep_value.get('packages', []):
  224. + packages = dep_value.get('packages', [])
  225. + for package in (x for x in packages if "infra/3pp/tools/swift-format" not in x.get('package')):
  226. deps_to_add.append(
  227. CipdDependency(parent=self,
  228. name=name,
  229. EOF
  230. git apply --3way gclient.diff
  231. fi
  232. # Ensure depot_tools does not update.
  233. test -d depot_tools && cd depot_tools
  234. touch .disable_auto_update
  235. step-depot-tools-add-to-path: &step-depot-tools-add-to-path
  236. run:
  237. name: Add depot tools to PATH
  238. command: echo 'export PATH="$PATH:'"$PWD"'/depot_tools"' >> $BASH_ENV
  239. step-gclient-sync: &step-gclient-sync
  240. run:
  241. name: Gclient sync
  242. command: |
  243. # If we did not restore a complete sync then we need to sync for realz
  244. if [ ! -s "src/electron/.circle-sync-done" ]; then
  245. gclient config \
  246. --name "src/electron" \
  247. --unmanaged \
  248. $GCLIENT_EXTRA_ARGS \
  249. "$CIRCLE_REPOSITORY_URL"
  250. ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags
  251. if [ "$IS_RELEASE" != "true" ]; then
  252. # Re-export all the patches to check if there were changes.
  253. python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
  254. cd src/electron
  255. git update-index --refresh || true
  256. if ! git diff-index --quiet HEAD --; then
  257. # There are changes to the patches. Make a git commit with the updated patches
  258. git add patches
  259. GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
  260. # Export it
  261. mkdir -p ../../patches
  262. git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
  263. if (node ./script/push-patch.js 2> /dev/null > /dev/null); then
  264. echo
  265. echo "======================================================================"
  266. echo "Changes to the patches when applying, we have auto-pushed the diff to the current branch"
  267. echo "A new CI job will kick off shortly"
  268. echo "======================================================================"
  269. exit 1
  270. else
  271. echo
  272. echo "======================================================================"
  273. echo "There were changes to the patches when applying."
  274. echo "Check the CI artifacts for a patch you can apply to fix it."
  275. echo "======================================================================"
  276. exit 1
  277. fi
  278. fi
  279. fi
  280. fi
  281. step-setup-env-for-build: &step-setup-env-for-build
  282. run:
  283. name: Setup Environment Variables
  284. command: |
  285. # To find `gn` executable.
  286. echo 'export CHROMIUM_BUILDTOOLS_PATH="'"$PWD"'/src/buildtools"' >> $BASH_ENV
  287. step-setup-goma-for-build: &step-setup-goma-for-build
  288. run:
  289. name: Setup Goma
  290. command: |
  291. echo 'export NUMBER_OF_NINJA_PROCESSES=300' >> $BASH_ENV
  292. if [ "`uname`" == "Darwin" ]; then
  293. echo 'ulimit -n 10000' >> $BASH_ENV
  294. echo 'sudo launchctl limit maxfiles 65536 200000' >> $BASH_ENV
  295. fi
  296. if [ ! -z "$RAW_GOMA_AUTH" ]; then
  297. echo $RAW_GOMA_AUTH > ~/.goma_oauth2_config
  298. fi
  299. git clone https://github.com/electron/build-tools.git
  300. cd build-tools
  301. npm install
  302. mkdir third_party
  303. node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })"
  304. export GOMA_FALLBACK_ON_AUTH_FAILURE=true
  305. third_party/goma/goma_ctl.py ensure_start
  306. if [ ! -z "$RAW_GOMA_AUTH" ] && [ "`third_party/goma/goma_auth.py info`" != "Login as Fermi Planck" ]; then
  307. echo "WARNING!!!!!! Goma authentication is incorrect; please update Goma auth token."
  308. exit 1
  309. fi
  310. echo 'export GN_GOMA_FILE='`node -e "console.log(require('./src/utils/goma.js').gnFilePath)"` >> $BASH_ENV
  311. echo 'export GOMA_DIR='`node -e "console.log(require('./src/utils/goma.js').dir)"` >> $BASH_ENV
  312. echo 'export GOMA_FALLBACK_ON_AUTH_FAILURE=true' >> $BASH_ENV
  313. cd ..
  314. touch "${TMPDIR:=/tmp}"/.goma-ready
  315. background: true
  316. step-wait-for-goma: &step-wait-for-goma
  317. run:
  318. name: Wait for Goma
  319. command: |
  320. until [ -f "${TMPDIR:=/tmp}"/.goma-ready ]
  321. do
  322. sleep 5
  323. done
  324. echo "Goma ready"
  325. no_output_timeout: 5m
  326. step-restore-brew-cache: &step-restore-brew-cache
  327. restore_cache:
  328. paths:
  329. - /usr/local/Cellar/gnu-tar
  330. - /usr/local/bin/gtar
  331. keys:
  332. - v6-brew-cache-{{ arch }}
  333. step-save-brew-cache: &step-save-brew-cache
  334. save_cache:
  335. paths:
  336. - /usr/local/Cellar/gnu-tar
  337. - /usr/local/bin/gtar
  338. key: v6-brew-cache-{{ arch }}
  339. name: Persisting brew cache
  340. step-get-more-space-on-mac: &step-get-more-space-on-mac
  341. run:
  342. name: Free up space on MacOS
  343. command: |
  344. if [ "`uname`" == "Darwin" ]; then
  345. sudo mkdir -p $TMPDIR/del-target
  346. tmpify() {
  347. if [ -d "$1" ]; then
  348. sudo mv "$1" $TMPDIR/del-target/$(echo $1|shasum -a 256|head -n1|cut -d " " -f1)
  349. fi
  350. }
  351. strip_universal_deep() {
  352. opwd=$(pwd)
  353. cd $1
  354. f=$(find . -perm +111 -type f)
  355. for fp in $f
  356. do
  357. if [[ $(file "$fp") == *"universal binary"* ]]; then
  358. if [ "`arch`" == "arm64" ]; then
  359. if [[ $(file "$fp") == *"x86_64"* ]]; then
  360. sudo lipo -remove x86_64 "$fp" -o "$fp" || true
  361. fi
  362. else
  363. if [[ $(file "$fp") == *"arm64e)"* ]]; then
  364. sudo lipo -remove arm64e "$fp" -o "$fp" || true
  365. fi
  366. if [[ $(file "$fp") == *"arm64)"* ]]; then
  367. sudo lipo -remove arm64 "$fp" -o "$fp" || true
  368. fi
  369. fi
  370. fi
  371. done
  372. cd $opwd
  373. }
  374. tmpify /Library/Developer/CoreSimulator
  375. tmpify ~/Library/Developer/CoreSimulator
  376. tmpify $(xcode-select -p)/Platforms/AppleTVOS.platform
  377. tmpify $(xcode-select -p)/Platforms/iPhoneOS.platform
  378. tmpify $(xcode-select -p)/Platforms/WatchOS.platform
  379. tmpify $(xcode-select -p)/Platforms/WatchSimulator.platform
  380. tmpify $(xcode-select -p)/Platforms/AppleTVSimulator.platform
  381. tmpify $(xcode-select -p)/Platforms/iPhoneSimulator.platform
  382. tmpify $(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/metal/ios
  383. tmpify $(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift
  384. tmpify $(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0
  385. tmpify ~/.rubies
  386. tmpify ~/Library/Caches/Homebrew
  387. tmpify /usr/local/Homebrew
  388. # the contents of build/linux/strip_binary.gni aren't used, but
  389. # https://chromium-review.googlesource.com/c/chromium/src/+/4278307
  390. # needs the file to exist.
  391. mv ~/project/src/build/linux/strip_binary.gni "${TMPDIR}"/
  392. tmpify ~/project/src/build/linux/
  393. mkdir -p ~/project/src/build/linux
  394. mv "${TMPDIR}/strip_binary.gni" ~/project/src/build/linux/
  395. sudo rm -rf $TMPDIR/del-target
  396. # sudo rm -rf "/System/Library/Desktop Pictures"
  397. # sudo rm -rf /System/Library/Templates/Data
  398. # sudo rm -rf /System/Library/Speech/Voices
  399. # sudo rm -rf "/System/Library/Screen Savers"
  400. # sudo rm -rf /System/Volumes/Data/Library/Developer/CommandLineTools/SDKs
  401. # sudo rm -rf "/System/Volumes/Data/Library/Application Support/Apple/Photos/Print Products"
  402. # sudo rm -rf /System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/
  403. # sudo rm -rf /System/Volumes/Data/Library/Java
  404. # sudo rm -rf /System/Volumes/Data/Library/Ruby
  405. # sudo rm -rf /System/Volumes/Data/Library/Printers
  406. # sudo rm -rf /System/iOSSupport
  407. # sudo rm -rf /System/Applications/*.app
  408. # sudo rm -rf /System/Applications/Utilities/*.app
  409. # sudo rm -rf /System/Library/LinguisticData
  410. # sudo rm -rf /System/Volumes/Data/private/var/db/dyld/*
  411. # sudo rm -rf /System/Library/Fonts/*
  412. # sudo rm -rf /System/Library/PreferencePanes
  413. # sudo rm -rf /System/Library/AssetsV2/*
  414. sudo rm -rf /Applications/Safari.app
  415. sudo rm -rf ~/project/src/third_party/catapult/tracing/test_data
  416. sudo rm -rf ~/project/src/third_party/angle/third_party/VK-GL-CTS
  417. # lipo off some huge binaries arm64 versions to save space
  418. strip_universal_deep $(xcode-select -p)/../SharedFrameworks
  419. # strip_arm_deep /System/Volumes/Data/Library/Developer/CommandLineTools/usr
  420. fi
  421. background: true
  422. # On macOS delete all .git directories under src/ except for
  423. # third_party/angle/ and third_party/dawn/ because of build time generation of files
  424. # gen/angle/commit.h depends on third_party/angle/.git/HEAD
  425. # https://chromium-review.googlesource.com/c/angle/angle/+/2074924
  426. # and dawn/common/Version_autogen.h depends on third_party/dawn/.git/HEAD
  427. # https://dawn-review.googlesource.com/c/dawn/+/83901
  428. # TODO: maybe better to always leave out */.git/HEAD file for all targets ?
  429. step-delete-git-directories: &step-delete-git-directories
  430. run:
  431. name: Delete all .git directories under src on MacOS to free space
  432. command: |
  433. if [ "`uname`" == "Darwin" ]; then
  434. cd src
  435. ( find . -type d -name ".git" -not -path "./third_party/angle/*" -not -path "./third_party/dawn/*" -not -path "./electron/*" ) | xargs rm -rf
  436. fi
  437. # On macOS the yarn install command during gclient sync was run on a linux
  438. # machine and therefore installed a slightly different set of dependencies
  439. # Notably "fsevents" is a macOS only dependency, we rerun yarn install once
  440. # we are on a macOS machine to get the correct state
  441. step-install-npm-deps-on-mac: &step-install-npm-deps-on-mac
  442. run:
  443. name: Install node_modules on MacOS
  444. command: |
  445. if [ "`uname`" == "Darwin" ]; then
  446. cd src/electron
  447. node script/yarn install
  448. fi
  449. step-install-npm-deps: &step-install-npm-deps
  450. run:
  451. name: Install node_modules
  452. command: |
  453. cd src/electron
  454. node script/yarn install --frozen-lockfile
  455. # This step handles the differences between the linux "gclient sync"
  456. # and the expected state on macOS
  457. step-fix-sync: &step-fix-sync
  458. run:
  459. name: Fix Sync
  460. command: |
  461. SEDOPTION="-i"
  462. if [ "`uname`" == "Darwin" ]; then
  463. SEDOPTION="-i ''"
  464. # Fix Clang Install (wrong binary)
  465. rm -rf src/third_party/llvm-build
  466. python3 src/tools/clang/scripts/update.py
  467. # Fix esbuild (wrong binary)
  468. echo 'infra/3pp/tools/esbuild/${platform}' `gclient getdep --deps-file=src/third_party/devtools-frontend/src/DEPS -r 'third_party/esbuild:infra/3pp/tools/esbuild/${platform}'` > esbuild_ensure_file
  469. # Remove extra output from calling gclient getdep which always calls update_depot_tools
  470. sed -i '' "s/Updating depot_tools... //g" esbuild_ensure_file
  471. cipd ensure --root src/third_party/devtools-frontend/src/third_party/esbuild -ensure-file esbuild_ensure_file
  472. # Fix rustc (wrong binary)
  473. rm -rf src/third_party/rust-toolchain
  474. python3 src/tools/rust/update_rust.py
  475. # Fix gn (wrong binary)
  476. echo 'gn/gn/mac-${arch}' `gclient getdep --deps-file=src/DEPS -r 'src/buildtools/mac:gn/gn/mac-${arch}'` > gn_ensure_file
  477. # Remove extra output from calling gclient getdep which always calls update_depot_tools
  478. sed -i '' "s/Updating depot_tools... //g" gn_ensure_file
  479. cipd ensure --root src/buildtools/mac -ensure-file gn_ensure_file
  480. # Fix dsymutil (wrong binary)
  481. if [ "$TARGET_ARCH" == "arm64" ]; then
  482. export DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.arm64.sha1
  483. else
  484. export DSYM_SHA_FILE=src/tools/clang/dsymutil/bin/dsymutil.x64.sha1
  485. fi
  486. python3 src/third_party/depot_tools/download_from_google_storage.py --no_resume --no_auth --bucket chromium-browser-clang -s $DSYM_SHA_FILE -o src/tools/clang/dsymutil/bin/dsymutil
  487. fi
  488. # Make sure we are using the right ninja
  489. echo 'infra/3pp/tools/ninja/${platform}' `gclient getdep --deps-file=src/DEPS -r 'src/third_party/ninja:infra/3pp/tools/ninja/${platform}'` > ninja_ensure_file
  490. sed $SEDOPTION "s/Updating depot_tools... //g" ninja_ensure_file
  491. cipd ensure --root src/third_party/ninja -ensure-file ninja_ensure_file
  492. # Explicitly add ninja to the path
  493. echo 'export PATH="$PATH:'"$PWD"'/src/third_party/ninja"' >> $BASH_ENV
  494. cd src/third_party/angle
  495. rm .git/objects/info/alternates
  496. git remote set-url origin https://chromium.googlesource.com/angle/angle.git
  497. cp .git/config .git/config.backup
  498. git remote remove origin
  499. mv .git/config.backup .git/config
  500. git fetch
  501. step-install-signing-cert-on-mac: &step-install-signing-cert-on-mac
  502. run:
  503. name: Import and trust self-signed codesigning cert on MacOS
  504. command: |
  505. if [ "$TARGET_ARCH" != "arm64" ] && [ "`uname`" == "Darwin" ]; then
  506. sudo security authorizationdb write com.apple.trust-settings.admin allow
  507. cd src/electron
  508. ./script/codesign/generate-identity.sh
  509. fi
  510. step-install-gnutar-on-mac: &step-install-gnutar-on-mac
  511. run:
  512. name: Install gnu-tar on macos
  513. command: |
  514. if [ "`uname`" == "Darwin" ]; then
  515. if [ ! -d /usr/local/Cellar/gnu-tar/ ]; then
  516. brew update
  517. brew install gnu-tar
  518. fi
  519. ln -fs /usr/local/bin/gtar /usr/local/bin/tar
  520. fi
  521. step-gn-gen-default: &step-gn-gen-default
  522. run:
  523. name: Default GN gen
  524. command: |
  525. cd src
  526. gn gen out/Default --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
  527. step-gn-check: &step-gn-check
  528. run:
  529. name: GN check
  530. command: |
  531. cd src
  532. gn check out/Default //electron:electron_lib
  533. gn check out/Default //electron:electron_app
  534. gn check out/Default //electron/shell/common/api:mojo
  535. # Check the hunspell filenames
  536. node electron/script/gen-hunspell-filenames.js --check
  537. node electron/script/gen-libc++-filenames.js --check
  538. step-maybe-electron-dist-strip: &step-maybe-electron-dist-strip
  539. run:
  540. name: Strip electron binaries
  541. command: |
  542. if [ "$STRIP_BINARIES" == "true" ] && [ "`uname`" == "Linux" ]; then
  543. if [ x"$TARGET_ARCH" == x ]; then
  544. target_cpu=x64
  545. else
  546. target_cpu="$TARGET_ARCH"
  547. fi
  548. cd src
  549. electron/script/copy-debug-symbols.py --target-cpu="$target_cpu" --out-dir=out/Default/debug --compress
  550. electron/script/strip-binaries.py --target-cpu="$target_cpu"
  551. electron/script/add-debug-link.py --target-cpu="$target_cpu" --debug-dir=out/Default/debug
  552. fi
  553. step-electron-chromedriver-build: &step-electron-chromedriver-build
  554. run:
  555. name: Build chromedriver.zip
  556. command: |
  557. cd src
  558. if [ "`uname`" != "Darwin" ] && ([ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]); then
  559. gn gen out/chromedriver --args="import(\"$GN_CONFIG\") import(\"$GN_GOMA_FILE\") is_component_ffmpeg=false proprietary_codecs=false $GN_EXTRA_ARGS $GN_BUILDFLAG_ARGS"
  560. export CHROMEDRIVER_DIR="out/chromedriver"
  561. else
  562. export CHROMEDRIVER_DIR="out/Default"
  563. fi
  564. ninja -C $CHROMEDRIVER_DIR electron:electron_chromedriver -j $NUMBER_OF_NINJA_PROCESSES
  565. if [ "`uname`" == "Linux" ]; then
  566. electron/script/strip-binaries.py --target-cpu="$TARGET_ARCH" --file $PWD/$CHROMEDRIVER_DIR/chromedriver
  567. fi
  568. ninja -C $CHROMEDRIVER_DIR electron:electron_chromedriver_zip
  569. if [ "`uname`" != "Darwin" ] && ([ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]); then
  570. cp out/chromedriver/chromedriver.zip out/Default
  571. fi
  572. step-nodejs-headers-build: &step-nodejs-headers-build
  573. run:
  574. name: Build Node.js headers
  575. command: |
  576. cd src
  577. ninja -C out/Default electron:node_headers
  578. step-electron-publish: &step-electron-publish
  579. run:
  580. name: Publish Electron Dist
  581. command: |
  582. if [ "`uname`" == "Darwin" ]; then
  583. rm -rf src/out/Default/obj
  584. fi
  585. cd src/electron
  586. if [ "$UPLOAD_TO_STORAGE" == "1" ]; then
  587. echo 'Uploading Electron release distribution to Azure'
  588. script/release/uploaders/upload.py --verbose --upload_to_storage
  589. else
  590. echo 'Uploading Electron release distribution to GitHub releases'
  591. script/release/uploaders/upload.py --verbose
  592. fi
  593. step-electron-dist-unzip: &step-electron-dist-unzip
  594. run:
  595. name: Unzip dist.zip
  596. command: |
  597. cd src/out/Default
  598. # -o overwrite files WITHOUT prompting
  599. # TODO(alexeykuzmin): Remove '-o' when it's no longer needed.
  600. # -: allows to extract archive members into locations outside
  601. # of the current ``extraction root folder''.
  602. # ASan builds have the llvm-symbolizer binaries listed as
  603. # runtime_deps, with their paths as `../../third_party/...`
  604. # unzip exits with non-zero code on such zip files unless -: is
  605. # passed.
  606. unzip -:o dist.zip
  607. step-mksnapshot-unzip: &step-mksnapshot-unzip
  608. run:
  609. name: Unzip mksnapshot.zip
  610. command: |
  611. cd src/out/Default
  612. unzip -:o mksnapshot.zip
  613. step-chromedriver-unzip: &step-chromedriver-unzip
  614. run:
  615. name: Unzip chromedriver.zip
  616. command: |
  617. cd src/out/Default
  618. unzip -:o chromedriver.zip
  619. step-ffmpeg-gn-gen: &step-ffmpeg-gn-gen
  620. run:
  621. name: ffmpeg GN gen
  622. command: |
  623. cd src
  624. gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") import(\"$GN_GOMA_FILE\") $GN_EXTRA_ARGS"
  625. step-ffmpeg-build: &step-ffmpeg-build
  626. run:
  627. name: Non proprietary ffmpeg build
  628. command: |
  629. cd src
  630. ninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES
  631. step-verify-mksnapshot: &step-verify-mksnapshot
  632. run:
  633. name: Verify mksnapshot
  634. command: |
  635. if [ "$IS_ASAN" != "1" ]; then
  636. cd src
  637. if [ "`uname`" != "Darwin" ] && ([ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]); then
  638. python3 electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --snapshot-files-dir $PWD/cross-arch-snapshots
  639. else
  640. python3 electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default
  641. fi
  642. fi
  643. step-verify-chromedriver: &step-verify-chromedriver
  644. run:
  645. name: Verify ChromeDriver
  646. command: |
  647. if [ "$IS_ASAN" != "1" ]; then
  648. cd src
  649. python3 electron/script/verify-chromedriver.py --source-root "$PWD" --build-dir out/Default
  650. fi
  651. step-setup-linux-for-headless-testing: &step-setup-linux-for-headless-testing
  652. run:
  653. name: Setup for headless testing
  654. command: |
  655. if [ "`uname`" != "Darwin" ]; then
  656. sh -e /etc/init.d/xvfb start
  657. fi
  658. step-show-goma-stats: &step-show-goma-stats
  659. run:
  660. shell: /bin/bash
  661. name: Check goma stats after build
  662. command: |
  663. set +e
  664. set +o pipefail
  665. python3 $GOMA_DIR/goma_ctl.py stat
  666. python3 $GOMA_DIR/diagnose_goma_log.py
  667. true
  668. when: always
  669. background: true
  670. step-mksnapshot-build: &step-mksnapshot-build
  671. run:
  672. name: mksnapshot build
  673. no_output_timeout: 30m
  674. command: |
  675. cd src
  676. ninja -C out/Default electron:electron_mksnapshot -j $NUMBER_OF_NINJA_PROCESSES
  677. gn desc out/Default v8:run_mksnapshot_default args > out/Default/mksnapshot_args
  678. # Remove unused args from mksnapshot_args
  679. SEDOPTION="-i"
  680. if [ "`uname`" == "Darwin" ]; then
  681. SEDOPTION="-i ''"
  682. fi
  683. sed $SEDOPTION '/.*builtins-pgo/d' out/Default/mksnapshot_args
  684. sed $SEDOPTION '/--turbo-profiling-input/d' out/Default/mksnapshot_args
  685. sed $SEDOPTION '/The gn arg use_goma=true .*/d' out/Default/mksnapshot_args
  686. if [ "`uname`" != "Darwin" ]; then
  687. if [ "$TARGET_ARCH" == "arm" ]; then
  688. electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/mksnapshot
  689. electron/script/strip-binaries.py --file $PWD/out/Default/clang_x86_v8_arm/v8_context_snapshot_generator
  690. elif [ "$TARGET_ARCH" == "arm64" ]; then
  691. electron/script/strip-binaries.py --file $PWD/out/Default/clang_x64_v8_arm64/mksnapshot
  692. electron/script/strip-binaries.py --file $PWD/out/Default/clang_x64_v8_arm64/v8_context_snapshot_generator
  693. else
  694. electron/script/strip-binaries.py --file $PWD/out/Default/mksnapshot
  695. electron/script/strip-binaries.py --file $PWD/out/Default/v8_context_snapshot_generator
  696. fi
  697. fi
  698. if [ "$SKIP_DIST_ZIP" != "1" ]; then
  699. ninja -C out/Default electron:electron_mksnapshot_zip -j $NUMBER_OF_NINJA_PROCESSES
  700. (cd out/Default; zip mksnapshot.zip mksnapshot_args gen/v8/embedded.S)
  701. fi
  702. step-hunspell-build: &step-hunspell-build
  703. run:
  704. name: hunspell build
  705. command: |
  706. cd src
  707. if [ "$SKIP_DIST_ZIP" != "1" ]; then
  708. ninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
  709. fi
  710. step-maybe-generate-libcxx: &step-maybe-generate-libcxx
  711. run:
  712. name: maybe generate libcxx
  713. command: |
  714. cd src
  715. if [ "`uname`" == "Linux" ]; then
  716. ninja -C out/Default electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
  717. ninja -C out/Default electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
  718. ninja -C out/Default electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
  719. fi
  720. step-maybe-generate-breakpad-symbols: &step-maybe-generate-breakpad-symbols
  721. run:
  722. name: Generate breakpad symbols
  723. no_output_timeout: 30m
  724. command: |
  725. if [ "$GENERATE_SYMBOLS" == "true" ]; then
  726. cd src
  727. ninja -C out/Default electron:electron_symbols
  728. fi
  729. step-maybe-zip-symbols: &step-maybe-zip-symbols
  730. run:
  731. name: Zip symbols
  732. command: |
  733. cd src
  734. export BUILD_PATH="$PWD/out/Default"
  735. ninja -C out/Default electron:licenses
  736. ninja -C out/Default electron:electron_version_file
  737. electron/script/zip-symbols.py -b $BUILD_PATH
  738. step-maybe-zip-symbols-and-clean: &step-maybe-zip-symbols-and-clean
  739. run:
  740. name: Zip symbols
  741. command: |
  742. cd src
  743. export BUILD_PATH="$PWD/out/Default"
  744. ninja -C out/Default electron:licenses
  745. ninja -C out/Default electron:electron_version_file
  746. DELETE_DSYMS_AFTER_ZIP=1 electron/script/zip-symbols.py -b $BUILD_PATH
  747. step-maybe-cross-arch-snapshot: &step-maybe-cross-arch-snapshot
  748. run:
  749. name: Generate cross arch snapshot (arm/arm64)
  750. command: |
  751. if [ "$GENERATE_CROSS_ARCH_SNAPSHOT" == "true" ] && [ -z "$CIRCLE_PR_NUMBER" ]; then
  752. cd src
  753. if [ "$TARGET_ARCH" == "arm" ]; then
  754. export MKSNAPSHOT_PATH="clang_x86_v8_arm"
  755. elif [ "$TARGET_ARCH" == "arm64" ]; then
  756. export MKSNAPSHOT_PATH="clang_x64_v8_arm64"
  757. fi
  758. cp "out/Default/$MKSNAPSHOT_PATH/mksnapshot" out/Default
  759. cp "out/Default/$MKSNAPSHOT_PATH/v8_context_snapshot_generator" out/Default
  760. if [ "`uname`" == "Linux" ]; then
  761. cp "out/Default/$MKSNAPSHOT_PATH/libffmpeg.so" out/Default
  762. elif [ "`uname`" == "Darwin" ]; then
  763. cp "out/Default/$MKSNAPSHOT_PATH/libffmpeg.dylib" out/Default
  764. fi
  765. python3 electron/script/verify-mksnapshot.py --source-root "$PWD" --build-dir out/Default --create-snapshot-only
  766. mkdir cross-arch-snapshots
  767. cp out/Default-mksnapshot-test/*.bin cross-arch-snapshots
  768. # Clean up so that ninja does not get confused
  769. if [ "`uname`" == "Linux" ]; then
  770. rm -f out/Default/libffmpeg.so
  771. elif [ "`uname`" == "Darwin" ]; then
  772. rm -f out/Default/libffmpeg.dylib
  773. fi
  774. fi
  775. step-maybe-generate-typescript-defs: &step-maybe-generate-typescript-defs
  776. run:
  777. name: Generate type declarations
  778. command: |
  779. if [ "`uname`" == "Darwin" ]; then
  780. cd src/electron
  781. node script/yarn create-typescript-definitions
  782. fi
  783. step-fix-known-hosts-linux: &step-fix-known-hosts-linux
  784. run:
  785. name: Fix Known Hosts on Linux
  786. command: |
  787. if [ "`uname`" == "Linux" ]; then
  788. ./src/electron/.circleci/fix-known-hosts.sh
  789. fi
  790. # Checkout Steps
  791. step-generate-deps-hash: &step-generate-deps-hash
  792. run:
  793. name: Generate DEPS Hash
  794. command: node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
  795. step-touch-sync-done: &step-touch-sync-done
  796. run:
  797. name: Touch Sync Done
  798. command: touch src/electron/.circle-sync-done
  799. # Restore exact src cache based on the hash of DEPS and patches/*
  800. # If no cache is matched EXACTLY then the .circle-sync-done file is empty
  801. # If a cache is matched EXACTLY then the .circle-sync-done file contains "done"
  802. step-maybe-restore-src-cache: &step-maybe-restore-src-cache
  803. restore_cache:
  804. keys:
  805. - v17-src-cache-{{ checksum "src/electron/.depshash" }}
  806. name: Restoring src cache
  807. step-maybe-restore-src-cache-marker: &step-maybe-restore-src-cache-marker
  808. restore_cache:
  809. keys:
  810. - v17-src-cache-marker-{{ checksum "src/electron/.depshash" }}
  811. name: Restoring src cache marker
  812. step-maybe-restore-src-cache-aks: &step-maybe-restore-src-cache-aks
  813. restore_cache_aks:
  814. step-name: Restoring src cache
  815. cache_key: v17-src-cache-$(shasum src/electron/.depshash | cut -f1 -d' ')
  816. cache_path: /var/portal
  817. step-maybe-restore-src-cache-marker-aks: &step-maybe-restore-src-cache-marker-aks
  818. restore_cache_aks:
  819. step-name: Restoring src cache marker
  820. cache_key: v17-src-cache-marker-$(shasum src/electron/.depshash | cut -f1 -d' ')
  821. cache_path: "."
  822. # Restore exact or closest git cache based on the hash of DEPS and .circle-sync-done
  823. # If the src cache was restored above then this will match an empty cache
  824. # If the src cache was not restored above then this will match a close git cache
  825. step-maybe-restore-git-cache: &step-maybe-restore-git-cache
  826. restore_cache:
  827. paths:
  828. - git-cache
  829. keys:
  830. - v1-git-cache-{{ checksum "src/electron/.circle-sync-done" }}-{{ checksum "src/electron/DEPS" }}
  831. - v1-git-cache-{{ checksum "src/electron/.circle-sync-done" }}
  832. name: Conditionally restoring git cache
  833. step-maybe-restore-git-cache-aks: &step-maybe-restore-git-cache-aks
  834. restore_cache_aks:
  835. step-name: Conditionally restoring git cache (aks)
  836. cache_key: v1-git-cache-$(shasum src/electron/.circle-sync-done | cut -f1 -d' ')-$(shasum src/electron/DEPS | cut -f1 -d' ') v1-git-cache-$(shasum src/electron/.circle-sync-done | cut -f1 -d' ')
  837. cache_path: git-cache
  838. step-set-git-cache-path: &step-set-git-cache-path
  839. run:
  840. name: Set GIT_CACHE_PATH to make gclient to use the cache
  841. command: |
  842. # CircleCI does not support interpolation when setting environment variables.
  843. # https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-shell-command
  844. echo 'export GIT_CACHE_PATH="$PWD/git-cache"' >> $BASH_ENV
  845. # Persist the git cache based on the hash of DEPS and .circle-sync-done
  846. # If the src cache was restored above then this will persist an empty cache
  847. step-save-git-cache: &step-save-git-cache
  848. save_cache:
  849. paths:
  850. - git-cache
  851. key: v1-git-cache-{{ checksum "src/electron/.circle-sync-done" }}-{{ checksum "src/electron/DEPS" }}
  852. name: Persisting git cache
  853. step-save-git-cache-aks: &step-save-git-cache-aks
  854. save_cache_aks:
  855. step-name: Persisting git cache (AKS)
  856. cache_key: v1-git-cache-$(shasum src/electron/.circle-sync-done | cut -f1 -d' ')-$(shasum src/electron/DEPS | cut -f1 -d' ')
  857. cache_path: git-cache
  858. step-run-electron-only-hooks: &step-run-electron-only-hooks
  859. run:
  860. name: Run Electron Only Hooks
  861. command: gclient runhooks --spec="solutions=[{'name':'src/electron','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':False},'managed':False}]"
  862. step-generate-deps-hash-cleanly: &step-generate-deps-hash-cleanly
  863. run:
  864. name: Generate DEPS Hash
  865. command: (cd src/electron && git checkout .) && node src/electron/script/generate-deps-hash.js && cat src/electron/.depshash-target
  866. # Mark the sync as done for future cache saving
  867. step-mark-sync-done: &step-mark-sync-done
  868. run:
  869. name: Mark Sync Done
  870. command: echo DONE > src/electron/.circle-sync-done
  871. # Minimize the size of the cache
  872. step-minimize-workspace-size-from-checkout: &step-minimize-workspace-size-from-checkout
  873. run:
  874. name: Remove some unused data to avoid storing it in the workspace/cache
  875. command: |
  876. rm -rf src/android_webview
  877. rm -rf src/ios/chrome
  878. rm -rf src/third_party/blink/web_tests
  879. rm -rf src/third_party/blink/perf_tests
  880. rm -rf third_party/electron_node/deps/openssl
  881. rm -rf third_party/electron_node/deps/v8
  882. rm -rf chrome/test/data/xr/webvr_info
  883. rm -rf src/third_party/angle/third_party/VK-GL-CTS/src
  884. rm -rf src/third_party/swift-toolchain
  885. rm -rf src/third_party/swiftshader/tests/regres/testlists
  886. # Save the src cache based on the deps hash
  887. step-save-src-cache: &step-save-src-cache
  888. save_cache:
  889. paths:
  890. - /var/portal
  891. key: v17-src-cache-{{ checksum "/var/portal/src/electron/.depshash" }}
  892. name: Persisting src cache
  893. step-make-src-cache-marker: &step-make-src-cache-marker
  894. run:
  895. name: Making src cache marker
  896. command: touch .src-cache-marker
  897. step-save-src-cache-marker: &step-save-src-cache-marker
  898. save_cache:
  899. paths:
  900. - .src-cache-marker
  901. key: v17-src-cache-marker-{{ checksum "/var/portal/src/electron/.depshash" }}
  902. step-save-src-cache-aks: &step-save-src-cache-aks
  903. save_cache_aks:
  904. step-name: Persisting src cache (aks)
  905. cache_key: v17-src-cache-$(shasum /var/portal/src/electron/.depshash | cut -f1 -d' ')
  906. cache_path: /var/portal
  907. step-save-src-cache-marker-aks: &step-save-src-cache-marker-aks
  908. save_cache_aks:
  909. step-name: Persisting src cache marker (aks)
  910. cache_key: v17-src-cache-marker-$(shasum /var/portal/src/electron/.depshash | cut -f1 -d' ')
  911. cache_path: .src-cache-marker
  912. step-maybe-early-exit-no-doc-change: &step-maybe-early-exit-no-doc-change
  913. run:
  914. name: Shortcircuit job if change is not doc only
  915. command: |
  916. if [ ! -s src/electron/.skip-ci-build ]; then
  917. circleci-agent step halt
  918. fi
  919. step-ts-compile: &step-ts-compile
  920. run:
  921. name: Run TS/JS compile on doc only change
  922. command: |
  923. cd src/electron
  924. node script/yarn create-typescript-definitions
  925. node script/yarn tsc -p tsconfig.default_app.json --noEmit
  926. for f in build/webpack/*.js
  927. do
  928. out="${f:29}"
  929. if [ "$out" != "base.js" ]; then
  930. node script/yarn webpack --config $f --output-filename=$out --output-path=./.tmp --env mode=development
  931. fi
  932. done
  933. # List of all steps.
  934. steps-electron-ts-compile-for-doc-change: &steps-electron-ts-compile-for-doc-change
  935. steps:
  936. # Checkout - Copied from steps-checkout
  937. - *step-checkout-electron
  938. - *step-install-npm-deps
  939. #Compile ts/js to verify doc change didn't break anything
  940. - *step-ts-compile
  941. # Command Aliases
  942. commands:
  943. aks-specific-step:
  944. parameters:
  945. circle:
  946. type: steps
  947. aks:
  948. type: steps
  949. could-be-aks:
  950. type: boolean
  951. description: Only set this to true on linux hosts
  952. steps:
  953. - when:
  954. condition:
  955. or:
  956. - equal: [<< parameters.could-be-aks >>, false]
  957. - equal: [<< pipeline.parameters.large-linux-executor >>, 2xlarge]
  958. steps: << parameters.circle >>
  959. - when:
  960. condition:
  961. and:
  962. - equal: [<< parameters.could-be-aks >>, true]
  963. - equal: [<< pipeline.parameters.large-linux-executor >>, electronjs/aks-linux-large]
  964. steps: << parameters.aks >>
  965. save_cache_aks:
  966. parameters:
  967. step-name:
  968. type: string
  969. cache_key:
  970. type: string
  971. cache_path:
  972. type: string
  973. steps:
  974. - run:
  975. name: << parameters.step-name >>
  976. command: |
  977. cache_key="<< parameters.cache_key >>"
  978. final_cache_path=/mnt/cross-instance-cache/${cache_key}.tar
  979. echo "Using cache key: $cache_key"
  980. echo "Checking path: $final_cache_path"
  981. if [ ! -f "$final_cache_path" ]; then
  982. echo "Cache key not founding, storing tarball"
  983. tmp_container=/mnt/cross-instance-cache/tmp/$CIRCLE_WORKFLOW_JOB_ID
  984. tmp_cache_path=$tmp_container/${cache_key}.tar
  985. mkdir -p $tmp_container
  986. if [ -f "<< parameters.cache_path >>" ]; then
  987. tar -cf $tmp_cache_path -C $(dirname << parameters.cache_path >>) ./$(basename << parameters.cache_path >>)
  988. else
  989. tar -cf $tmp_cache_path -C << parameters.cache_path >>/ ./
  990. fi
  991. mv -vn $tmp_cache_path $final_cache_path
  992. rm -rf $tmp_container
  993. else
  994. echo "Cache key already exists, skipping.."
  995. fi
  996. restore_cache_aks:
  997. parameters:
  998. step-name:
  999. type: string
  1000. cache_key:
  1001. type: string
  1002. cache_path:
  1003. type: string
  1004. steps:
  1005. - run:
  1006. name: << parameters.step-name >>
  1007. command: |
  1008. df -h
  1009. for cache_key in << parameters.cache_key >>; do
  1010. cache_path=/mnt/cross-instance-cache/${cache_key}.tar
  1011. echo "Using cache key: $cache_key"
  1012. echo "Checking path: $cache_path"
  1013. if [ ! -f "$cache_path" ]; then
  1014. echo "Cache key not found, nothing to restore..."
  1015. else
  1016. echo "Cache key found, restoring to path..."
  1017. mkdir -p << parameters.cache_path >>/
  1018. tar -xf /mnt/cross-instance-cache/${cache_key}.tar -C << parameters.cache_path >>/
  1019. exit 0
  1020. fi
  1021. done
  1022. maybe-restore-portaled-src-cache:
  1023. parameters:
  1024. halt-if-successful:
  1025. type: boolean
  1026. default: false
  1027. could-be-aks:
  1028. type: boolean
  1029. steps:
  1030. - run:
  1031. name: Prepare for cross-OS sync restore
  1032. command: |
  1033. sudo mkdir -p /var/portal
  1034. sudo chown -R $(id -u):$(id -g) /var/portal
  1035. - when:
  1036. condition: << parameters.halt-if-successful >>
  1037. steps:
  1038. - aks-specific-step:
  1039. circle:
  1040. - *step-maybe-restore-src-cache-marker
  1041. aks:
  1042. - *step-maybe-restore-src-cache-marker-aks
  1043. could-be-aks: << parameters.could-be-aks >>
  1044. - run:
  1045. name: Halt the job early if the src cache exists
  1046. command: |
  1047. if [ -f ".src-cache-marker" ]; then
  1048. circleci-agent step halt
  1049. fi
  1050. - aks-specific-step:
  1051. circle:
  1052. - *step-maybe-restore-src-cache
  1053. aks:
  1054. - *step-maybe-restore-src-cache-aks
  1055. could-be-aks: << parameters.could-be-aks >>
  1056. - run:
  1057. name: Fix the src cache restore point
  1058. command: |
  1059. if [ -d "/var/portal/src" ]; then
  1060. echo Relocating Cache
  1061. rm -rf src
  1062. mv /var/portal/src ./
  1063. fi
  1064. run-gn-check:
  1065. parameters:
  1066. could-be-aks:
  1067. type: boolean
  1068. steps:
  1069. - *step-setup-goma-for-build
  1070. - checkout-from-cache:
  1071. could-be-aks: << parameters.could-be-aks >>
  1072. - *step-setup-env-for-build
  1073. - *step-wait-for-goma
  1074. - *step-gn-gen-default
  1075. - *step-gn-check
  1076. build_and_save_artifacts:
  1077. parameters:
  1078. artifact-key:
  1079. type: string
  1080. build-type:
  1081. type: string
  1082. build-nonproprietary-ffmpeg:
  1083. type: boolean
  1084. default: true
  1085. steps:
  1086. - *step-gn-gen-default
  1087. - ninja_build_electron:
  1088. clean-prebuilt-snapshot: false
  1089. build-type: << parameters.build-type >>
  1090. - *step-maybe-electron-dist-strip
  1091. - step-electron-dist-build:
  1092. additional-targets: shell_browser_ui_unittests electron:node_headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip
  1093. - *step-show-goma-stats
  1094. # mksnapshot
  1095. - *step-mksnapshot-build
  1096. - *step-maybe-cross-arch-snapshot
  1097. # chromedriver
  1098. - *step-electron-chromedriver-build
  1099. - when:
  1100. condition: << parameters.build-nonproprietary-ffmpeg >>
  1101. steps:
  1102. # ffmpeg
  1103. - *step-ffmpeg-gn-gen
  1104. - *step-ffmpeg-build
  1105. - *step-maybe-generate-breakpad-symbols
  1106. - *step-maybe-zip-symbols
  1107. - move_and_store_all_artifacts:
  1108. artifact-key: << parameters.artifact-key >>
  1109. move_and_store_all_artifacts:
  1110. parameters:
  1111. artifact-key:
  1112. type: string
  1113. steps:
  1114. - run:
  1115. name: Move all generated artifacts to upload folder
  1116. command: |
  1117. rm -rf generated_artifacts_<< parameters.artifact-key >>
  1118. mkdir generated_artifacts_<< parameters.artifact-key >>
  1119. mv_if_exist() {
  1120. if [ -f "$1" ] || [ -d "$1" ]; then
  1121. echo Storing $1
  1122. mv $1 generated_artifacts_<< parameters.artifact-key >>
  1123. else
  1124. echo Skipping $1 - It is not present on disk
  1125. fi
  1126. }
  1127. cp_if_exist() {
  1128. if [ -f "$1" ] || [ -d "$1" ]; then
  1129. echo Storing $1
  1130. cp $1 generated_artifacts_<< parameters.artifact-key >>
  1131. else
  1132. echo Skipping $1 - It is not present on disk
  1133. fi
  1134. }
  1135. mv_if_exist src/out/Default/dist.zip
  1136. mv_if_exist src/out/Default/gen/node_headers.tar.gz
  1137. mv_if_exist src/out/Default/symbols.zip
  1138. mv_if_exist src/out/Default/mksnapshot.zip
  1139. mv_if_exist src/out/Default/chromedriver.zip
  1140. mv_if_exist src/out/ffmpeg/ffmpeg.zip
  1141. mv_if_exist src/out/Default/hunspell_dictionaries.zip
  1142. mv_if_exist src/cross-arch-snapshots
  1143. cp_if_exist src/out/electron_ninja_log
  1144. cp_if_exist src/out/Default/.ninja_log
  1145. when: always
  1146. - store_artifacts:
  1147. path: generated_artifacts_<< parameters.artifact-key >>
  1148. destination: ./<< parameters.artifact-key >>
  1149. - store_artifacts:
  1150. path: generated_artifacts_<< parameters.artifact-key >>/cross-arch-snapshots
  1151. destination: << parameters.artifact-key >>/cross-arch-snapshots
  1152. restore_build_artifacts:
  1153. parameters:
  1154. artifact-key:
  1155. type: string
  1156. steps:
  1157. - attach_workspace:
  1158. at: .
  1159. - run:
  1160. name: Restore key specific artifacts
  1161. command: |
  1162. mv_if_exist() {
  1163. if [ -f "generated_artifacts_<< parameters.artifact-key >>/$1" ] || [ -d "generated_artifacts_<< parameters.artifact-key >>/$1" ]; then
  1164. echo Restoring $1 to $2
  1165. mkdir -p $2
  1166. mv generated_artifacts_<< parameters.artifact-key >>/$1 $2
  1167. else
  1168. echo Skipping $1 - It is not present on disk
  1169. fi
  1170. }
  1171. mv_if_exist dist.zip src/out/Default
  1172. mv_if_exist node_headers.tar.gz src/out/Default/gen
  1173. mv_if_exist symbols.zip src/out/Default
  1174. mv_if_exist mksnapshot.zip src/out/Default
  1175. mv_if_exist chromedriver.zip src/out/Default
  1176. mv_if_exist ffmpeg.zip src/out/ffmpeg
  1177. mv_if_exist hunspell_dictionaries.zip src/out/Default
  1178. mv_if_exist cross-arch-snapshots src
  1179. checkout-from-cache:
  1180. parameters:
  1181. could-be-aks:
  1182. type: boolean
  1183. steps:
  1184. - *step-checkout-electron
  1185. - *step-depot-tools-get
  1186. - *step-depot-tools-add-to-path
  1187. - *step-generate-deps-hash
  1188. - maybe-restore-portaled-src-cache:
  1189. could-be-aks: << parameters.could-be-aks >>
  1190. - run:
  1191. name: Ensure src checkout worked
  1192. command: |
  1193. if [ ! -d "src/third_party/blink" ]; then
  1194. echo src cache was not restored for some reason, idk what happened here...
  1195. exit 1
  1196. fi
  1197. - run:
  1198. name: Wipe Electron
  1199. command: rm -rf src/electron
  1200. - *step-checkout-electron
  1201. - *step-run-electron-only-hooks
  1202. - *step-generate-deps-hash-cleanly
  1203. step-electron-dist-build:
  1204. parameters:
  1205. additional-targets:
  1206. type: string
  1207. default: ''
  1208. steps:
  1209. - run:
  1210. name: Build dist.zip
  1211. command: |
  1212. cd src
  1213. if [ "$SKIP_DIST_ZIP" != "1" ]; then
  1214. ninja -C out/Default electron:electron_dist_zip << parameters.additional-targets >> -j $NUMBER_OF_NINJA_PROCESSES
  1215. if [ "$CHECK_DIST_MANIFEST" == "1" ]; then
  1216. if [ "`uname`" == "Darwin" ]; then
  1217. target_os=mac
  1218. target_cpu=x64
  1219. if [ x"$MAS_BUILD" == x"true" ]; then
  1220. target_os=mac_mas
  1221. fi
  1222. if [ "$TARGET_ARCH" == "arm64" ]; then
  1223. target_cpu=arm64
  1224. fi
  1225. elif [ "`uname`" == "Linux" ]; then
  1226. target_os=linux
  1227. if [ x"$TARGET_ARCH" == x ]; then
  1228. target_cpu=x64
  1229. else
  1230. target_cpu="$TARGET_ARCH"
  1231. fi
  1232. else
  1233. echo "Unknown system: `uname`"
  1234. exit 1
  1235. fi
  1236. electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.$target_cpu.manifest
  1237. fi
  1238. fi
  1239. ninja_build_electron:
  1240. parameters:
  1241. clean-prebuilt-snapshot:
  1242. type: boolean
  1243. default: true
  1244. build-type:
  1245. type: string
  1246. steps:
  1247. - run:
  1248. name: Electron << parameters.build-type >> build
  1249. no_output_timeout: 60m
  1250. command: |
  1251. cd src
  1252. NINJA_SUMMARIZE_BUILD=1 autoninja -C out/Default electron -j $NUMBER_OF_NINJA_PROCESSES
  1253. cp out/Default/.ninja_log out/electron_ninja_log
  1254. node electron/script/check-symlinks.js
  1255. electron-build:
  1256. parameters:
  1257. attach:
  1258. type: boolean
  1259. default: false
  1260. persist:
  1261. type: boolean
  1262. default: true
  1263. persist-checkout:
  1264. type: boolean
  1265. default: false
  1266. checkout:
  1267. type: boolean
  1268. default: true
  1269. checkout-and-assume-cache:
  1270. type: boolean
  1271. default: false
  1272. save-git-cache:
  1273. type: boolean
  1274. default: false
  1275. checkout-to-create-src-cache:
  1276. type: boolean
  1277. default: false
  1278. build:
  1279. type: boolean
  1280. default: true
  1281. restore-src-cache:
  1282. type: boolean
  1283. default: true
  1284. build-nonproprietary-ffmpeg:
  1285. type: boolean
  1286. default: true
  1287. artifact-key:
  1288. type: string
  1289. build-type:
  1290. type: string
  1291. after-build-and-save:
  1292. type: steps
  1293. default: []
  1294. after-persist:
  1295. type: steps
  1296. default: []
  1297. could-be-aks:
  1298. type: boolean
  1299. steps:
  1300. - when:
  1301. condition: << parameters.attach >>
  1302. steps:
  1303. - attach_workspace:
  1304. at: .
  1305. - run: rm -rf src/electron
  1306. - *step-restore-brew-cache
  1307. - *step-install-gnutar-on-mac
  1308. - *step-save-brew-cache
  1309. - when:
  1310. condition: << parameters.build >>
  1311. steps:
  1312. - *step-setup-goma-for-build
  1313. - when:
  1314. condition: << parameters.checkout-and-assume-cache >>
  1315. steps:
  1316. - checkout-from-cache:
  1317. could-be-aks: << parameters.could-be-aks >>
  1318. - when:
  1319. condition: << parameters.checkout >>
  1320. steps:
  1321. # Checkout - Copied from steps-checkout
  1322. - *step-checkout-electron
  1323. - *step-depot-tools-get
  1324. - *step-depot-tools-add-to-path
  1325. - *step-get-more-space-on-mac
  1326. - *step-generate-deps-hash
  1327. - *step-touch-sync-done
  1328. - when:
  1329. condition: << parameters.restore-src-cache >>
  1330. steps:
  1331. - maybe-restore-portaled-src-cache:
  1332. halt-if-successful: << parameters.checkout-to-create-src-cache >>
  1333. could-be-aks: << parameters.could-be-aks >>
  1334. - aks-specific-step:
  1335. circle:
  1336. - *step-maybe-restore-git-cache
  1337. aks:
  1338. - *step-maybe-restore-git-cache-aks
  1339. could-be-aks: << parameters.could-be-aks >>
  1340. - *step-set-git-cache-path
  1341. - *step-fix-known-hosts-linux
  1342. # This sync call only runs if .circle-sync-done is an EMPTY file
  1343. - *step-gclient-sync
  1344. - store_artifacts:
  1345. path: patches
  1346. # These next few steps reset Electron to the correct commit regardless of which cache was restored
  1347. - run:
  1348. name: Wipe Electron
  1349. command: rm -rf src/electron
  1350. - *step-checkout-electron
  1351. - *step-run-electron-only-hooks
  1352. - *step-generate-deps-hash-cleanly
  1353. - *step-touch-sync-done
  1354. - when:
  1355. condition: << parameters.save-git-cache >>
  1356. steps:
  1357. - aks-specific-step:
  1358. circle:
  1359. - *step-save-git-cache
  1360. aks:
  1361. - *step-save-git-cache-aks
  1362. could-be-aks: << parameters.could-be-aks >>
  1363. # Mark sync as done _after_ saving the git cache so that it is uploaded
  1364. # only when the src cache was not present
  1365. # Their are theoretically two cases for this cache key
  1366. # 1. `vX-git-cache-DONE-{deps_hash}
  1367. # 2. `vX-git-cache-EMPTY-{deps_hash}
  1368. #
  1369. # Case (1) occurs when the flag file has "DONE" in it
  1370. # which only occurs when "step-mark-sync-done" is run
  1371. # or when the src cache was restored successfully as that
  1372. # flag file contains "DONE" in the src cache.
  1373. #
  1374. # Case (2) occurs when the flag file is empty, this occurs
  1375. # when the src cache was not restored and "step-mark-sync-done"
  1376. # has not run yet.
  1377. #
  1378. # Notably both of these cases also have completely different
  1379. # gclient cache states.
  1380. # In (1) the git cache is completely empty as we didn't run
  1381. # "gclient sync" because the src cache was restored.
  1382. # In (2) the git cache is full as we had to run "gclient sync"
  1383. #
  1384. # This allows us to do make the follow transitive assumption:
  1385. # In cases where the src cache is restored, saving the git cache
  1386. # will save an empty cache. In cases where the src cache is built
  1387. # during this build the git cache will save a full cache.
  1388. #
  1389. # In order words if there is a src cache for a given DEPS hash
  1390. # the git cache restored will be empty. But if the src cache
  1391. # is missing we will restore a useful git cache.
  1392. - *step-mark-sync-done
  1393. - *step-minimize-workspace-size-from-checkout
  1394. - *step-delete-git-directories
  1395. - when:
  1396. condition: << parameters.persist-checkout >>
  1397. steps:
  1398. - persist_to_workspace:
  1399. root: .
  1400. paths:
  1401. - depot_tools
  1402. - src
  1403. - when:
  1404. condition: << parameters.checkout-to-create-src-cache >>
  1405. steps:
  1406. - run:
  1407. name: Move src folder to the cross-OS portal
  1408. command: |
  1409. sudo mkdir -p /var/portal
  1410. sudo chown -R $(id -u):$(id -g) /var/portal
  1411. mv ./src /var/portal
  1412. - aks-specific-step:
  1413. circle:
  1414. - *step-save-src-cache
  1415. aks:
  1416. - *step-save-src-cache-aks
  1417. could-be-aks: << parameters.could-be-aks >>
  1418. - *step-make-src-cache-marker
  1419. - aks-specific-step:
  1420. circle:
  1421. - *step-save-src-cache-marker
  1422. aks:
  1423. - *step-save-src-cache-marker-aks
  1424. could-be-aks: << parameters.could-be-aks >>
  1425. - when:
  1426. condition: << parameters.build >>
  1427. steps:
  1428. - *step-depot-tools-add-to-path
  1429. - *step-setup-env-for-build
  1430. - *step-wait-for-goma
  1431. - *step-get-more-space-on-mac
  1432. - *step-fix-sync
  1433. - *step-delete-git-directories
  1434. - when:
  1435. condition: << parameters.build >>
  1436. steps:
  1437. - build_and_save_artifacts:
  1438. artifact-key: << parameters.artifact-key >>
  1439. build-type: << parameters.build-type >>
  1440. build-nonproprietary-ffmpeg: << parameters.build-nonproprietary-ffmpeg >>
  1441. - steps: << parameters.after-build-and-save >>
  1442. # Save all data needed for a further tests run.
  1443. - when:
  1444. condition: << parameters.persist >>
  1445. steps:
  1446. - *step-minimize-workspace-size-from-checkout
  1447. - run: |
  1448. rm -rf src/third_party/electron_node/deps/openssl
  1449. rm -rf src/third_party/electron_node/deps/v8
  1450. - persist_to_workspace:
  1451. root: .
  1452. paths:
  1453. # Build artifacts
  1454. - generated_artifacts_<< parameters.artifact-key >>
  1455. - src/out/Default/gen/node_headers
  1456. - src/out/Default/overlapped-checker
  1457. - src/electron
  1458. - src/third_party/electron_node
  1459. - src/third_party/nan
  1460. - src/cross-arch-snapshots
  1461. - src/third_party/llvm-build
  1462. - src/build/linux
  1463. - src/buildtools/third_party/libc++
  1464. - src/buildtools/third_party/libc++abi
  1465. - src/third_party/libc++
  1466. - src/third_party/libc++abi
  1467. - src/out/Default/obj/buildtools/third_party
  1468. - src/v8/tools/builtins-pgo
  1469. - steps: << parameters.after-persist >>
  1470. - when:
  1471. condition: << parameters.build >>
  1472. steps:
  1473. - *step-maybe-notify-slack-failure
  1474. - when:
  1475. condition: << parameters.could-be-aks >>
  1476. steps:
  1477. - run:
  1478. name: Wait for active debug sessions
  1479. command: |
  1480. while [ -f /var/.ssh-lock ]
  1481. do
  1482. sleep 60
  1483. done
  1484. no_output_timeout: 2h
  1485. when: always
  1486. electron-tests:
  1487. parameters:
  1488. artifact-key:
  1489. type: string
  1490. steps:
  1491. - restore_build_artifacts:
  1492. artifact-key: << parameters.artifact-key >>
  1493. - *step-depot-tools-add-to-path
  1494. - *step-electron-dist-unzip
  1495. - *step-mksnapshot-unzip
  1496. - *step-chromedriver-unzip
  1497. - *step-setup-linux-for-headless-testing
  1498. - *step-restore-brew-cache
  1499. - *step-fix-known-hosts-linux
  1500. - *step-install-signing-cert-on-mac
  1501. - run:
  1502. name: Run Electron tests
  1503. environment:
  1504. MOCHA_REPORTER: mocha-multi-reporters
  1505. ELECTRON_TEST_RESULTS_DIR: junit
  1506. MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
  1507. ELECTRON_DISABLE_SECURITY_WARNINGS: 1
  1508. command: |
  1509. cd src
  1510. if [ "$IS_ASAN" == "1" ]; then
  1511. ASAN_SYMBOLIZE="$PWD/tools/valgrind/asan/asan_symbolize.py --executable-path=$PWD/out/Default/electron"
  1512. export ASAN_OPTIONS="symbolize=0 handle_abort=1"
  1513. export G_SLICE=always-malloc
  1514. export NSS_DISABLE_ARENA_FREE_LIST=1
  1515. export NSS_DISABLE_UNLOAD=1
  1516. export LLVM_SYMBOLIZER_PATH=$PWD/third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer
  1517. export MOCHA_TIMEOUT=180000
  1518. echo "Piping output to ASAN_SYMBOLIZE ($ASAN_SYMBOLIZE)"
  1519. (cd electron && (circleci tests glob "spec/*-spec.ts" | circleci tests run --command="xargs node script/yarn test --runners=main --trace-uncaught --enable-logging --files" --split-by=timings 2>&1)) | $ASAN_SYMBOLIZE
  1520. else
  1521. if [ "$TARGET_ARCH" == "arm" ] || [ "$TARGET_ARCH" == "arm64" ]; then
  1522. export ELECTRON_SKIP_NATIVE_MODULE_TESTS=true
  1523. (cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging)
  1524. else
  1525. if [ "$TARGET_ARCH" == "ia32" ]; then
  1526. npm_config_arch=x64 node electron/node_modules/dugite/script/download-git.js
  1527. fi
  1528. (cd electron && (circleci tests glob "spec/*-spec.ts" | circleci tests run --command="xargs node script/yarn test --runners=main --trace-uncaught --enable-logging --files" --split-by=timings))
  1529. fi
  1530. fi
  1531. - store_test_results:
  1532. path: src/junit
  1533. - *step-verify-mksnapshot
  1534. - *step-verify-chromedriver
  1535. - *step-maybe-notify-slack-failure
  1536. - *step-maybe-cleanup-arm64-mac
  1537. nan-tests:
  1538. parameters:
  1539. artifact-key:
  1540. type: string
  1541. steps:
  1542. - restore_build_artifacts:
  1543. artifact-key: << parameters.artifact-key >>
  1544. - *step-depot-tools-add-to-path
  1545. - *step-electron-dist-unzip
  1546. - *step-setup-linux-for-headless-testing
  1547. - *step-fix-known-hosts-linux
  1548. - run:
  1549. name: Run Nan Tests
  1550. command: |
  1551. cd src
  1552. node electron/script/nan-spec-runner.js
  1553. node-tests:
  1554. parameters:
  1555. artifact-key:
  1556. type: string
  1557. steps:
  1558. - restore_build_artifacts:
  1559. artifact-key: << parameters.artifact-key >>
  1560. - *step-depot-tools-add-to-path
  1561. - *step-electron-dist-unzip
  1562. - *step-setup-linux-for-headless-testing
  1563. - *step-fix-known-hosts-linux
  1564. - run:
  1565. name: Run Node Tests
  1566. command: |
  1567. cd src
  1568. node electron/script/node-spec-runner.js --default --jUnitDir=junit
  1569. - store_test_results:
  1570. path: src/junit
  1571. electron-publish:
  1572. parameters:
  1573. attach:
  1574. type: boolean
  1575. default: false
  1576. checkout:
  1577. type: boolean
  1578. default: true
  1579. build-type:
  1580. type: string
  1581. steps:
  1582. - when:
  1583. condition: << parameters.attach >>
  1584. steps:
  1585. - attach_workspace:
  1586. at: .
  1587. - when:
  1588. condition: << parameters.checkout >>
  1589. steps:
  1590. - *step-depot-tools-get
  1591. - *step-depot-tools-add-to-path
  1592. - *step-restore-brew-cache
  1593. - *step-get-more-space-on-mac
  1594. - when:
  1595. condition: << parameters.checkout >>
  1596. steps:
  1597. - *step-checkout-electron
  1598. - *step-touch-sync-done
  1599. - *step-maybe-restore-git-cache
  1600. - *step-set-git-cache-path
  1601. - *step-gclient-sync
  1602. - *step-delete-git-directories
  1603. - *step-minimize-workspace-size-from-checkout
  1604. - *step-fix-sync
  1605. - *step-setup-env-for-build
  1606. - *step-fix-known-hosts-linux
  1607. - *step-setup-goma-for-build
  1608. - *step-wait-for-goma
  1609. - *step-gn-gen-default
  1610. # Electron app
  1611. - ninja_build_electron:
  1612. build-type: << parameters.build-type >>
  1613. - *step-show-goma-stats
  1614. - *step-maybe-generate-breakpad-symbols
  1615. - *step-maybe-electron-dist-strip
  1616. - step-electron-dist-build
  1617. - *step-maybe-zip-symbols-and-clean
  1618. # mksnapshot
  1619. - *step-mksnapshot-build
  1620. # chromedriver
  1621. - *step-electron-chromedriver-build
  1622. # Node.js headers
  1623. - *step-nodejs-headers-build
  1624. # ffmpeg
  1625. - *step-ffmpeg-gn-gen
  1626. - *step-ffmpeg-build
  1627. # hunspell
  1628. - *step-hunspell-build
  1629. # libcxx
  1630. - *step-maybe-generate-libcxx
  1631. # typescript defs
  1632. - *step-maybe-generate-typescript-defs
  1633. # Publish
  1634. - *step-electron-publish
  1635. - move_and_store_all_artifacts:
  1636. artifact-key: 'publish'
  1637. # List of all jobs.
  1638. jobs:
  1639. # Layer 0: Docs. Standalone.
  1640. ts-compile-doc-change:
  1641. executor:
  1642. name: linux-docker
  1643. size: medium
  1644. environment:
  1645. <<: *env-linux-2xlarge
  1646. <<: *env-testing-build
  1647. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
  1648. <<: *steps-electron-ts-compile-for-doc-change
  1649. # Layer 1: Checkout.
  1650. linux-make-src-cache:
  1651. executor:
  1652. name: linux-docker
  1653. size: << pipeline.parameters.large-linux-executor >>
  1654. environment:
  1655. <<: *env-linux-2xlarge
  1656. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
  1657. steps:
  1658. - electron-build:
  1659. persist: false
  1660. build: false
  1661. checkout: true
  1662. save-git-cache: true
  1663. checkout-to-create-src-cache: true
  1664. artifact-key: 'nil'
  1665. build-type: 'nil'
  1666. could-be-aks: true
  1667. mac-checkout:
  1668. executor:
  1669. name: linux-docker
  1670. size: xlarge
  1671. environment:
  1672. <<: *env-linux-2xlarge
  1673. <<: *env-testing-build
  1674. <<: *env-macos-build
  1675. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
  1676. steps:
  1677. - electron-build:
  1678. persist: false
  1679. build: false
  1680. checkout: true
  1681. persist-checkout: true
  1682. restore-src-cache: false
  1683. artifact-key: 'nil'
  1684. build-type: 'nil'
  1685. could-be-aks: false
  1686. mac-make-src-cache-x64:
  1687. executor:
  1688. name: linux-docker
  1689. size: xlarge
  1690. environment:
  1691. <<: *env-linux-2xlarge
  1692. <<: *env-testing-build
  1693. <<: *env-macos-build
  1694. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
  1695. steps:
  1696. - electron-build:
  1697. persist: false
  1698. build: false
  1699. checkout: true
  1700. save-git-cache: true
  1701. checkout-to-create-src-cache: true
  1702. artifact-key: 'nil'
  1703. build-type: 'nil'
  1704. could-be-aks: false
  1705. mac-make-src-cache-arm64:
  1706. executor:
  1707. name: linux-docker
  1708. size: xlarge
  1709. environment:
  1710. <<: *env-linux-2xlarge
  1711. <<: *env-testing-build
  1712. <<: *env-macos-build
  1713. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac --custom-var=host_cpu=arm64'
  1714. steps:
  1715. - electron-build:
  1716. persist: false
  1717. build: false
  1718. checkout: true
  1719. save-git-cache: true
  1720. checkout-to-create-src-cache: true
  1721. artifact-key: 'nil'
  1722. build-type: 'nil'
  1723. could-be-aks: false
  1724. # Layer 2: Builds.
  1725. linux-x64-testing:
  1726. executor:
  1727. name: linux-docker
  1728. size: << pipeline.parameters.large-linux-executor >>
  1729. environment:
  1730. <<: *env-global
  1731. <<: *env-testing-build
  1732. <<: *env-ninja-status
  1733. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
  1734. steps:
  1735. - electron-build:
  1736. persist: true
  1737. checkout: false
  1738. checkout-and-assume-cache: true
  1739. artifact-key: 'linux-x64'
  1740. build-type: 'Linux'
  1741. could-be-aks: true
  1742. linux-x64-testing-asan:
  1743. executor:
  1744. name: linux-docker
  1745. size: << pipeline.parameters.large-linux-executor >>
  1746. environment:
  1747. <<: *env-global
  1748. <<: *env-testing-build
  1749. <<: *env-ninja-status
  1750. CHECK_DIST_MANIFEST: '0'
  1751. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
  1752. GN_EXTRA_ARGS: 'is_asan = true'
  1753. steps:
  1754. - electron-build:
  1755. persist: true
  1756. checkout: false
  1757. checkout-and-assume-cache: true
  1758. build-nonproprietary-ffmpeg: false
  1759. artifact-key: 'linux-x64-asan'
  1760. build-type: 'Linux'
  1761. could-be-aks: true
  1762. linux-x64-testing-gn-check:
  1763. executor:
  1764. name: linux-docker
  1765. size: << pipeline.parameters.medium-linux-executor >>
  1766. environment:
  1767. <<: *env-linux-medium
  1768. <<: *env-testing-build
  1769. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
  1770. steps:
  1771. - run-gn-check:
  1772. could-be-aks: true
  1773. linux-x64-publish:
  1774. executor:
  1775. name: linux-docker
  1776. size: << pipeline.parameters.large-linux-executor >>
  1777. environment:
  1778. <<: *env-linux-2xlarge-release
  1779. <<: *env-release-build
  1780. UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
  1781. <<: *env-ninja-status
  1782. steps:
  1783. - run: echo running
  1784. - when:
  1785. condition:
  1786. or:
  1787. - equal: ["all", << pipeline.parameters.linux-publish-arch-limit >>]
  1788. - equal: ["x64", << pipeline.parameters.linux-publish-arch-limit >>]
  1789. steps:
  1790. - electron-publish:
  1791. attach: false
  1792. checkout: true
  1793. build-type: 'Linux'
  1794. linux-arm-testing:
  1795. executor:
  1796. name: linux-docker
  1797. size: << pipeline.parameters.large-linux-executor >>
  1798. environment:
  1799. <<: *env-global
  1800. <<: *env-arm
  1801. <<: *env-testing-build
  1802. <<: *env-ninja-status
  1803. TRIGGER_ARM_TEST: true
  1804. GENERATE_CROSS_ARCH_SNAPSHOT: true
  1805. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
  1806. steps:
  1807. - electron-build:
  1808. persist: true
  1809. checkout: false
  1810. checkout-and-assume-cache: true
  1811. artifact-key: 'linux-arm'
  1812. build-type: 'Linux ARM'
  1813. could-be-aks: true
  1814. linux-arm-publish:
  1815. executor:
  1816. name: linux-docker
  1817. size: << pipeline.parameters.large-linux-executor >>
  1818. environment:
  1819. <<: *env-linux-2xlarge-release
  1820. <<: *env-arm
  1821. <<: *env-release-build
  1822. <<: *env-32bit-release
  1823. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True'
  1824. UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
  1825. <<: *env-ninja-status
  1826. steps:
  1827. - run: echo running
  1828. - when:
  1829. condition:
  1830. or:
  1831. - equal: ["all", << pipeline.parameters.linux-publish-arch-limit >>]
  1832. - equal: ["arm", << pipeline.parameters.linux-publish-arch-limit >>]
  1833. steps:
  1834. - electron-publish:
  1835. attach: false
  1836. checkout: true
  1837. build-type: 'Linux ARM'
  1838. linux-arm64-testing:
  1839. executor:
  1840. name: linux-docker
  1841. size: << pipeline.parameters.large-linux-executor >>
  1842. environment:
  1843. <<: *env-global
  1844. <<: *env-arm64
  1845. <<: *env-testing-build
  1846. <<: *env-ninja-status
  1847. TRIGGER_ARM_TEST: true
  1848. GENERATE_CROSS_ARCH_SNAPSHOT: true
  1849. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
  1850. steps:
  1851. - electron-build:
  1852. persist: true
  1853. checkout: false
  1854. checkout-and-assume-cache: true
  1855. artifact-key: 'linux-arm64'
  1856. build-type: 'Linux ARM64'
  1857. could-be-aks: true
  1858. linux-arm64-testing-gn-check:
  1859. executor:
  1860. name: linux-docker
  1861. size: << pipeline.parameters.medium-linux-executor >>
  1862. environment:
  1863. <<: *env-linux-medium
  1864. <<: *env-arm64
  1865. <<: *env-testing-build
  1866. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
  1867. steps:
  1868. - run-gn-check:
  1869. could-be-aks: true
  1870. linux-arm64-publish:
  1871. executor:
  1872. name: linux-docker
  1873. size: << pipeline.parameters.large-linux-executor >>
  1874. environment:
  1875. <<: *env-linux-2xlarge-release
  1876. <<: *env-arm64
  1877. <<: *env-release-build
  1878. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm64=True'
  1879. UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
  1880. <<: *env-ninja-status
  1881. steps:
  1882. - run: echo running
  1883. - when:
  1884. condition:
  1885. or:
  1886. - equal: ["all", << pipeline.parameters.linux-publish-arch-limit >>]
  1887. - equal: ["arm64", << pipeline.parameters.linux-publish-arch-limit >>]
  1888. steps:
  1889. - electron-publish:
  1890. attach: false
  1891. checkout: true
  1892. build-type: 'Linux ARM64'
  1893. osx-testing-x64:
  1894. executor:
  1895. name: macos
  1896. size: macos.x86.medium.gen2
  1897. environment:
  1898. <<: *env-mac-large
  1899. <<: *env-testing-build
  1900. <<: *env-ninja-status
  1901. <<: *env-macos-build
  1902. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
  1903. steps:
  1904. - electron-build:
  1905. persist: true
  1906. checkout: false
  1907. checkout-and-assume-cache: true
  1908. attach: true
  1909. artifact-key: 'darwin-x64'
  1910. build-type: 'Darwin'
  1911. after-build-and-save:
  1912. - run:
  1913. name: Configuring MAS build
  1914. command: |
  1915. echo 'export GN_EXTRA_ARGS="is_mas_build = true $GN_EXTRA_ARGS"' >> $BASH_ENV
  1916. echo 'export MAS_BUILD="true"' >> $BASH_ENV
  1917. rm -rf "src/out/Default/Electron Framework.framework"
  1918. rm -rf src/out/Default/Electron*.app
  1919. - build_and_save_artifacts:
  1920. artifact-key: 'mas-x64'
  1921. build-type: 'MAS'
  1922. after-persist:
  1923. - persist_to_workspace:
  1924. root: .
  1925. paths:
  1926. - generated_artifacts_mas-x64
  1927. could-be-aks: false
  1928. osx-testing-x64-gn-check:
  1929. executor:
  1930. name: macos
  1931. size: macos.x86.medium.gen2
  1932. environment:
  1933. <<: *env-machine-mac
  1934. <<: *env-testing-build
  1935. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
  1936. steps:
  1937. - run-gn-check:
  1938. could-be-aks: false
  1939. osx-publish-x64:
  1940. executor:
  1941. name: macos
  1942. size: macos.x86.medium.gen2
  1943. environment:
  1944. <<: *env-mac-large-release
  1945. <<: *env-release-build
  1946. UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
  1947. <<: *env-ninja-status
  1948. steps:
  1949. - run: echo running
  1950. - when:
  1951. condition:
  1952. or:
  1953. - equal: ["all", << pipeline.parameters.macos-publish-arch-limit >>]
  1954. - equal: ["osx-x64", << pipeline.parameters.macos-publish-arch-limit >>]
  1955. steps:
  1956. - electron-publish:
  1957. attach: true
  1958. checkout: false
  1959. build-type: 'Darwin'
  1960. osx-publish-arm64:
  1961. executor:
  1962. name: macos
  1963. size: macos.m1.large.gen1
  1964. environment:
  1965. <<: *env-mac-large-release
  1966. <<: *env-release-build
  1967. <<: *env-apple-silicon
  1968. UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
  1969. <<: *env-ninja-status
  1970. steps:
  1971. - run: echo running
  1972. - when:
  1973. condition:
  1974. or:
  1975. - equal: ["all", << pipeline.parameters.macos-publish-arch-limit >>]
  1976. - equal: ["osx-arm64", << pipeline.parameters.macos-publish-arch-limit >>]
  1977. steps:
  1978. - electron-publish:
  1979. attach: true
  1980. checkout: false
  1981. build-type: 'Darwin ARM64'
  1982. osx-testing-arm64:
  1983. executor:
  1984. name: macos
  1985. size: macos.m1.medium.gen1
  1986. environment:
  1987. <<: *env-mac-large
  1988. <<: *env-testing-build
  1989. <<: *env-ninja-status
  1990. <<: *env-macos-build
  1991. <<: *env-apple-silicon
  1992. GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac'
  1993. steps:
  1994. - electron-build:
  1995. persist: true
  1996. checkout: false
  1997. checkout-and-assume-cache: true
  1998. attach: true
  1999. artifact-key: 'darwin-arm64'
  2000. build-type: 'Darwin ARM64'
  2001. after-build-and-save:
  2002. - run:
  2003. name: Configuring MAS build
  2004. command: |
  2005. echo 'export GN_EXTRA_ARGS="is_mas_build = true $GN_EXTRA_ARGS"' >> $BASH_ENV
  2006. echo 'export MAS_BUILD="true"' >> $BASH_ENV
  2007. rm -rf "src/out/Default/Electron Framework.framework"
  2008. rm -rf src/out/Default/Electron*.app
  2009. - build_and_save_artifacts:
  2010. artifact-key: 'mas-arm64'
  2011. build-type: 'MAS ARM64'
  2012. after-persist:
  2013. - persist_to_workspace:
  2014. root: .
  2015. paths:
  2016. - generated_artifacts_mas-arm64
  2017. could-be-aks: false
  2018. mas-publish-x64:
  2019. executor:
  2020. name: macos
  2021. size: macos.x86.medium.gen2
  2022. environment:
  2023. <<: *env-mac-large-release
  2024. <<: *env-mas
  2025. <<: *env-release-build
  2026. UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
  2027. steps:
  2028. - run: echo running
  2029. - when:
  2030. condition:
  2031. or:
  2032. - equal: ["all", << pipeline.parameters.macos-publish-arch-limit >>]
  2033. - equal: ["mas-x64", << pipeline.parameters.macos-publish-arch-limit >>]
  2034. steps:
  2035. - electron-publish:
  2036. attach: true
  2037. checkout: false
  2038. build-type: 'MAS'
  2039. mas-publish-arm64:
  2040. executor:
  2041. name: macos
  2042. size: macos.m1.large.gen1
  2043. environment:
  2044. <<: *env-mac-large-release
  2045. <<: *env-mas-apple-silicon
  2046. <<: *env-release-build
  2047. UPLOAD_TO_STORAGE: << pipeline.parameters.upload-to-storage >>
  2048. <<: *env-ninja-status
  2049. steps:
  2050. - run: echo running
  2051. - when:
  2052. condition:
  2053. or:
  2054. - equal: ["all", << pipeline.parameters.macos-publish-arch-limit >>]
  2055. - equal: ["mas-arm64", << pipeline.parameters.macos-publish-arch-limit >>]
  2056. steps:
  2057. - electron-publish:
  2058. attach: true
  2059. checkout: false
  2060. build-type: 'MAS ARM64'
  2061. # Layer 3: Tests.
  2062. linux-x64-testing-tests:
  2063. executor:
  2064. name: linux-docker
  2065. size: medium
  2066. environment:
  2067. <<: *env-linux-medium
  2068. <<: *env-headless-testing
  2069. <<: *env-stack-dumping
  2070. parallelism: 3
  2071. steps:
  2072. - electron-tests:
  2073. artifact-key: linux-x64
  2074. linux-x64-testing-asan-tests:
  2075. executor:
  2076. name: linux-docker
  2077. size: xlarge
  2078. environment:
  2079. <<: *env-linux-medium
  2080. <<: *env-headless-testing
  2081. <<: *env-stack-dumping
  2082. IS_ASAN: '1'
  2083. DISABLE_CRASH_REPORTER_TESTS: '1'
  2084. parallelism: 3
  2085. steps:
  2086. - electron-tests:
  2087. artifact-key: linux-x64-asan
  2088. linux-x64-testing-nan:
  2089. executor:
  2090. name: linux-docker
  2091. size: medium
  2092. environment:
  2093. <<: *env-linux-medium
  2094. <<: *env-headless-testing
  2095. <<: *env-stack-dumping
  2096. steps:
  2097. - nan-tests:
  2098. artifact-key: linux-x64
  2099. linux-x64-testing-node:
  2100. executor:
  2101. name: linux-docker
  2102. size: xlarge
  2103. environment:
  2104. <<: *env-linux-medium
  2105. <<: *env-headless-testing
  2106. <<: *env-stack-dumping
  2107. steps:
  2108. - node-tests:
  2109. artifact-key: linux-x64
  2110. linux-arm-testing-tests:
  2111. executor: linux-arm
  2112. environment:
  2113. <<: *env-arm
  2114. <<: *env-global
  2115. <<: *env-headless-testing
  2116. <<: *env-stack-dumping
  2117. steps:
  2118. - electron-tests:
  2119. artifact-key: linux-arm
  2120. linux-arm64-testing-tests:
  2121. executor: linux-arm64
  2122. environment:
  2123. <<: *env-arm64
  2124. <<: *env-global
  2125. <<: *env-headless-testing
  2126. <<: *env-stack-dumping
  2127. steps:
  2128. - electron-tests:
  2129. artifact-key: linux-arm64
  2130. darwin-testing-x64-tests:
  2131. executor:
  2132. name: macos
  2133. size: macos.x86.medium.gen2
  2134. version: 14.0.0
  2135. environment:
  2136. <<: *env-mac-large
  2137. <<: *env-stack-dumping
  2138. parallelism: 2
  2139. steps:
  2140. - electron-tests:
  2141. artifact-key: darwin-x64
  2142. darwin-testing-arm64-tests:
  2143. executor: apple-silicon
  2144. environment:
  2145. <<: *env-mac-large
  2146. <<: *env-stack-dumping
  2147. <<: *env-apple-silicon
  2148. <<: *env-runner
  2149. steps:
  2150. - electron-tests:
  2151. artifact-key: darwin-arm64
  2152. mas-testing-x64-tests:
  2153. executor:
  2154. name: macos
  2155. size: macos.x86.medium.gen2
  2156. version: 14.0.0
  2157. environment:
  2158. <<: *env-mac-large
  2159. <<: *env-stack-dumping
  2160. parallelism: 2
  2161. steps:
  2162. - electron-tests:
  2163. artifact-key: mas-x64
  2164. mas-testing-arm64-tests:
  2165. executor: apple-silicon
  2166. environment:
  2167. <<: *env-mac-large
  2168. <<: *env-stack-dumping
  2169. <<: *env-apple-silicon
  2170. <<: *env-runner
  2171. steps:
  2172. - electron-tests:
  2173. artifact-key: mas-arm64
  2174. # List all workflows
  2175. workflows:
  2176. docs-only:
  2177. when:
  2178. and:
  2179. - equal: [false, << pipeline.parameters.run-macos-publish >>]
  2180. - equal: [false, << pipeline.parameters.run-linux-publish >>]
  2181. - equal: [true, << pipeline.parameters.run-docs-only >>]
  2182. jobs:
  2183. - ts-compile-doc-change
  2184. publish-linux:
  2185. when: << pipeline.parameters.run-linux-publish >>
  2186. jobs:
  2187. - linux-x64-publish:
  2188. context: release-env
  2189. - linux-arm-publish:
  2190. context: release-env
  2191. - linux-arm64-publish:
  2192. context: release-env
  2193. publish-macos:
  2194. when: << pipeline.parameters.run-macos-publish >>
  2195. jobs:
  2196. - mac-checkout
  2197. - osx-publish-x64:
  2198. requires:
  2199. - mac-checkout
  2200. context: release-env
  2201. - mas-publish-x64:
  2202. requires:
  2203. - mac-checkout
  2204. context: release-env
  2205. - osx-publish-arm64:
  2206. requires:
  2207. - mac-checkout
  2208. context: release-env
  2209. - mas-publish-arm64:
  2210. requires:
  2211. - mac-checkout
  2212. context: release-env
  2213. build-linux:
  2214. when:
  2215. and:
  2216. - equal: [false, << pipeline.parameters.run-macos-publish >>]
  2217. - equal: [false, << pipeline.parameters.run-linux-publish >>]
  2218. - equal: [true, << pipeline.parameters.run-build-linux >>]
  2219. jobs:
  2220. - linux-make-src-cache
  2221. - linux-x64-testing:
  2222. requires:
  2223. - linux-make-src-cache
  2224. - linux-x64-testing-asan:
  2225. requires:
  2226. - linux-make-src-cache
  2227. - linux-x64-testing-gn-check:
  2228. requires:
  2229. - linux-make-src-cache
  2230. - linux-x64-testing-tests:
  2231. requires:
  2232. - linux-x64-testing
  2233. - linux-x64-testing-asan-tests:
  2234. requires:
  2235. - linux-x64-testing-asan
  2236. - linux-x64-testing-nan:
  2237. requires:
  2238. - linux-x64-testing
  2239. - linux-x64-testing-node:
  2240. requires:
  2241. - linux-x64-testing
  2242. - linux-arm-testing:
  2243. requires:
  2244. - linux-make-src-cache
  2245. - linux-arm-testing-tests:
  2246. filters:
  2247. branches:
  2248. # Do not run this on forked pull requests
  2249. ignore: /pull\/[0-9]+/
  2250. requires:
  2251. - linux-arm-testing
  2252. - linux-arm64-testing:
  2253. requires:
  2254. - linux-make-src-cache
  2255. - linux-arm64-testing-tests:
  2256. filters:
  2257. branches:
  2258. # Do not run this on forked pull requests
  2259. ignore: /pull\/[0-9]+/
  2260. requires:
  2261. - linux-arm64-testing
  2262. - linux-arm64-testing-gn-check:
  2263. requires:
  2264. - linux-make-src-cache
  2265. build-mac:
  2266. when:
  2267. and:
  2268. - equal: [false, << pipeline.parameters.run-macos-publish >>]
  2269. - equal: [false, << pipeline.parameters.run-linux-publish >>]
  2270. - equal: [true, << pipeline.parameters.run-build-mac >>]
  2271. jobs:
  2272. - mac-make-src-cache-x64
  2273. - mac-make-src-cache-arm64
  2274. - osx-testing-x64:
  2275. requires:
  2276. - mac-make-src-cache-x64
  2277. - osx-testing-x64-gn-check:
  2278. requires:
  2279. - mac-make-src-cache-x64
  2280. - darwin-testing-x64-tests:
  2281. requires:
  2282. - osx-testing-x64
  2283. - osx-testing-arm64:
  2284. requires:
  2285. - mac-make-src-cache-arm64
  2286. - darwin-testing-arm64-tests:
  2287. filters:
  2288. branches:
  2289. # Do not run this on forked pull requests
  2290. ignore: /pull\/[0-9]+/
  2291. requires:
  2292. - osx-testing-arm64
  2293. - mas-testing-x64-tests:
  2294. requires:
  2295. - osx-testing-x64
  2296. - mas-testing-arm64-tests:
  2297. filters:
  2298. branches:
  2299. # Do not run this on forked pull requests
  2300. ignore: /pull\/[0-9]+/
  2301. requires:
  2302. - osx-testing-arm64
  2303. lint:
  2304. jobs:
  2305. - lint