Skip to content

Commit b0c0eaa

Browse files
ryanthemanuellmiller1990flotwigtbiethmanmjhenkes
authored
feat: introduce v8 snapshots to improve startup performance (#24295)
Co-authored-by: Lachlan Miller <[email protected]> Co-authored-by: Zach Bloomquist <[email protected]> Co-authored-by: Tyler Biethman <[email protected]> Co-authored-by: Matt Henkes <[email protected]> Co-authored-by: Chris Breiding <[email protected]> Co-authored-by: Matt Schile <[email protected]> Co-authored-by: Mark Noonan <[email protected]> Co-authored-by: Zachary Williams <[email protected]> Co-authored-by: Ben M <[email protected]> Co-authored-by: Zachary Williams <[email protected]> Co-authored-by: astone123 <[email protected]> Co-authored-by: Bill Glesias <[email protected]> Co-authored-by: Emily Rohrbough <[email protected]> Co-authored-by: Emily Rohrbough <[email protected]> Co-authored-by: semantic-release-bot <[email protected]> Co-authored-by: Adam Stone <[email protected]> Co-authored-by: Blue F <[email protected]> Co-authored-by: GitStart <[email protected]> Co-authored-by: Mike Plummer <[email protected]> Co-authored-by: Jordan <[email protected]> Co-authored-by: Sam Goodger <[email protected]> Co-authored-by: Colum Ferry <[email protected]> Co-authored-by: Stokes Player <[email protected]> Co-authored-by: Vilhelm Melkstam <[email protected]> Co-authored-by: amehta265 <[email protected]>
1 parent 440a08b commit b0c0eaa

File tree

335 files changed

+37371
-623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

335 files changed

+37371
-623
lines changed

.circleci/cache-version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Bump this version to force CI to re-create the cache from scratch.
22

3-
9-13-22
3+
10-31-22

.circleci/config.yml

+109-23
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ mainBuildFilters: &mainBuildFilters
2727
branches:
2828
only:
2929
- develop
30-
- fix-ci-deps
31-
- issue-23843_electron_21_upgrade
30+
- 'feature/v8-snapshots'
3231

3332
# usually we don't build Mac app - it takes a long time
3433
# but sometimes we want to really confirm we are doing the right thing
@@ -37,8 +36,7 @@ macWorkflowFilters: &darwin-workflow-filters
3736
when:
3837
or:
3938
- equal: [ develop, << pipeline.git.branch >> ]
40-
- equal: [ 'correct-dashboard-results', << pipeline.git.branch >> ]
41-
- equal: [ 'issue-23843_electron_21_upgrade', << pipeline.git.branch >> ]
39+
- equal: [ 'feature/v8-snapshots', << pipeline.git.branch >> ]
4240
- matches:
4341
pattern: "-release$"
4442
value: << pipeline.git.branch >>
@@ -47,8 +45,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
4745
when:
4846
or:
4947
- equal: [ develop, << pipeline.git.branch >> ]
50-
- equal: [ 'webkit-multidomain', << pipeline.git.branch >> ]
51-
- equal: [ 'issue-23843_electron_21_upgrade', << pipeline.git.branch >> ]
48+
- equal: [ 'feature/v8-snapshots', << pipeline.git.branch >> ]
5249
- matches:
5350
pattern: "-release$"
5451
value: << pipeline.git.branch >>
@@ -66,8 +63,7 @@ windowsWorkflowFilters: &windows-workflow-filters
6663
when:
6764
or:
6865
- equal: [ develop, << pipeline.git.branch >> ]
69-
- equal: [ linux-arm64, << pipeline.git.branch >> ]
70-
- equal: [ 'ryanm/fix/windows-node-module-install', << pipeline.git.branch >> ]
66+
- equal: [ 'feature/v8-snapshots', << pipeline.git.branch >> ]
7167
- matches:
7268
pattern: "-release$"
7369
value: << pipeline.git.branch >>
@@ -114,25 +110,27 @@ executors:
114110
environment:
115111
PLATFORM: windows
116112

117-
darwin-arm64:
113+
darwin-arm64: &darwin-arm64-executor
118114
machine: true
119115
environment:
120116
PLATFORM: darwin
121117

122-
linux-arm64:
118+
linux-arm64: &linux-arm64-executor
123119
machine:
124120
image: ubuntu-2004:2022.04.1
125121
resource_class: arm.medium
126122
environment:
127123
PLATFORM: linux
124+
# TODO: Disabling snapshots for now on Linux Arm 64 architectures. Will revisit with https://github.com/cypress-io/cypress/issues/23557
125+
DISABLE_SNAPSHOT_REQUIRE: 1
128126

129127
commands:
130128
verify_should_persist_artifacts:
131129
steps:
132130
- run:
133131
name: Check current branch to persist artifacts
134132
command: |
135-
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "issue-23843_electron_21_upgrade" ]]; then
133+
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "feature/v8-snapshots" ]]; then
136134
echo "Not uploading artifacts or posting install comment for this branch."
137135
circleci-agent step halt
138136
fi
@@ -199,6 +197,11 @@ commands:
199197
command: |
200198
source ./scripts/ensure-node.sh
201199
yarn build
200+
- run:
201+
name: Generate v8 snapshot
202+
command: |
203+
source ./scripts/ensure-node.sh
204+
yarn build-v8-snapshot-prod
202205
- prepare-modules-cache # So we don't throw these in the workspace cache
203206
- persist_to_workspace:
204207
root: ~/
@@ -478,7 +481,7 @@ commands:
478481
- run:
479482
name: Run driver tests in Cypress
480483
environment:
481-
CYPRESS_KONFIG_ENV: production
484+
CYPRESS_CONFIG_ENV: production
482485
command: |
483486
echo Current working directory is $PWD
484487
echo Total containers $CIRCLE_NODE_TOTAL
@@ -562,7 +565,7 @@ commands:
562565
# internal PR
563566
cmd=$([[ <<parameters.percy>> == 'true' ]] && echo 'yarn percy exec --parallel -- --') || true
564567
DEBUG=<<parameters.debug>> \
565-
CYPRESS_KONFIG_ENV=production \
568+
CYPRESS_CONFIG_ENV=production \
566569
CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \
567570
PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \
568571
PERCY_ENABLE=${PERCY_TOKEN:-0} \
@@ -588,7 +591,7 @@ commands:
588591
cd ../..
589592
590593
DEBUG=<<parameters.debug>> \
591-
CYPRESS_KONFIG_ENV=production \
594+
CYPRESS_CONFIG_ENV=production \
592595
PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \
593596
PERCY_ENABLE=${PERCY_TOKEN:-0} \
594597
PERCY_PARALLEL_TOTAL=-1 \
@@ -1063,14 +1066,16 @@ commands:
10631066
# notarization on Mac can take a while
10641067
no_output_timeout: "45m"
10651068
command: |
1069+
source ./scripts/ensure-node.sh
1070+
node --version
10661071
if [[ `node ./scripts/get-platform-key.js` == 'linux-arm64' ]]; then
10671072
# these are missing on Circle and there is no way to pre-install them on Arm
10681073
sudo apt-get update
10691074
sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
1075+
DISABLE_SNAPSHOT_REQUIRE=1 yarn binary-build --version $(node ./scripts/get-next-version.js)
1076+
else
1077+
yarn binary-build --version $(node ./scripts/get-next-version.js)
10701078
fi
1071-
source ./scripts/ensure-node.sh
1072-
node --version
1073-
yarn binary-build --version $(node ./scripts/get-next-version.js)
10741079
- run:
10751080
name: Zip the binary
10761081
command: |
@@ -1207,7 +1212,7 @@ jobs:
12071212
<<: *defaultsParameters
12081213
resource_class:
12091214
type: string
1210-
default: medium+
1215+
default: large
12111216
resource_class: << parameters.resource_class >>
12121217
steps:
12131218
- restore_cached_workspace
@@ -1316,6 +1321,52 @@ jobs:
13161321
PERCY_PARALLEL_TOTAL=-1 \
13171322
yarn percy snapshot ./cli/visual-snapshots
13181323
1324+
v8-integration-tests:
1325+
<<: *defaults
1326+
parameters:
1327+
<<: *defaultsParameters
1328+
resource_class:
1329+
type: string
1330+
default: medium
1331+
resource_class: << parameters.resource_class >>
1332+
parallelism: 1
1333+
steps:
1334+
- restore_cached_workspace
1335+
- restore_cached_system_tests_deps
1336+
# TODO: Remove this once we switch off self-hosted M1 runners
1337+
- when:
1338+
condition:
1339+
equal: [ *darwin-arm64-executor, << parameters.executor >> ]
1340+
steps:
1341+
- run: rm -f /tmp/cypress/junit/*
1342+
- unless:
1343+
condition:
1344+
or:
1345+
- equal: [ *linux-arm64-executor, << parameters.executor >> ] # TODO: Figure out how to support linux-arm64 when we get to linux arm64 build: https://github.com/cypress-io/cypress/issues/23557
1346+
steps:
1347+
- run:
1348+
name: Run v8 integration tests
1349+
command: |
1350+
source ./scripts/ensure-node.sh
1351+
yarn test-integration --scope "'@tooling/{packherd,v8-snapshot,electron-mksnapshot}'"
1352+
- verify-mocha-results:
1353+
expectedResultCount: 3
1354+
- when:
1355+
condition:
1356+
or:
1357+
- equal: [ *linux-arm64-executor, << parameters.executor >> ]
1358+
steps:
1359+
- run:
1360+
name: Run v8 integration tests
1361+
command: |
1362+
source ./scripts/ensure-node.sh
1363+
yarn test-integration --scope "'@tooling/packherd'"
1364+
- verify-mocha-results:
1365+
expectedResultCount: 1
1366+
- store_test_results:
1367+
path: /tmp/cypress
1368+
- store-npm-logs
1369+
13191370
unit-tests:
13201371
<<: *defaults
13211372
parameters:
@@ -1346,7 +1397,7 @@ jobs:
13461397
# run type checking for each individual package
13471398
- run: yarn lerna run types
13481399
- verify-mocha-results:
1349-
expectedResultCount: 10
1400+
expectedResultCount: 18
13501401
- store_test_results:
13511402
path: /tmp/cypress
13521403
# CLI tests generate HTML files with sample CLI command output
@@ -1677,7 +1728,7 @@ jobs:
16771728
working_directory: packages/reporter
16781729
- run:
16791730
command: |
1680-
CYPRESS_KONFIG_ENV=production \
1731+
CYPRESS_CONFIG_ENV=production \
16811732
CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \
16821733
PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \
16831734
PERCY_ENABLE=${PERCY_TOKEN:-0} \
@@ -1700,7 +1751,7 @@ jobs:
17001751
- restore_cached_system_tests_deps
17011752
- run:
17021753
command: |
1703-
CYPRESS_KONFIG_ENV=production \
1754+
CYPRESS_CONFIG_ENV=production \
17041755
CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \
17051756
PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \
17061757
PERCY_ENABLE=${PERCY_TOKEN:-0} \
@@ -1722,7 +1773,7 @@ jobs:
17221773
- restore_cached_system_tests_deps
17231774
- run:
17241775
command: |
1725-
CYPRESS_KONFIG_ENV=production \
1776+
CYPRESS_CONFIG_ENV=production \
17261777
CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \
17271778
PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \
17281779
PERCY_ENABLE=${PERCY_TOKEN:-0} \
@@ -1932,7 +1983,7 @@ jobs:
19321983
<<: *defaultsParameters
19331984
resource_class:
19341985
type: string
1935-
default: medium+
1986+
default: large
19361987
resource_class: << parameters.resource_class >>
19371988
steps:
19381989
- restore_cached_workspace
@@ -1951,6 +2002,7 @@ jobs:
19512002
type: string
19522003
default: medium+
19532004
steps:
2005+
- restore_cached_workspace
19542006
- clone-repo-and-checkout-branch:
19552007
repo: cypress-example-kitchensink
19562008
- install-required-node
@@ -1986,6 +2038,7 @@ jobs:
19862038
test-kitchensink-against-staging:
19872039
<<: *defaults
19882040
steps:
2041+
- restore_cached_workspace
19892042
- clone-repo-and-checkout-branch:
19902043
repo: cypress-example-kitchensink
19912044
- install-required-node
@@ -2011,6 +2064,7 @@ jobs:
20112064
test-against-staging:
20122065
<<: *defaults
20132066
steps:
2067+
- restore_cached_workspace
20142068
- clone-repo-and-checkout-branch:
20152069
repo: cypress-test-tiny
20162070
- run:
@@ -2517,6 +2571,9 @@ linux-x64-workflow: &linux-x64-workflow
25172571
- npm-cypress-schematic:
25182572
requires:
25192573
- build
2574+
- v8-integration-tests:
2575+
requires:
2576+
- system-tests-node-modules-install
25202577
# This release definition must be updated with any new jobs
25212578
# Any attempts to automate this are welcome
25222579
# If CircleCI provided an "after all" hook, then this wouldn't be necessary
@@ -2567,6 +2624,7 @@ linux-x64-workflow: &linux-x64-workflow
25672624
- run-reporter-component-tests-chrome
25682625
- run-webpack-dev-server-integration-tests
25692626
- run-vite-dev-server-integration-tests
2627+
- v8-integration-tests
25702628

25712629
# various testing scenarios, like building full binary
25722630
# and testing it on a real project
@@ -2677,6 +2735,13 @@ linux-arm64-workflow: &linux-arm64-workflow
26772735
requires:
26782736
- linux-arm64-build
26792737

2738+
- v8-integration-tests:
2739+
name: linux-arm64-v8-integration-tests
2740+
executor: linux-arm64
2741+
resource_class: arm.medium
2742+
requires:
2743+
- linux-arm64-build
2744+
26802745
darwin-x64-workflow: &darwin-x64-workflow
26812746
jobs:
26822747
- node_modules_install:
@@ -2716,6 +2781,13 @@ darwin-x64-workflow: &darwin-x64-workflow
27162781
requires:
27172782
- darwin-x64-build
27182783

2784+
- v8-integration-tests:
2785+
name: darwin-x64-v8-integration-tests
2786+
executor: mac
2787+
resource_class: macos.x86.medium.gen2
2788+
requires:
2789+
- darwin-x64-build
2790+
27192791
darwin-arm64-workflow: &darwin-arm64-workflow
27202792
jobs:
27212793
- node_modules_install:
@@ -2742,6 +2814,13 @@ darwin-arm64-workflow: &darwin-arm64-workflow
27422814
requires:
27432815
- darwin-arm64-build
27442816

2817+
- v8-integration-tests:
2818+
name: darwin-arm64-v8-integration-tests
2819+
executor: darwin-arm64
2820+
resource_class: cypress-io/latest_m1
2821+
requires:
2822+
- darwin-arm64-build
2823+
27452824
windows-workflow: &windows-workflow
27462825
jobs:
27472826
- node_modules_install:
@@ -2803,6 +2882,13 @@ windows-workflow: &windows-workflow
28032882
requires:
28042883
- windows-create-build-artifacts
28052884

2885+
- v8-integration-tests:
2886+
name: windows-v8-integration-tests
2887+
executor: windows
2888+
resource_class: windows.large
2889+
requires:
2890+
- windows-build
2891+
28062892
workflows:
28072893
linux-x64:
28082894
<<: *linux-x64-workflow

.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,7 @@ system-tests/projects/react-app-webpack-5-unconfigured/**/*
113113

