base.yml 85 KB

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