-
Notifications
You must be signed in to change notification settings - Fork 3.4k
test: node_modules installs for system-tests, other improvements #18574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for taking the time to open a PR!
|
47c6d89
to
8603a13
Compare
Test summaryRun details
View run in Cypress Dashboard ➡️ Failures
Flakiness
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
- only scaffold selected project - accept project name, not path - symlink some common node packages
8603a13
to
962c306
Compare
(and thus no yarn.lock)
see https://stackoverflow.com/a/49455609/3474615 for details on why this is needed to fix retries_spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great - nice work!
name: Restore all node_modules to proper workspace folders | ||
command: node scripts/circle-cache.js --action unpack | ||
|
||
restore_cached_system_tests_deps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a describe to this job describe how this cache differentiates from the existing node_modules cache, which includes system-tests/node_modules?
Might be helpful to specify these are specifically the project's node_modules within system-tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Do you know if the description
is actually used anywhere? It's part of the circle.yml spec but IDK where it ends up, I think it may be the equivalent of a code comment: https://circleci.com/docs/2.0/configuration-reference/#commands-requires-version-21
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"main": "index.js", | ||
"scripts": { | ||
"cache:key": "bash -c 'cat ./projects/**/{package.json,yarn.lock}'", | ||
"projects:yarn:install": "node ./scripts/projects-yarn-install.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When running locally, this will need to be ran manually to setup the projects. Any reasons this shouldn't be ran as a post-install script?
We could leverage scripts/run-if-not-ci.sh
to ensure this doesn't install / cache modules for non-system-test jobs in circleci.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of the idea here is that we can defer the install cost locally until you run the tests for the first time. You may never have a need to run error_ui_spec
, so there's no need to install the node_modules for it until you run the test. Then, they'll be cached forevermore.
Putting it in postinstall
would make install slower to get rid of the one-time cost when running the test for the first time locally, which is undesirable.
circle.yml
Outdated
name: Restore system tests node_modules cache | ||
keys: | ||
- v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-node-modules-cache-{{ checksum "system_tests_cache_key" }} | ||
- v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-node-modules-cache- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are two keys needed?
- v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-node-modules-cache- | |
- v{{ .Environment.CACHE_VERSION }}-{{ arch }}-system-tests-projects-node-modules-cache- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://circleci.com/docs/2.0/caching/#restoring-cache
CircleCI restores caches in the order of keys listed in the restore_cache step. Each cache key is namespaced to the project, and retrieval is prefix-matched. The cache will be restored from the first matching key. If there are multiple matches, the most recently generated cache will be used.
So it will either restore the exact correct cache, or the latest created cache.
circle.yml
Outdated
steps: | ||
- run: | ||
name: Generate Circle Cache key for system tests | ||
command: yarn workspace @tooling/system-tests cache:key > system_tests_cache_key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use/update the existing scripts/circle-cache.js
script to generate this cache key? The package.json script is straight-forward but it would align how we are generating these keys in circleci.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed this with @tgriesser originally, but decided to split this out because the system-tests/projects
cache key is way simpler to generate than the circle-cache.js
key. It's a one-liner, versus the somewhat complicated logic in circle-cache
to generate a key. This way we can keep circle-cache.js
's specific purpose as clear as possible.
I didn't re-use any of the existing cache stuff, because I didn't want to make it extra confusing/add even more logic to that process.
- build | ||
- system-tests-node-modules-install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since system-tests-node-modules-install
requires build
, lets slim this requires list to system-tests-node-modules-install
to make the circle ci graph a bit cleaner:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oo i didn't even realize it did this, nice catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yarn was wrapping the stdout with timestamps and stuff, making the hash non-deterministic and breaking caching. now i see why `node_modules_install` just calls the script directly too.
* develop: test: node_modules installs for system-tests, other improvements (#18574) chore(deps): update dependency semantic-release to v17.2.3 [security] (#19022) chore: remove flaky ci jobs for main builds (#19071) chore(contributing): clarify PULL_REQUEST_TEMPLATE (#19068) fix: the shadow root container element is ignored when clicking an element in it. (#18908) 'Fix' flaky redirect test (#19042) release 9.1.0 [skip ci] fix: Allow 'this' to be used in overridden commands (#18899) fix(react): link to rerender example (#19020) chore(deps): update dependency aws-sdk to v2.814.0 [security] (#18948) fix: test config overrides leak for .only execution (#18961) feat: Set CYPRESS=true as env var in child processes where Cypress runs user code in Node (#18981) fix: Restore broken gif (#18987) chore: release @cypress/vite-dev-server-v2.2.1
) Co-authored-by: Emily Rohrbough <[email protected]>
* 10.0-release: feat(graphql): ability to update/query for appData (#19082) fix system test fix failing tests due to merge resolve conflicts test: node_modules installs for system-tests, other improvements (#18574) update yarn.lock chore(deps): update dependency semantic-release to v17.2.3 [security] (#19022) chore: remove flaky ci jobs for main builds (#19071) chore(contributing): clarify PULL_REQUEST_TEMPLATE (#19068) fix: the shadow root container element is ignored when clicking an element in it. (#18908) 'Fix' flaky redirect test (#19042) release 9.1.0 [skip ci] fix: Allow 'this' to be used in overridden commands (#18899) fix(react): link to rerender example (#19020) chore(deps): update dependency aws-sdk to v2.814.0 [security] (#18948) fix: test config overrides leak for .only execution (#18961) feat: Set CYPRESS=true as env var in child processes where Cypress runs user code in Node (#18981) fix: Restore broken gif (#18987) chore: release @cypress/vite-dev-server-v2.2.1
User facing changelog
Additional details
/tmp
, not./packages/server/.projects
.package.json
.yarn install
runs automatically locally and in CI for these projects.e2e.exec
now accepts the project name asproject
, not the project path.system-tests/README.md
for details.How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?