base.yml 85 KB

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