From 0220a06b6318a084bef5ad5b2b99fcd114a08996 Mon Sep 17 00:00:00 2001 From: young-robot Date: Thu, 14 Sep 2023 15:07:00 -0600 Subject: [PATCH 1/5] chore: update contributor workflow --- .circleci/workflows.yml | 390 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 389 insertions(+), 1 deletion(-) diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index 3400182b7dfd..93344e11c8be 100644 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -63,6 +63,9 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters linuxWorkflowExcludeFilters: &linux-x64-workflow-exclude-filters unless: or: + - matches: + pattern: /^pull\/[0-9]+/ + value: << pipeline.git.branch >> - false # windows is slow and expensive in CI, so it normally only runs on main branches @@ -2889,6 +2892,385 @@ linux-x64-workflow: &linux-x64-workflow - get-published-artifacts - system-tests-node-modules-install +linux-x64-contributor-workflow: &linux-x64-contributor-workflow + jobs: + - node_modules_install + - build: + # context: test-runner:env-canary + requires: + - node_modules_install + - check-ts: + requires: + - build + - lint: + name: linux-lint + requires: + - build + - percy-finalize: + context: [test-runner:poll-circle-workflow, test-runner:percy] + required_env_var: PERCY_TOKEN # skips job if not defined (external PR) + requires: + - build + - lint-types: + requires: + - build + # unit, integration and e2e tests + - cli-visual-tests: + context: test-runner:percy + requires: + - build + - unit-tests: + requires: + - build + - verify-release-readiness: + context: test-runner:npm-release + requires: + - build + - server-unit-tests: + requires: + - build + - server-integration-tests: + requires: + - build + - server-performance-tests: + requires: + - build + - system-tests-node-modules-install: + context: test-runner:performance-tracking + requires: + - build + - system-tests-chrome: + context: test-runner:performance-tracking + requires: + - system-tests-node-modules-install + - system-tests-electron: + context: test-runner:performance-tracking + requires: + - system-tests-node-modules-install + - system-tests-firefox: + context: test-runner:performance-tracking + requires: + - system-tests-node-modules-install + - system-tests-webkit: + context: test-runner:performance-tracking + requires: + - system-tests-node-modules-install + - system-tests-non-root: + context: test-runner:performance-tracking + executor: non-root-docker-user + requires: + - system-tests-node-modules-install + - driver-integration-tests-chrome: + context: test-runner:cypress-record-key + requires: + - build + - driver-integration-tests-chrome-beta: + context: test-runner:cypress-record-key + requires: + - build + - driver-integration-tests-firefox: + context: test-runner:cypress-record-key + requires: + - build + - driver-integration-tests-electron: + context: test-runner:cypress-record-key + requires: + - build + - driver-integration-tests-webkit: + context: test-runner:cypress-record-key + requires: + - build + - driver-integration-memory-tests: + requires: + - build + - run-frontend-shared-component-tests-chrome: + context: [test-runner:cypress-record-key, test-runner:launchpad-tests, test-runner:percy] + percy: true + requires: + - build + - run-launchpad-integration-tests-chrome: + context: [test-runner:cypress-record-key, test-runner:launchpad-tests, test-runner:percy] + percy: true + requires: + - build + - run-launchpad-component-tests-chrome: + context: [test-runner:cypress-record-key, test-runner:launchpad-tests, test-runner:percy] + percy: true + requires: + - build + - run-app-integration-tests-chrome: + context: [test-runner:cypress-record-key, test-runner:launchpad-tests, test-runner:percy] + percy: true + requires: + - build + - run-webpack-dev-server-integration-tests: + context: [test-runner:cypress-record-key, test-runner:percy] + requires: + - system-tests-node-modules-install + - run-vite-dev-server-integration-tests: + context: [test-runner:cypress-record-key, test-runner:percy] + requires: + - system-tests-node-modules-install + - run-app-component-tests-chrome: + context: [test-runner:cypress-record-key, test-runner:launchpad-tests, test-runner:percy] + percy: true + requires: + - build + - run-reporter-component-tests-chrome: + context: [test-runner:cypress-record-key, test-runner:percy] + percy: true + requires: + - build + - reporter-integration-tests: + context: [test-runner:cypress-record-key, test-runner:percy] + requires: + - build + - npm-webpack-dev-server: + requires: + - system-tests-node-modules-install + - npm-vite-dev-server: + requires: + - build + - npm-vite-plugin-cypress-esm: + requires: + - build + - npm-webpack-preprocessor: + requires: + - build + - npm-webpack-batteries-included-preprocessor: + requires: + - build + - npm-vue: + requires: + - build + - npm-react: + requires: + - build + - npm-angular: + requires: + - build + - npm-mount-utils: + requires: + - build + - npm-create-cypress-tests: + requires: + - build + - npm-eslint-plugin-dev: + requires: + - build + - npm-cypress-schematic: + requires: + - build + - v8-integration-tests: + requires: + - system-tests-node-modules-install + # This release definition must be updated with any new jobs + # Any attempts to automate this are welcome + # If CircleCI provided an "after all" hook, then this wouldn't be necessary + - trigger-binary-release-workflow: + context: test-runner:poll-circle-workflow + requires: + - build + - check-ts + - npm-angular + - npm-eslint-plugin-dev + - npm-create-cypress-tests + - npm-react + - npm-mount-utils + - npm-vue + - npm-webpack-batteries-included-preprocessor + - npm-webpack-preprocessor + - npm-vite-dev-server + - npm-vite-plugin-cypress-esm + - npm-webpack-dev-server + - npm-cypress-schematic + - lint-types + - linux-lint + - percy-finalize + - driver-integration-tests-firefox + - driver-integration-tests-chrome + - driver-integration-tests-chrome-beta + - driver-integration-tests-electron + - driver-integration-memory-tests + - system-tests-non-root + - system-tests-firefox + - system-tests-electron + - system-tests-chrome + - server-performance-tests + - server-integration-tests + - server-unit-tests + - "test binary as a non-root user" + - "test binary as a root user" + - test-types-cypress-and-jest + - test-full-typescript-project + - test-binary-against-kitchensink + - test-npm-module-on-minimum-node-version + - binary-system-tests + - test-kitchensink + - unit-tests + - verify-release-readiness + - cli-visual-tests + - reporter-integration-tests + - run-app-component-tests-chrome + - run-app-integration-tests-chrome + - run-frontend-shared-component-tests-chrome + - run-launchpad-component-tests-chrome + - run-launchpad-integration-tests-chrome + - run-reporter-component-tests-chrome + - run-webpack-dev-server-integration-tests + - run-vite-dev-server-integration-tests + - v8-integration-tests + + - npm-release: + context: test-runner:npm-release + requires: + - build + - check-ts + - npm-angular + - npm-eslint-plugin-dev + - npm-create-cypress-tests + - npm-react + - npm-mount-utils + - npm-vue + - npm-webpack-batteries-included-preprocessor + - npm-webpack-preprocessor + - npm-vite-dev-server + - npm-vite-plugin-cypress-esm + - npm-webpack-dev-server + - npm-cypress-schematic + - lint-types + - linux-lint + - percy-finalize + - driver-integration-tests-firefox + - driver-integration-tests-chrome + - driver-integration-tests-chrome-beta + - driver-integration-tests-electron + - driver-integration-memory-tests + - system-tests-non-root + - system-tests-firefox + - system-tests-electron + - system-tests-chrome + - server-performance-tests + - server-integration-tests + - server-unit-tests + - test-kitchensink + - unit-tests + - verify-release-readiness + - cli-visual-tests + - reporter-integration-tests + - run-app-component-tests-chrome + - run-app-integration-tests-chrome + - run-frontend-shared-component-tests-chrome + - run-launchpad-component-tests-chrome + - run-launchpad-integration-tests-chrome + - run-reporter-component-tests-chrome + - run-webpack-dev-server-integration-tests + - run-vite-dev-server-integration-tests + - v8-integration-tests + + # This approval job will block the building of the binary on contributor jobs + # If a member of the Cypress team manually approves this job, then it will run with the required contexts + - approve-binary-build: + type: approval + requires: + - build + + - create-and-trigger-packaging-artifacts: + context: + - test-runner:upload + - test-runner:build-binary + - publish-binary + requires: + - approve-binary-build + - wait-for-binary-publish: + type: approval + requires: + - create-and-trigger-packaging-artifacts + - get-published-artifacts: + context: + - publish-binary + - test-runner:commit-status-checks + requires: + - wait-for-binary-publish + # various testing scenarios, like building full binary + # and testing it on a real project + - test-against-staging: + context: test-runner:record-tests + <<: *mainBuildFilters + requires: + - build + - test-kitchensink: + requires: + - build + - test-kitchensink-against-staging: + context: test-runner:record-tests + <<: *mainBuildFilters + requires: + - build + - test-npm-module-on-minimum-node-version: + requires: + - get-published-artifacts + - test-types-cypress-and-jest: + requires: + - get-published-artifacts + - test-full-typescript-project: + requires: + - get-published-artifacts + - test-binary-against-kitchensink: + requires: + - get-published-artifacts + - test-npm-module-and-verify-binary: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-staging: + context: test-runner:record-tests + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-kitchensink-chrome: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-recipes-firefox: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-recipes-chrome: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-recipes: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-kitchensink-firefox: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-todomvc-firefox: + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-cypress-realworld-app: + context: test-runner:cypress-record-key + <<: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-as-specific-user: + name: "test binary as a non-root user" + executor: non-root-docker-user + requires: + - get-published-artifacts + - test-binary-as-specific-user: + name: "test binary as a root user" + requires: + - get-published-artifacts + - binary-system-tests: + requires: + - get-published-artifacts + - system-tests-node-modules-install + linux-arm64-workflow: &linux-arm64-workflow jobs: - node_modules_install: @@ -3131,6 +3513,12 @@ workflows: linux-x64: <<: *linux-x64-workflow <<: *linux-x64-workflow-exclude-filters + linux-x64-contributor: + <<: *linux-x64-contributor-workflow + when: + matches: + pattern: /^pull\/[0-9]+/ + value: << pipeline.git.branch >> linux-arm64: <<: *linux-arm64-workflow <<: *linux-arm64-workflow-filters @@ -3142,4 +3530,4 @@ workflows: <<: *darwin-workflow-filters windows: <<: *windows-workflow - <<: *windows-workflow-filters + <<: *windows-workflow-filters \ No newline at end of file From 22c407eb1d5f34a63b69a01079342dfe6952ccc3 Mon Sep 17 00:00:00 2001 From: young-robot Date: Fri, 22 Sep 2023 10:24:48 -0600 Subject: [PATCH 2/5] fix: add optional chaining for prevAttempts --- packages/driver/src/cypress/runner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/driver/src/cypress/runner.ts b/packages/driver/src/cypress/runner.ts index 1b70f8bf3175..bf23ebb40d24 100644 --- a/packages/driver/src/cypress/runner.ts +++ b/packages/driver/src/cypress/runner.ts @@ -1342,7 +1342,7 @@ export default { const replacePreviousAttemptWith = (test) => { const prevAttempt = _testsById[test.id] - const prevAttempts = prevAttempt.prevAttempts || [] + const prevAttempts = prevAttempt?.prevAttempts || [] const newPrevAttempts = prevAttempts.concat([prevAttempt]) From 5105e9b5e6b1f2584a122451eb5ebfd24a536d75 Mon Sep 17 00:00:00 2001 From: young-robot Date: Fri, 22 Sep 2023 14:31:52 -0600 Subject: [PATCH 3/5] don't concat undefined --- packages/driver/src/cypress/runner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/driver/src/cypress/runner.ts b/packages/driver/src/cypress/runner.ts index bf23ebb40d24..17f58dc1d8bc 100644 --- a/packages/driver/src/cypress/runner.ts +++ b/packages/driver/src/cypress/runner.ts @@ -1344,7 +1344,7 @@ export default { const prevAttempts = prevAttempt?.prevAttempts || [] - const newPrevAttempts = prevAttempts.concat([prevAttempt]) + const newPrevAttempts = prevAttempt ? prevAttempts.concat([prevAttempt]) : prevAttempts delete prevAttempt.prevAttempts From 9a838555caffdcfec4708efe6059eb11e9014660 Mon Sep 17 00:00:00 2001 From: young-robot Date: Fri, 22 Sep 2023 14:48:50 -0600 Subject: [PATCH 4/5] add null check for delete --- packages/driver/src/cypress/runner.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/driver/src/cypress/runner.ts b/packages/driver/src/cypress/runner.ts index 17f58dc1d8bc..e41832ed47bc 100644 --- a/packages/driver/src/cypress/runner.ts +++ b/packages/driver/src/cypress/runner.ts @@ -1346,7 +1346,9 @@ export default { const newPrevAttempts = prevAttempt ? prevAttempts.concat([prevAttempt]) : prevAttempts - delete prevAttempt.prevAttempts + if (prevAttempt) { + delete prevAttempt.prevAttempts + } test.prevAttempts = newPrevAttempts From 9a96dfef8388d4488fedf7c4e5c48b72250cd9c4 Mon Sep 17 00:00:00 2001 From: young-robot Date: Fri, 22 Sep 2023 15:35:15 -0600 Subject: [PATCH 5/5] no need to exclude these anymore --- .circleci/workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index cd41a8b26b58..eb0f285002d8 100644 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -603,7 +603,7 @@ commands: if [[ <> == 'ct' ]]; then # component tests are located side by side with the source codes. # for the app component tests, ignore specs that are known to cause failures on contributor PRs (see https://discuss.circleci.com/t/how-to-exclude-certain-files-from-circleci-test-globbing/41028) - TESTFILES=$(find src -regextype posix-extended -name '*.cy.*' -not -regex '.*(FileMatch|PromoAction|SelectorPlayground|useDurationFormat|useTestingType|SpecPatterns|DebugPendingRunCounts|DebugRunStates|DebugPageHeader|DebugPendingRunSplash|DebugRunNavigation|DebugRunNavigationLimitMessage).cy.*' | circleci tests split --total=$CIRCLE_NODE_TOTAL) + TESTFILES=$(find src -regextype posix-extended -name '*.cy.*' -not -regex '.*(FileMatch|PromoAction|SelectorPlayground|useDurationFormat|useTestingType|SpecPatterns).cy.*' | circleci tests split --total=$CIRCLE_NODE_TOTAL) else GLOB="cypress/e2e/**/*cy.*" TESTFILES=$(circleci tests glob "$GLOB" | circleci tests split --total=$CIRCLE_NODE_TOTAL)