114114
system-tests/project-fixtures/**
115115
system-tests/projects/**/*/expected-cypress*/**/*
116+
117+
# These are generated files that are not linted
118+
tooling/electron-mksnapshot/bin/**
119+
tooling/v8-snapshot/cache/**

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module.exports = {
4141
'**/scripts/**',
4242
'**/test/**',
4343
'**/system-tests/**',
44+
'tooling/**',
4445
'packages/{app,driver,frontend-shared,launchpad}/cypress/**',
4546
'*.test.ts',
4647
// ignore in packages that don't run in the Cypress process

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,7 @@ globbed_node_modules
382382
# Autogenerated files, typically from graphql-code-generator
383383
*.gen.ts
384384
*.gen.json
385+
386+
# Snapshot Binaries
387+
snapshot_blob.bin
388+
v8_context_snapshot.x86_64.bin

.vscode/cspell.json

+10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"composables",
99
"dedup",
1010
"ERRORED",
11+
"esbuild",
1112
"execa",
1213
"Fetchable",
1314
"Fetchables",
@@ -19,17 +20,26 @@
1920
"intlify",
2021
"Lachlan",
2122
"loggedin",
23+
"mksnapshot",
2224
"msapplication",
25+
"norewrite",
2326
"NOTESTS",
2427
"OVERLIMIT",
2528
"overscan",
29+
"packherd",
2630
"Pinia",
2731
"pnpm",
2832
"pseudoclass",
2933
"revparse",
3034
"Screenshotting",
3135
"semibold",
3236
"shiki",
37+
"snapbuild",
38+
"snapgen",
39+
"snapshottable",
40+
"snapshotted",
41+
"snapshotting",
42+
"sourcemaps",
3343
"speclist",
3444
"testid",
3545
"TIMEDOUT",

0 commit comments

Comments
 (0)