base.yml 73 KB

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