diff --git a/.circleci/README.md b/.circleci/README.md new file mode 100644 index 00000000000..ff147588b02 --- /dev/null +++ b/.circleci/README.md @@ -0,0 +1,57 @@ +# CircleCI Configuration + +This directory contains CircleCI configuration files that are automatically generated and updated. + +## Prerequisites + +### CircleCI Local CLI + +The CircleCI Local CLI is required to generate the `pull-request.yml` file from the source configuration. + +**Installation:** + +- **macOS (Homebrew):** + ```bash + brew install circleci + ``` + +- **Linux:** + ```bash + curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | bash + ``` + +- **Windows:** + ```bash + choco install circleci-cli + ``` + +- **Manual installation:** + Download from [CircleCI Local CLI releases](https://github.com/CircleCI-Public/circleci-cli/releases) + +For more detailed installation instructions, see the [CircleCI Local CLI documentation](https://circleci.com/docs/2.0/local-cli/). + +## Lint-Staged Rules + +When files in this directory are modified, the following lint-staged rule will automatically run: + +```bash +circleci config pack .circleci/workflows-src > .circleci/workflows.yml +``` + +This command: +1. Takes the source configuration from `./.circleci/workflows-src/` +2. Packs it into a single YAML file +3. Outputs the result to `./circleci/workflows.yml` + +## File Structure + +- `workflows-src/` - Source configuration files (modify these) +- `workflows.yml` - Generated configuration file (auto-generated, do not edit manually) + +## Development Workflow + +1. Make changes to files in `workflows-src/` +2. The lint-staged hook will automatically regenerate `workflows.yml` and stage it +3. Commit both the source changes and the generated file + +**Note:** Always commit both the source files and the generated `workflows.yml` file together to ensure the CircleCI configuration stays in sync. \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml index 98f7f690add..c4819e76b0b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,63 +1,60 @@ -version: 2.1 -setup: true - -orbs: - continuation: circleci/continuation@1.1.0 - jobs: - verify-ci-should-run: - resource_class: small - docker: - - image: cimg/node:current - steps: - - run: - name: Verify CI should run - command: | - # run CI when manually triggers via CircleCi Dashboard - if [ <> == 'api' ]; then - echo "Always run CI when manually triggered from the UI." - exit 0 - fi - - if [[ "$CIRCLE_BRANCH" == "develop" || "$CIRCLE_BRANCH" == "release/"* ]]; then - echo "Always run CI for develop and for release candidate branches." - exit 0 - fi - - LAST_COMMIT_MESSAGE=$(curl --silent "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/commits/${CIRCLE_BRANCH}" | jq '.commit.message') - - if [[ "$LAST_COMMIT_MESSAGE" =~ "run ci" ]]; then - echo "Always run CI when the commit message includes 'run ci'." - exit 0 - fi - - cancel_build () { - echo "Canceling the CI build..." - circleci-agent step halt - } - - TRIGGER_INSTRUCTIONS="to trigger CI , include 'run ci' in the commit message or click the 'Trigger Pipeline' button in the CircleCI UI." - - if [ ! -z "${CIRCLE_PULL_REQUEST##*/}" ]; then - DRAFT=$(curl --silent "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${CIRCLE_PULL_REQUEST##*/}" | jq '.draft') - - if [[ "${DRAFT}" == true ]]; then - echo "Skipping CI; PR is in draft - $TRIGGER_INSTRUCTIONS" - cancel_build - fi - - echo "Always run CI for PR that is ready for review." - exit 0 - fi - - echo "Skipping CI; branch in progress - $TRIGGER_INSTRUCTIONS" - cancel_build - - checkout - - continuation/continue: - configuration_path: .circleci/workflows.yml - + verify-ci-should-run: + docker: + - image: cimg/node:current + resource_class: small + steps: + - run: + command: | + # run CI when manually triggers via CircleCi Dashboard + if [ <> == 'api' ]; then + echo "Always run CI when manually triggered from the UI." + exit 0 + fi + + if [[ "$CIRCLE_BRANCH" == "develop" || "$CIRCLE_BRANCH" == "release/"* ]]; then + echo "Always run CI for develop and for release candidate branches." + exit 0 + fi + + LAST_COMMIT_MESSAGE=$(curl --silent "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/commits/${CIRCLE_BRANCH}" | jq '.commit.message') + + if [[ "$LAST_COMMIT_MESSAGE" =~ "run ci" ]]; then + echo "Always run CI when the commit message includes 'run ci'." + exit 0 + fi + + cancel_build () { + echo "Canceling the CI build..." + circleci-agent step halt + } + + TRIGGER_INSTRUCTIONS="to trigger CI , include 'run ci' in the commit message or click the 'Trigger Pipeline' button in the CircleCI UI." + + if [ ! -z "${CIRCLE_PULL_REQUEST##*/}" ]; then + DRAFT=$(curl --silent "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${CIRCLE_PULL_REQUEST##*/}" | jq '.draft') + + if [[ "${DRAFT}" == true ]]; then + echo "Skipping CI; PR is in draft - $TRIGGER_INSTRUCTIONS" + cancel_build + fi + + echo "Always run CI for PR that is ready for review." + exit 0 + fi + + echo "Skipping CI; branch in progress - $TRIGGER_INSTRUCTIONS" + cancel_build + name: Verify CI should run + - checkout + - continuation/continue: + configuration_path: .circleci/workflows.yml +orbs: + continuation: circleci/continuation@1.1.0 +setup: true +version: 2.1 workflows: - # the setup-workflow workflow is always triggered. - setup-workflow: - jobs: - - verify-ci-should-run + setup-workflow: + jobs: + - verify-ci-should-run + diff --git a/.circleci/src/config/@config.yml b/.circleci/src/config/@config.yml new file mode 100644 index 00000000000..22eaa1b6649 --- /dev/null +++ b/.circleci/src/config/@config.yml @@ -0,0 +1,4 @@ +version: 2.1 +setup: true +orbs: + continuation: circleci/continuation@1.1.0 \ No newline at end of file diff --git a/.circleci/src/config/jobs/verify-ci-should-run.yml b/.circleci/src/config/jobs/verify-ci-should-run.yml new file mode 100644 index 00000000000..e037876c090 --- /dev/null +++ b/.circleci/src/config/jobs/verify-ci-should-run.yml @@ -0,0 +1,49 @@ +resource_class: small +docker: + - image: cimg/node:current +steps: + - run: + name: Verify CI should run + command: | + # run CI when manually triggers via CircleCi Dashboard + if [ <> == 'api' ]; then + echo "Always run CI when manually triggered from the UI." + exit 0 + fi + + if [[ "$CIRCLE_BRANCH" == "develop" || "$CIRCLE_BRANCH" == "release/"* ]]; then + echo "Always run CI for develop and for release candidate branches." + exit 0 + fi + + LAST_COMMIT_MESSAGE=$(curl --silent "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/commits/${CIRCLE_BRANCH}" | jq '.commit.message') + + if [[ "$LAST_COMMIT_MESSAGE" =~ "run ci" ]]; then + echo "Always run CI when the commit message includes 'run ci'." + exit 0 + fi + + cancel_build () { + echo "Canceling the CI build..." + circleci-agent step halt + } + + TRIGGER_INSTRUCTIONS="to trigger CI , include 'run ci' in the commit message or click the 'Trigger Pipeline' button in the CircleCI UI." + + if [ ! -z "${CIRCLE_PULL_REQUEST##*/}" ]; then + DRAFT=$(curl --silent "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${CIRCLE_PULL_REQUEST##*/}" | jq '.draft') + + if [[ "${DRAFT}" == true ]]; then + echo "Skipping CI; PR is in draft - $TRIGGER_INSTRUCTIONS" + cancel_build + fi + + echo "Always run CI for PR that is ready for review." + exit 0 + fi + + echo "Skipping CI; branch in progress - $TRIGGER_INSTRUCTIONS" + cancel_build + - checkout + - continuation/continue: + configuration_path: .circleci/workflows.yml \ No newline at end of file diff --git a/.circleci/src/config/workflows/setup-workflow.yml b/.circleci/src/config/workflows/setup-workflow.yml new file mode 100644 index 00000000000..c0a30f2c072 --- /dev/null +++ b/.circleci/src/config/workflows/setup-workflow.yml @@ -0,0 +1,2 @@ +jobs: + - verify-ci-should-run \ No newline at end of file diff --git a/.circleci/src/workflows/@workflows.yml b/.circleci/src/workflows/@workflows.yml new file mode 100644 index 00000000000..aaf2c58d7f4 --- /dev/null +++ b/.circleci/src/workflows/@workflows.yml @@ -0,0 +1,2838 @@ +version: 2.1 + +# If the location of these anchors move to a different source file, +# or if the anchor names change, update the following scripts to use +# the new location and/or names: +# - ./scripts/github-actions/update-browser-versions.js + +chrome-stable-version: &chrome-stable-version "140.0.7339.127" +chrome-beta-version: &chrome-beta-version "141.0.7390.16" +firefox-stable-version: &firefox-stable-version "142.0" +base-internal-bullseye: &base-internal-bullseye cypress/base-internal:22.18.0-bullseye +base-internal-yarn-berry: &base-internal-yarn-berry cypress/base-internal:22.18.0-yarn-berry +base-internal-minimum-node: &base-internal-minimum-node cypress/base-internal:22.15.1 +ubuntu-2004-current: &ubuntu-2004-current ubuntu-2004:2024.11.1 +ubuntu-2004-older: &ubuntu-2004-older ubuntu-2004:2024.05.1 + +orbs: + browser-tools: circleci/browser-tools@2.1.1 + +defaults: &defaults + parallelism: 1 + working_directory: ~/cypress + parameters: &defaultsParameters + executor: + type: executor + default: cy-doc + only-cache-for-root-user: + type: boolean + default: false + executor: <> + environment: + ## set specific timezone + &defaultsEnvironment + TZ: "/usr/share/zoneinfo/America/New_York" + + ## store artifacts here + CIRCLE_ARTIFACTS: /tmp/artifacts + + ## set so that e2e tests are consistent + COLUMNS: 100 + LINES: 24 + +executors: + # the Docker image with Cypress dependencies and Chrome browser + cy-doc: + docker: + - image: *base-internal-bullseye + # by default, we use "medium" to balance performance + CI costs. bump or reduce on a per-job basis if needed. + resource_class: medium + environment: + PLATFORM: linux + + kitchensink-executor: + docker: + - image: *base-internal-bullseye + # by default, we use "medium" to balance performance + CI costs. bump or reduce on a per-job basis if needed. + resource_class: medium + environment: + PLATFORM: linux + + # Docker image with non-root "node" user + non-root-docker-user: + docker: + - image: *base-internal-bullseye + user: node + environment: + PLATFORM: linux + + # executor to run on Mac OS + # https://circleci.com/docs/2.0/executor-types/#using-macos + # https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions + darwin-amd64: + machine: true + environment: + PLATFORM: darwin + + # executor to run on Windows - based off of the windows-orb default executor since it is + # not customizable enough to align with our existing setup. + # https://github.com/CircleCI-Public/windows-orb/blob/master/src/executors/default.yml + # https://circleci.com/docs/2.0/hello-world-windows/#software-pre-installed-in-the-windows-image + windows: &windows-executor + machine: + image: windows-server-2022-gui:stable + shell: bash.exe -eo pipefail + resource_class: windows.large + environment: + PLATFORM: windows + + darwin-arm64: &darwin-arm64-executor + machine: true + environment: + PLATFORM: darwin + + linux-arm64: &linux-arm64-executor + machine: + image: ubuntu-2004:2024.11.1 + resource_class: arm.medium + environment: + PLATFORM: linux + # TODO: Disabling snapshots for now on Linux Arm 64 architectures. Will revisit with https://github.com/cypress-io/cypress/issues/23557 + DISABLE_SNAPSHOT_REQUIRE: 1 + + linux-x64: &linux-x64-executor + machine: + image: ubuntu-2004:2024.11.1 + resource_class: medium + environment: + PLATFORM: linux + +commands: + # This command inserts SHOULD_PERSIST_ARTIFACTS into BASH_ENV. This way, we can define the variable in one place and use it in multiple steps. + # Run this command in a job before you want to use the SHOULD_PERSIST_ARTIFACTS variable. + setup_should_persist_artifacts: + steps: + - run: + name: Set environment variable to determine whether or not to persist artifacts + command: | + echo "Setting SHOULD_PERSIST_ARTIFACTS variable" + echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "chore/refactor_cli_to_ts" ]]; then + export SHOULD_PERSIST_ARTIFACTS=true + fi' >> "$BASH_ENV" + # You must run `setup_should_persist_artifacts` command and be using bash before running this command + verify_should_persist_artifacts: + steps: + - run: + name: Check current branch to persist artifacts + command: | + if [[ -z "$SHOULD_PERSIST_ARTIFACTS" ]]; then + echo "Not uploading artifacts or posting install comment for this branch." + circleci-agent step halt + fi + + maybe_skip_binary_jobs: + steps: + - run: + name: Skip binary job if external PR + command: | + if [[ -z "$CIRCLE_TOKEN" ]]; then + echo "There is no CIRCLE_TOKEN set for this job. Cannot trigger binary build. Skipping job." + circleci-agent step halt + fi + + restore_workspace_binaries: + steps: + - attach_workspace: + at: ~/ + # make sure we have cypress.zip received + - run: ls -l + - run: ls -l cypress.zip cypress.tgz + - run: node --version + - run: npm --version + + restore_cached_workspace: + steps: + - attach_workspace: + at: ~/ + - install-required-node + - unpack-dependencies + + restore_cached_binary: + steps: + - attach_workspace: + at: ~/ + + prepare-modules-cache: + parameters: + dont-move: + type: boolean + default: false + steps: + - run: node scripts/circle-cache.js --action prepare + - unless: + condition: << parameters.dont-move >> + steps: + - run: + name: Move to /tmp dir for consistent caching across root/non-root users + command: | + mkdir -p /tmp/node_modules_cache + mv ~/cypress/node_modules /tmp/node_modules_cache/root_node_modules + mv ~/cypress/cli/node_modules /tmp/node_modules_cache/cli_node_modules + mv ~/cypress/system-tests/node_modules /tmp/node_modules_cache/system-tests_node_modules + mv ~/cypress/globbed_node_modules /tmp/node_modules_cache/globbed_node_modules + + install-webkit-deps: + steps: + - run: + name: Install WebKit dependencies + command: | + npx playwright install webkit + npx playwright install-deps webkit + + build-and-persist: + description: Save entire folder as artifact for other jobs to run without reinstalling + steps: + - run: + name: Sync Cloud Validations + command: | + source ./scripts/ensure-node.sh + yarn gulp syncCloudValidations + - run: + name: Build packages + command: | + source ./scripts/ensure-node.sh + yarn build + - run: + name: Generate v8 snapshot + command: | + source ./scripts/ensure-node.sh + # Minification takes some time. We only really need to do that for the binary (and we regenerate snapshots separately there) + V8_UPDATE_METAFILE=1 V8_SNAPSHOT_DISABLE_MINIFY=1 yarn build-v8-snapshot-prod + - prepare-modules-cache # So we don't throw these in the workspace cache + - persist_to_workspace: + root: ~/ + paths: + - cypress + + install_cache_helpers_dependencies: + steps: + - run: + # Dependencies needed by circle-cache.js, before we "yarn" or unpack cached node_modules + name: Cache Helper Dependencies + working_directory: ~/ + command: npm i glob@7.1.6 fs-extra@10.0.0 minimist@1.2.5 + fast-json-stable-stringify@2.1.0 + + unpack-dependencies: + description: 'Unpacks dependencies associated with the current workflow' + steps: + - install_cache_helpers_dependencies + - run: + name: Generate Circle Cache Key + command: node scripts/circle-cache.js --action cacheKey > circle_cache_key + - run: + name: Generate platform key + command: node ./scripts/get-platform-key.js > platform_key + - restore_cache: + name: Restore cache state, to check for known modules cache existence + key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" + }}-node-modules-cache-{{ checksum "circle_cache_key" }} + - run: + name: Move node_modules back from /tmp + command: | + if [[ -d "/tmp/node_modules_cache" ]]; then + mv /tmp/node_modules_cache/root_node_modules ~/cypress/node_modules + mv /tmp/node_modules_cache/cli_node_modules ~/cypress/cli/node_modules + mv /tmp/node_modules_cache/system-tests_node_modules ~/cypress/system-tests/node_modules + mv /tmp/node_modules_cache/globbed_node_modules ~/cypress/globbed_node_modules + rm -rf /tmp/node_modules_cache + fi + - run: + name: Restore all node_modules to proper workspace folders + command: node scripts/circle-cache.js --action unpack + + restore_cached_system_tests_deps: + description: 'Restore the cached node_modules for projects in + "system-tests/projects/**"' + steps: + - run: + name: Generate Circle Cache key for system tests + command: ./system-tests/scripts/cache-key.sh > system_tests_cache_key + - run: + name: Generate platform key + command: node ./scripts/get-platform-key.js > platform_key + - restore_cache: + name: Restore system tests node_modules cache + keys: + - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum + "platform_key" }}-system-tests-projects-node-modules-cache-{{ + checksum "system_tests_cache_key" }} + + update_cached_system_tests_deps: + description: 'Update the cached node_modules for projects in "system-tests/projects/**"' + steps: + - run: + name: Generate Circle Cache key for system tests + command: ./system-tests/scripts/cache-key.sh > system_tests_cache_key + - run: + name: Generate platform key + command: node ./scripts/get-platform-key.js > platform_key + - restore_cache: + name: Restore cache state, to check for known modules cache existence + keys: + - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum + "platform_key" + }}-state-of-system-tests-projects-node-modules-cache-{{ checksum + "system_tests_cache_key" }} + - run: + name: Bail if specific cache exists + command: | + if [[ -f "/tmp/system_tests_node_modules_installed" ]]; then + echo "No updates to system tests node modules, exiting" + circleci-agent step halt + fi + - restore_cache: + name: Restore system tests node_modules cache + keys: + - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum + "platform_key" }}-system-tests-projects-node-modules-cache-{{ + checksum "system_tests_cache_key" }} + - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum + "platform_key" }}-system-tests-projects-node-modules-cache- + - run: + name: Update system-tests node_modules cache + command: yarn workspace @tooling/system-tests projects:yarn:install + - save_cache: + name: Save system tests node_modules cache + key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" + }}-system-tests-projects-node-modules-cache-{{ checksum + "system_tests_cache_key" }} + paths: + - /tmp/cy-system-tests-node-modules + - run: touch /tmp/system_tests_node_modules_installed + - save_cache: + name: Save system tests node_modules cache state key + key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" + }}-state-of-system-tests-projects-node-modules-cache-{{ checksum + "system_tests_cache_key" }} + paths: + - /tmp/system_tests_node_modules_installed + + caching-dependency-installer: + description: 'Installs & caches the dependencies based on yarn lock & package + json dependencies' + parameters: + only-cache-for-root-user: + type: boolean + default: false + build-better-sqlite3: + type: boolean + default: false + steps: + - install_cache_helpers_dependencies + - run: + name: Generate Circle Cache Key + command: node scripts/circle-cache.js --action cacheKey > circle_cache_key + - run: + name: Generate platform key + command: node ./scripts/get-platform-key.js > platform_key + - when: + condition: <> + steps: + - restore_cache: + name: Restore cache state, to check for known modules cache existence + key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" + }}-state-of-node-modules-cache-{{ checksum "circle_cache_key" + }}-better-sqlite3 + - unless: + condition: <> + steps: + - restore_cache: + name: Restore cache state, to check for known modules cache existence + key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" + }}-state-of-node-modules-cache-{{ checksum "circle_cache_key" + }} + - run: + name: Bail if cache exists + command: | + if [[ -f "node_modules_installed" ]]; then + echo "Node modules already cached for dependencies, exiting" + circleci-agent step halt + fi + - run: date +%Y-%U > cache_date + - restore_cache: + name: Restore weekly yarn cache + keys: + - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum + "platform_key" }}-deps-root-weekly-{{ checksum "cache_date" }} + - run: + name: Install Node Modules + command: | + if [[ `node ./scripts/get-platform-key.js` == 'linux-arm64' ]]; then + # Building better-sqlite3 on arm64 requires gcc-10 + # on Arm, CI runs as non-root so we need to use sudo + sudo apt install gcc-10 g++-10 + + # Update default to gcc-10 and g++-10 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 30 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 30 + sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 + sudo update-alternatives --set cc /usr/bin/gcc + sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 + sudo update-alternatives --set c++ /usr/bin/g++ + sudo update-alternatives --config gcc + sudo update-alternatives --config g++ + + # If we are on arm64 we need to install setuptools as it no longer comes standard with the latest version of python + pip install setuptools + fi + source ./scripts/ensure-node.sh + # avoid installing Percy's Chromium every time we use @percy/cli + # https://docs.percy.io/docs/caching-asset-discovery-browser-in-ci + PERCY_POSTINSTALL_BROWSER=true \ + yarn --prefer-offline --frozen-lockfile --cache-folder ~/.yarn + no_output_timeout: 20m + - when: + condition: <> + steps: + - build-better-sqlite3 + - prepare-modules-cache: + dont-move: <> # we don't move, so we don't hit any issues unpacking symlinks + - when: + condition: <> # we don't move to /tmp since we don't need to worry about different users + steps: + - save_cache: + name: Saving node modules for root, cli, and all globbed workspace packages + key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" + }}-node-modules-cache-{{ checksum "circle_cache_key" }} + paths: + - node_modules + - cli/node_modules + - system-tests/node_modules + - globbed_node_modules + - unless: + condition: <> + steps: + - save_cache: + name: Saving node modules for root, cli, and all globbed workspace packages + key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" + }}-node-modules-cache-{{ checksum "circle_cache_key" }} + paths: + - /tmp/node_modules_cache + - run: touch node_modules_installed + - when: + condition: <> + steps: + - save_cache: + name: Saving node-modules cache state key + key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" + }}-state-of-node-modules-cache-{{ checksum "circle_cache_key" + }}-better-sqlite3 + paths: + - node_modules_installed + - unless: + condition: <> + steps: + - save_cache: + name: Saving node-modules cache state key + key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" + }}-state-of-node-modules-cache-{{ checksum "circle_cache_key" + }} + paths: + - node_modules_installed + - save_cache: + name: Save weekly yarn cache + key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" + }}-deps-root-weekly-{{ checksum "cache_date" }} + paths: + - ~/.yarn + - ~/.cy-npm-cache + + verify-build-setup: + description: Common commands run when setting up for build or yarn install + parameters: + executor: + type: executor + default: cy-doc + steps: + - run: pwd + ##- run: + ## name: print global yarn cache path and size + ## command: du -sh $(yarn global bin) + - run: + name: print yarn version + command: yarn versions + - unless: + condition: + # stop-only does not correctly match on windows: https://github.com/bahmutov/stop-only/issues/78 + equal: [ *windows-executor, << parameters.executor >> ] + steps: + - run: + name: Stop .only # this will catch ".only"s in js/coffee as well + command: | + source ./scripts/ensure-node.sh + yarn stop-only-all + - run: + name: Check terminal variables + ## make sure the TERM is set to 'xterm' in node (Linux only) + ## else colors (and tests) will fail + ## See the following information + ## * http://andykdocs.de/development/Docker/Fixing+the+Docker+TERM+variable+issue + ## * https://unix.stackexchange.com/questions/43945/whats-the-difference-between-various-term-variables + command: | + source ./scripts/ensure-node.sh + yarn check-terminal + + install-required-node: + # https://discuss.circleci.com/t/switch-nodejs-version-on-machine-executor-solved/26675/2 + description: Install Node version matching .node-version + steps: + - run: + name: Install Node + command: | + source ./scripts/ensure-node.sh + echo "Installing Yarn" + npm install yarn --location=global # ensure yarn is installed with the correct node engine + yarn check-node-version + - run: + name: Check Node + command: | + source ./scripts/ensure-node.sh + yarn check-node-version + + install-browsers: + description: Install Google Chrome or Firefox + parameters: + executor: + description: The executor in use. Only used if Windows for workaround purposes + type: executor + default: cy-doc + install-chrome: + description: whether or not to install google chrome + type: boolean + default: false + google-chrome-channel: + description: Google Chrome channel to install + type: string + # can be stable, beta, dev, or canary + default: stable + google-chrome-version: + description: Google Chrome version to install + type: string + # latest can also be used here + default: *chrome-stable-version + install-chrome-for-testing: + description: whether or not to install google chrome for testing + type: boolean + default: false + google-chrome-for-testing-version: + description: Google Chrome for Testing version to install + type: string + # latest can also be used here + default: *chrome-stable-version + install-firefox: + description: whether or not to install firefox + type: boolean + default: false + firefox-version: + description: Firefox version to install + type: string + # latest can also be used here + default: *firefox-stable-version + steps: + - when: + condition: + not: + equal: [ *windows-executor, << parameters.executor >> ] + # see https://circleci.com/developer/orbs/orb/circleci/browser-tools + steps: + - when: + condition: + equal: [ true, << parameters.install-firefox >> ] + steps: + - browser-tools/install_firefox: + # https://download-installer.cdn.mozilla.net/pub/firefox/releases/ + version: << parameters.firefox-version >> + - when: + condition: + equal: [ true, << parameters.install-chrome >> ] + steps: + - browser-tools/install_chrome: + # https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable + channel: << parameters.google-chrome-channel >> + chrome_version: << parameters.google-chrome-version >> + - when: + condition: + equal: [ 'beta', << parameters.google-chrome-channel>> ] + steps: + - run: + # When the beta is downloaded with this orb, + # google-chrome-beta is linked in addition to google-chrome, + # which we do not expect and errors out when running Cypress + name: remove linked google-chrome binary + command: | + rm /usr/bin/google-chrome + - when: + condition: + equal: [ true, << parameters.install-chrome-for-testing >> ] + steps: + - run: + name: Install unzip + command: | + apt-get update && apt-get install -y unzip + - browser-tools/install_chrome_for_testing: + version: << parameters.google-chrome-for-testing-version >> + install_chromedriver: false + + # This code builds better-sqlite3 on Debian 11 (Bullseye). This is necessary because Debian 10 has the oldest glibc version (2.31) that we support. + # + # Since this is running Docker remote (because the job running the command may not be using an executor with the appropriate glibc version), we need to + # copy the project into the container, and copy the built plugin out of the container because the host running docker does not have access to the + # project directory so volume mounts are not possible. The built plugin is copied to the project directory so it can be injected into the final binary. + build-better-sqlite3: + description: Build better-sqlite3 for glibc 2.31 + steps: + - setup_remote_docker + - run: + name: Build better-sqlite3 for glibc 2.31 + command: | + if [[ ! -f better_sqlite3.node ]]; then + set -x + apt update && apt install -y docker.io + docker run -d --name better-sqlite3-builder cypress/base-internal:22.18.0-glibc-2.31 /bin/bash -c "sleep 1000000000" + docker cp ~/cypress/node_modules/better-sqlite3 better-sqlite3-builder:/better-sqlite3 + docker exec -it better-sqlite3-builder /bin/bash -c "cd /better-sqlite3 && source /root/.bashrc && chown -R root:root . && npm install --ignore-scripts && npx --no-install prebuild -r electron -t 36.8.1 --include-regex 'better_sqlite3.node$'" + docker cp better-sqlite3-builder:/better-sqlite3/build/Release/better_sqlite3.node ~/cypress/node_modules/better-sqlite3/build/Release/better_sqlite3.node + docker rm -f better-sqlite3-builder + cp ~/cypress/node_modules/better-sqlite3/build/Release/better_sqlite3.node ~/cypress/better_sqlite3.node + else + cp ~/cypress/better_sqlite3.node ~/cypress/node_modules/better-sqlite3/build/Release/better_sqlite3.node + fi + - save_cache: + key: better-sqlite3-{{ checksum "node_modules/better-sqlite3/package.json" }}-{{ + checksum "node_modules/electron/package.json" }} + paths: + - better_sqlite3.node + - run: + name: Clean up top level better-sqlite3 file + command: | + rm ~/cypress/better_sqlite3.node + + run-driver-integration-tests: + parameters: + browser: + description: browser shortname to target + type: string + install-chrome-channel: + description: chrome channel to install + type: string + default: 'stable' + firefox-version: + description: firefox version to install + type: string + default: *firefox-stable-version + inject-document-domain: + description: run subset of tests with injectDocumentDomain config enabled + type: boolean + default: false + + steps: + - restore_cached_workspace + - when: + condition: + equal: [ chrome, << parameters.browser >> ] + steps: + - install-browsers: + install-chrome: true + - when: + condition: + equal: [ chrome:beta, << parameters.browser >> ] + steps: + - install-browsers: + install-chrome: true + google-chrome-channel: << parameters.install-chrome-channel >> + google-chrome-version: *chrome-beta-version + - when: + condition: + equal: [ firefox, << parameters.browser >> ] + steps: + - install-browsers: + install-firefox: true + firefox-version: << parameters.firefox-version >> + - when: + condition: + equal: [ webkit, << parameters.browser >> ] + steps: + - install-webkit-deps + - run: + name: Run driver tests in Cypress + environment: + CYPRESS_CONFIG_ENV: production + command: | + echo Current working directory is $PWD + echo Total containers $CIRCLE_NODE_TOTAL + + if << parameters.inject-document-domain >> ; then + YARN_CMD="cypress:run:inject-document-domain" + PARALLEL="--parallel --group 5x-driver-inject-document-domain-<>" + else + YARN_CMD="cypress:run" + PARALLEL="--parallel --group 5x-driver-<>" + fi + + if [[ -v MAIN_RECORD_KEY ]]; then + # internal PR + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ + CYPRESS_INTERNAL_ENABLE_TELEMETRY="true" \ + yarn $YARN_CMD --record $PARALLEL --browser <> --runner-ui + else + # external PR + TESTFILES=$(circleci tests glob "cypress/e2e/**/*.cy.*" | circleci tests split --total=$CIRCLE_NODE_TOTAL) + echo "Test files for this machine are $TESTFILES" + + if [[ -z "$TESTFILES" ]]; then + echo "Empty list of test files" + fi + yarn $YARN_CMD --browser <> --spec $TESTFILES --runner-ui + fi + working_directory: packages/driver + - sanitize-verify-and-store-mocha-results + + windows-install-chrome: + parameters: + browser: + description: browser shortname to target + type: string + steps: + - run: + # TODO: How can we have preinstalled browsers on CircleCI? + name: 'Install Chrome on Windows' + command: | + # install with `--ignore-checksums` to avoid checksum error + # https://www.gep13.co.uk/blog/chocolatey-error-hashes-do-not-match + [[ $PLATFORM == 'windows' && '<>' == 'chrome' ]] && choco install googlechrome -y --ignore-checksums || [[ $PLATFORM != 'windows' ]] + + run-new-ui-tests: + parameters: + package: + description: package to target + type: enum + enum: [ 'frontend-shared', 'launchpad', 'app', 'reporter' ] + browser: + description: browser shortname to target + type: string + executor: + description: the executor in use. Only used if Windows for workaround purposes + type: executor + percy: + description: enable percy + type: boolean + default: false + type: + description: ct or e2e + type: enum + enum: [ 'ct', 'e2e' ] + debug: + description: debug option + type: string + default: '' + steps: + - restore_cached_workspace + # this is a temporary work around while we wait for circle to resolve issues with packages + # with an @ character in windows during save_cache. + # @see https://github.com/cypress-io/cypress/issues/30343 for more details. + - when: + condition: + equal: [ *windows-executor, << parameters.executor >> ] + steps: + - run: + name: reinstall dependencies to work around cache issue (Windows only) + command: rm -rf node_modules && yarn + - install-browsers: + install-chrome: true + install-firefox: true + executor: << parameters.executor >> + - windows-install-chrome: + browser: <> + - run: + name: Run <> UI tests + command: | + echo Current working directory is $PWD + echo Total containers $CIRCLE_NODE_TOTAL + + if [[ -v MAIN_RECORD_KEY ]]; then + # internal PR + cmd=$([[ <> == 'true' ]] && echo 'yarn percy exec --parallel -- --') || true + + DEBUG=<> \ + CYPRESS_CONFIG_ENV=production \ + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ + PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ + PERCY_ENABLE=${PERCY_TOKEN:-0} \ + PERCY_PARALLEL_TOTAL=-1 \ + CYPRESS_INTERNAL_ENABLE_TELEMETRY="true" \ + $cmd yarn workspace @packages/<> cypress:run:<> --browser <> --record --parallel --group <>-<> + else + # external PR + + # To make `circleci tests` work correctly, we need to step into the package folder. + cd packages/<> + + 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.*' | circleci tests split --total=$CIRCLE_NODE_TOTAL) + else + GLOB="cypress/e2e/**/*cy.*" + TESTFILES=$(circleci tests glob "$GLOB" | circleci tests split --total=$CIRCLE_NODE_TOTAL) + fi + + echo "Test files for this machine are $TESTFILES" + + # To run the `yarn` command, we need to walk out of the package folder. + cd ../.. + + DEBUG=<> \ + CYPRESS_CONFIG_ENV=production \ + PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ + PERCY_ENABLE=${PERCY_TOKEN:-0} \ + PERCY_PARALLEL_TOTAL=-1 \ + yarn workspace @packages/<> cypress:run:<> --browser <> --spec $TESTFILES + fi + - run: + command: | + if [[ <> == 'app' && <> == 'true' && -d "packages/app/cypress/screenshots/runner/screenshot/screenshot.cy.tsx/percy" ]]; then + PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ + PERCY_ENABLE=${PERCY_TOKEN:-0} \ + PERCY_PARALLEL_TOTAL=-1 \ + yarn percy upload packages/app/cypress/screenshots/runner/screenshot/screenshot.cy.tsx/percy + else + echo "skipping percy screenshots uploading" + fi + - sanitize-verify-and-store-mocha-results + + run-system-tests: + parameters: + browser: + description: browser shortname to target + type: string + steps: + - restore_cached_workspace + - restore_cached_system_tests_deps + - when: + condition: + equal: [ webkit, << parameters.browser >> ] + steps: + - install-webkit-deps + - install-browsers: + install-chrome: true + install-chrome-for-testing: true + install-firefox: true + - run: + name: Run system tests + environment: + CYPRESS_COMMERCIAL_RECOMMENDATIONS: '0' + command: | + ALL_SPECS=`circleci tests glob "/root/cypress/system-tests/test/*spec*"` + SPECS= + for file in $ALL_SPECS; do + # filter out non_root tests, they have their own stage + if [[ "$file" == *"non_root"* ]]; then + echo "Skipping $file" + continue + fi + SPECS="$SPECS $file" + done + SPECS=`echo $SPECS | xargs -n 1 | circleci tests split --split-by=timings` + echo SPECS=$SPECS + yarn workspace @tooling/system-tests test:ci $SPECS --browser <> + - sanitize-verify-and-store-mocha-results + + run-binary-system-tests: + steps: + - restore_cached_workspace + - restore_cached_system_tests_deps + - run: + name: Run system tests + environment: + CYPRESS_COMMERCIAL_RECOMMENDATIONS: '0' + command: | + ALL_SPECS=`circleci tests glob "$HOME/cypress/system-tests/test-binary/*spec*"` + SPECS=`echo $ALL_SPECS | xargs -n 1 | circleci tests split --split-by=timings` + echo SPECS=$SPECS + yarn workspace @tooling/system-tests test:ci $SPECS + - sanitize-verify-and-store-mocha-results + + post-install-comment: + parameters: + package_url_path: + type: string + default: npm-package-url.json + binary_url_path: + type: string + default: binary-url.json + description: Post GitHub comment with a blurb on how to install pre-release version + steps: + - run: + name: Post pre-release install comment + command: | + node scripts/add-install-comment.js \ + --npm << parameters.package_url_path >> \ + --binary << parameters.binary_url_path >> + + sanitize-verify-and-store-mocha-results: + description: Double-check that Mocha tests ran as expected. + parameters: + expectedResultCount: + description: The number of result files to expect, ie, the number of Mocha test + suites that ran. + type: integer + ## pass a default magic number of 0 to assert that at least 1 test ran + default: 0 + testResultsPath: + description: The path to the test results + type: string + default: /tmp/cypress + steps: + - run: + name: 'Sanitize Mocha Results' + when: always + command: | + source ./scripts/ensure-node.sh + yarn sanitize:mocha:results + - run: + name: 'Verify Mocha Results' + command: | + source ./scripts/ensure-node.sh + yarn verify:mocha:results <> + - store_test_results: + path: <> + + clone-repo-and-checkout-branch: + description: | + Clones an external repo and then checks out the branch that matches the next version otherwise uses 'master' branch. + parameters: + repo: + description: "Name of the github repo to clone like: cypress-example-kitchensink" + type: string + pull_request_id: + description: Pull request number to check out before installing and testing + type: integer + default: 0 + steps: + - restore_cached_binary + - run: + name: "Cloning test project and checking out release branch: + <>" + working_directory: /tmp/<> + command: | + git clone --depth 1 --no-single-branch https://github.com/cypress-io/<>.git . + + cd ~/cypress/.. + # install some deps for get-next-version + npm i semver@7.3.2 conventional-recommended-bump@6.1.0 conventional-changelog-angular@5.0.12 minimist@1.2.5 + NEXT_VERSION=$(node ./cypress/scripts/get-next-version.js) + cd - + + git checkout $NEXT_VERSION || true + - when: + condition: <> + steps: + - run: + name: Check out PR <> + working_directory: /tmp/<> + command: | + git fetch origin pull/<>/head:pr-<> + git checkout pr-<> + + test-binary-against-rwa: + description: | + Takes the built binary and NPM package, clones the RWA repo + and runs the new version of Cypress against it. + parameters: + repo: + description: "Name of the github repo to clone like" + type: string + default: "cypress-realworld-app" + browser: + description: Name of the browser to use, like "electron", "chrome", "firefox" + type: enum + enum: [ "", "electron", "chrome", "firefox" ] + default: "" + command: + description: Test command to run to start Cypress tests + type: string + default: "CYPRESS_INTERNAL_ENABLE_TELEMETRY=1 + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY CYPRESS_PROJECT_ID=ypt4pf yarn + cypress:run" + # if the repo to clone and test is a monorepo, you can + # run tests inside a specific subfolder + folder: + description: Subfolder to test in + type: string + default: "" + # you can test new features in the test runner against recipes or other repos + # by opening a pull request in those repos and running this test job + # against a pull request number in the example repo + pull_request_id: + description: Pull request number to check out before installing and testing + type: integer + default: 0 + server-start-command: + description: Server start command for repo + type: string + default: "CI=true yarn start" + steps: + - clone-repo-and-checkout-branch: + repo: <> + - when: + condition: <> + steps: + - run: + name: Check out PR <> + working_directory: /tmp/<> + command: | + git fetch origin pull/<>/head:pr-<> + git checkout pr-<> + git log -n 2 + - run: + command: yarn + working_directory: /tmp/<> + - run: + name: Install Cypress + working_directory: /tmp/<> + # force installing the freshly built binary + command: | + CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i --legacy-peer-deps ~/cypress/cypress.tgz && [[ -f yarn.lock ]] && yarn + - install-browsers: + install-chrome: true + - run: + name: Print Cypress version + working_directory: /tmp/<> + command: npx cypress version + - run: + name: Types check 🧩 (maybe) + working_directory: /tmp/<> + command: yarn types + - run: + # NOTE: we do not need to wait for the vite dev server to start + working_directory: /tmp/<> + command: <> + background: true + - when: + condition: <> + steps: + - when: + condition: <> + steps: + - run: + name: Run tests using browser "<>" + working_directory: /tmp/<>/<> + command: | + <> --browser <> --record false + - unless: + condition: <> + steps: + - run: + name: Run tests using command + working_directory: /tmp/<>/<> + command: <> + - unless: + condition: <> + steps: + - when: + condition: <> + steps: + - run: + name: Run tests using browser "<>" + working_directory: /tmp/<> + command: <> --browser <> --record false + - unless: + condition: <> + steps: + - run: + name: Run tests using command + working_directory: /tmp/<> + command: <> + + test-binary-against-repo: + description: | + Takes the built binary and NPM package, clones given example repo + and runs the new version of Cypress against it. + parameters: + repo: + description: "Name of the github repo to clone like: cypress-example-kitchensink" + type: string + browser: + description: Name of the browser to use, like "electron", "chrome", "firefox" + type: enum + enum: [ "", "electron", "chrome", "firefox" ] + default: "" + command: + description: Test command to run to start Cypress tests + type: string + default: "npm run e2e" + build-project: + description: Should the project build script be executed + type: boolean + default: true + # if the repo to clone and test is a monorepo, you can + # run tests inside a specific subfolder + folder: + description: Subfolder to test in + type: string + default: "" + # you can test new features in the test runner against recipes or other repos + # by opening a pull request in those repos and running this test job + # against a pull request number in the example repo + pull_request_id: + description: Pull request number to check out before installing and testing + type: integer + default: 0 + wait-on: + description: Whether to use wait-on to wait on a server to be booted + type: string + default: "" + server-start-command: + description: Server start command for repo + type: string + default: "npm start --if-present" + executor: + description: The executor in use. Only used if Windows for workaround purposes + type: executor + default: cy-doc + steps: + - run: + name: Install yarn if not already installed + command: | + yarn --version || npm i -g yarn + - clone-repo-and-checkout-branch: + repo: <> + pull_request_id: <> + - run: + # Ensure we're installing the node-version for the cloned repo + command: | + if [[ -f .node-version ]]; then + branch="<< pipeline.git.branch >>" + + externalBranchPattern='^pull\/[0-9]+' + if [[ $branch =~ $externalBranchPattern ]]; then + # We are unable to curl from the external PR branch location + # so we fall back to develop + branch="develop" + fi + + curl -L https://raw.githubusercontent.com/cypress-io/cypress/$branch/scripts/ensure-node.sh --output ci-ensure-node.sh + else + # if no .node-version file exists, we no-op the node script and use the global yarn + echo '' > ci-ensure-node.sh + fi + working_directory: /tmp/<> + - run: + # Install deps + Cypress binary with yarn if yarn.lock present + command: | + source ./ci-ensure-node.sh + if [[ -f yarn.lock ]]; then + yarn --frozen-lockfile + CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip yarn add -D ~/cypress/cypress.tgz + else + npm install + CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm install --legacy-peer-deps ~/cypress/cypress.tgz + fi + working_directory: /tmp/<> + - run: + name: Print Cypress version + working_directory: /tmp/<> + command: | + source ./ci-ensure-node.sh + npx cypress version + - run: + name: Types check 🧩 (maybe) + working_directory: /tmp/<> + command: | + source ./ci-ensure-node.sh + [[ -f yarn.lock ]] && yarn types || npm run types --if-present + - when: + condition: <> + steps: + - run: + name: Build 🏗 (maybe) + working_directory: /tmp/<> + command: | + source ./ci-ensure-node.sh + [[ -f yarn.lock ]] && yarn build || npm run build --if-present + - run: + working_directory: /tmp/<> + command: | + source ./ci-ensure-node.sh + <> + background: true + - when: + condition: + not: + equal: [ "", <> ] + steps: + - run: + name: "Waiting on server to boot: <>" + command: | + npm i -g wait-on + npx wait-on <> --timeout 120000 + - install-browsers: + install-chrome: true + install-firefox: true + executor: << parameters.executor >> + - windows-install-chrome: + browser: <> + - when: + condition: <> + steps: + - when: + condition: <> + steps: + - run: + name: Run tests using browser "<>" + working_directory: /tmp/<>/<> + command: | + <> -- --browser <> + - unless: + condition: <> + steps: + - run: + name: Run tests using command + working_directory: /tmp/<>/<> + command: <> + - unless: + condition: <> + steps: + - when: + condition: <> + steps: + - run: + name: Run tests using browser "<>" + working_directory: /tmp/<> + command: | + source ./ci-ensure-node.sh + <> -- --browser <> + - unless: + condition: <> + steps: + - run: + name: Run tests using command + working_directory: /tmp/<> + command: | + source ./ci-ensure-node.sh + <> + + check-if-binary-exists: + steps: + - run-on-dependencies: + package: internal-scripts + command: build + - run: + name: Check if binary exists, exit if it does + command: | + source ./scripts/ensure-node.sh + yarn gulp e2eTestScaffold + yarn check-binary-on-cdn --version $(node ./scripts/get-next-version.js) --type binary --file cypress.zip + + run-on-dependencies: + parameters: + package: + description: Package to build all dependencies for. All dependencies in the + dependency chain must have a build script. + type: string + command: + description: Command to run on the dependencies. + type: string + steps: + - run: + name: Exec << parameters.command >> recursively on << parameters.package >> + dependencies. + command: | + source ./scripts/ensure-node.sh + yarn lerna run <> --scope=<> --include-dependencies + + build-and-package-binary: + steps: + - run: + name: Check environment variables before code sign (if on Mac/Windows) + # NOTE + # our code sign works via electron-builder + # by default, electron-builder will NOT sign app built in a pull request + # even our internal one (!) + # Usually this is not a problem, since we only build and test binary + # built on the "develop" branch + # but if you need to really build and sign a binary in a PR + # set variable CSC_FOR_PULL_REQUEST=true + command: | + set -e + NEEDS_CODE_SIGNING_WINDOWS=`node -p 'process.platform === "win32"'` + NEEDS_CODE_SIGNING_MAC=`node -p 'process.platform === "darwin"'` + + if [[ "$NEEDS_CODE_SIGNING_MAC" == "true" ]]; then + echo "Checking for required environment variables..." + if [ -z "$CSC_LINK" ]; then + echo "Need to provide environment variable CSC_LINK" + echo "with base64 encoded certificate .p12 file" + exit 1 + fi + if [ -z "$CSC_KEY_PASSWORD" ]; then + echo "Need to provide environment variable CSC_KEY_PASSWORD" + echo "with password for unlocking certificate .p12 file" + exit 1 + fi + echo "Succeeded." + elif [[ "$NEEDS_CODE_SIGNING_WINDOWS" == "true" ]]; then + echo "Checking for required environment variables..." + if [ -z "$WINDOWS_SIGN_USER_NAME" ]; then + echo "Need to provide environment variable WINDOWS_SIGN_USER_NAME" + echo "with password for fetching and signing certificate" + exit 1 + fi + if [ -z "$WINDOWS_SIGN_USER_PASSWORD" ]; then + echo "Need to provide environment variable WINDOWS_SIGN_USER_PASSWORD" + echo "for fetching and signing certificate" + exit 1 + fi + if [ -z "$WINDOWS_SIGN_CREDENTIAL_ID" ]; then + echo "Need to provide environment variable WINDOWS_SIGN_CREDENTIAL_ID" + echo "for identifying certificate" + exit 1 + fi + if [ -z "$WINDOWS_SIGN_USER_TOTP" ]; then + echo "Need to provide environment variable WINDOWS_SIGN_USER_TOTP" + echo "for signing certificate" + exit 1 + fi + echo "Succeeded." + else + echo "Not code signing for this platform" + fi + - run: + name: Build the Cypress binary + no_output_timeout: "45m" + command: | + source ./scripts/ensure-node.sh + node --version + if [[ `node ./scripts/get-platform-key.js` == 'linux-arm64' ]]; then + # these are missing on Circle and there is no way to pre-install them on Arm + sudo apt-get update + sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb + DISABLE_SNAPSHOT_REQUIRE=1 yarn binary-build --version $(node ./scripts/get-next-version.js) + else + yarn binary-build --version $(node ./scripts/get-next-version.js) + fi + - run: + name: Package the Cypress binary + environment: + DEBUG: electron-builder,electron-osx-sign*,electron-notarize* + # notarization on Mac can take a while + no_output_timeout: "45m" + command: | + source ./scripts/ensure-node.sh + node --version + if [[ `node ./scripts/get-platform-key.js` == 'linux-arm64' ]]; then + # these are missing on Circle and there is no way to pre-install them on Arm + sudo apt-get update + sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb + DISABLE_SNAPSHOT_REQUIRE=1 yarn binary-package --version $(node ./scripts/get-next-version.js) + else + yarn binary-package --version $(node ./scripts/get-next-version.js) + fi + - run: + name: Smoke Test the Cypress binary + command: | + source ./scripts/ensure-node.sh + node --version + yarn binary-smoke-test --version $(node ./scripts/get-next-version.js) + - run: + name: Zip the binary + command: | + if [[ $PLATFORM == 'linux' ]]; then + # on Arm, CI runs as non-root, on x64 CI runs as root but there is no sudo binary + if [[ `whoami` == 'root' ]]; then + apt-get update && apt-get install -y zip + else + sudo apt-get update && sudo apt-get install -y zip + fi + fi + source ./scripts/ensure-node.sh + yarn binary-zip + - persist_to_workspace: + root: ~/ + paths: + - cypress/cypress.zip + + trigger-publish-binary-pipeline: + steps: + - run: + name: "Trigger publish-binary pipeline" + command: | + source ./scripts/ensure-node.sh + echo $SHOULD_PERSIST_ARTIFACTS + node ./scripts/binary/trigger-publish-binary-pipeline.js + - persist_to_workspace: + root: ~/ + paths: + - triggered_pipeline.json + + build-cypress-npm-package: + parameters: + executor: + type: executor + default: cy-doc + steps: + - run: + name: Bump NPM version + command: | + source ./scripts/ensure-node.sh + yarn get-next-version --npm + - run: + name: Build NPM package + command: | + source ./scripts/ensure-node.sh + yarn lerna run build-cli + - run: + command: ls -la types + working_directory: cli/build + - run: + command: ls -la vue mount-utils react + working_directory: cli/build + - unless: + condition: + equal: [ *windows-executor, << parameters.executor >> ] + steps: + - run: + name: list NPM package contents + command: | + source ./scripts/ensure-node.sh + yarn workspace cypress size + - run: + name: pack NPM package + working_directory: cli/build + command: yarn pack --filename ../../cypress.tgz + - run: + name: list created NPM package + command: ls -l + - persist_to_workspace: + root: ~/ + paths: + - cypress/cypress.tgz + + upload-build-artifacts: + steps: + - run: ls -l + - run: + name: Upload unique binary to S3 + command: | + node scripts/binary.js upload-build-artifact \ + --type binary \ + --file cypress.zip \ + --version $(node -p "require('./package.json').version") + - run: + name: Upload NPM package to S3 + command: | + node scripts/binary.js upload-build-artifact \ + --type npm-package \ + --file cypress.tgz \ + --version $(node -p "require('./package.json').version") + - run: ls -l + - run: cat binary-url.json + - run: cat npm-package-url.json + - persist_to_workspace: + root: ~/ + paths: + - cypress/binary-url.json + - cypress/npm-package-url.json + + update_known_hosts: + description: Ensures that we have the latest Git public keys to prevent git+ssh + from failing. + steps: + - run: + name: Update known_hosts with github.com keys + command: | + mkdir -p ~/.ssh + ssh-keyscan github.com >> ~/.ssh/known_hosts + +jobs: + ## Checks if we already have a valid cache for the node_modules_install and if it has, + ## skips ahead to the build step, otherwise installs and caches the node_modules + node_modules_install: + <<: *defaults + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: medium + build-better-sqlite3: + type: boolean + default: false + resource_class: << parameters.resource_class >> + steps: + - update_known_hosts + - checkout + - install-required-node + - verify-build-setup: + executor: << parameters.executor >> + - persist_to_workspace: + root: ~/ + paths: + - cypress + - .ssh + - .nvm # mac / linux + - ProgramData/nvm # windows + - caching-dependency-installer: + only-cache-for-root-user: <> + build-better-sqlite3: <> + + ## restores node_modules from previous step & builds if first step skipped + build: + <<: *defaults + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: large + is_contributor_pr: + type: boolean + default: false + resource_class: << parameters.resource_class >> + steps: + - restore_cached_workspace + # this is a temporary work around while we wait for circle to resolve issues with packages + # with an @ character in windows during save_cache. + # @see https://github.com/cypress-io/cypress/issues/30343 for more details. + - when: + condition: + equal: [ *windows-executor, << parameters.executor >> ] + steps: + - run: + name: reinstall dependencies to work around cache issue (Windows only) + command: rm -rf node_modules && yarn + - run: + name: Top level packages + command: yarn list --depth=0 || true + - run: + name: Check env canaries + command: node ./scripts/circle-env.js --check-canaries --is-contributor-pr << + parameters.is_contributor_pr >> + - build-and-persist + + lint: + <<: *defaults + steps: + - restore_cached_workspace + - run: + name: Linting 🧹 + command: | + yarn clean + git clean -df + yarn lint + - run: + name: cypress info (dev) + command: node cli/bin/cypress info --dev + + check-ts: + <<: *defaults + steps: + - restore_cached_workspace + - install-required-node + - run: + name: Check TS Types + command: NODE_OPTIONS=--max_old_space_size=4096 yarn check-ts --concurrency=1 + + # a special job that closes the Percy build started by the required jobs + percy-finalize: + <<: *defaults + resource_class: small + parameters: + <<: *defaultsParameters + required_env_var: + type: env_var_name + steps: + - restore_cached_workspace + - run: + # if this is an external pull request, the environment variables + # are NOT set for security reasons, thus no need to to finalize Percy, + # since there will be no visual tests + name: Check if <> is set + command: | + if [[ -v <> ]]; then + echo "Internal PR, good to go" + else + echo "This is an external PR, cannot access other services" + circleci-agent step halt + fi + - run: + # Sometimes, even though all the circle jobs have finished, Percy times out during `build:finalize` + # If all other jobs finish but `build:finalize` fails, we retry it once + name: Finalize percy build - allows single retry + command: | + PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ + yarn percy build:finalize || yarn percy build:finalize + + # verify accessibility scores from Cypress + verify-accessibility-results: + <<: *defaults + resource_class: small + steps: + - run: | + if [[ -z "$MAIN_RECORD_KEY" ]]; then + echo "skipping for contributor PRs since we don't record to the cloud" + circleci-agent step halt + fi + - update_known_hosts + - run: + name: checkout + command: git clone -b "$CIRCLE_BRANCH" "$CIRCLE_REPOSITORY_URL" --depth 1 + - run: + name: Install extract-cloud-results package + command: | + npm install https://cdn.cypress.io/extract-cloud-results/v1/extract-cloud-results.tgz + - run: + name: Verify Accessibility Results + command: | + cp ./cypress/scripts/verify-accessibility-results.js verify-accessibility-results.js + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY node verify-accessibility-results.js + + ready-to-release: + <<: *defaults + resource_class: small + parameters: + <<: *defaultsParameters + steps: + - run: + name: Ready to release + command: echo 'Ready to release' + + cli-visual-tests: + <<: *defaults + resource_class: small + steps: + - restore_cached_workspace + - run: mkdir -p cli/visual-snapshots + - run: + command: node cli/bin/cypress info --dev | yarn --silent term-to-html | node + scripts/sanitize --type cli-info > + cli/visual-snapshots/cypress-info.html + environment: + FORCE_COLOR: 2 + - run: + command: node cli/bin/cypress help | yarn --silent term-to-html > + cli/visual-snapshots/cypress-help.html + environment: + FORCE_COLOR: 2 + - run: + name: Upload CLI snapshots for diffing + command: | + PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ + PERCY_ENABLE=${PERCY_TOKEN:-0} \ + PERCY_PARALLEL_TOTAL=-1 \ + yarn percy snapshot ./cli/visual-snapshots + + v8-integration-tests: + <<: *defaults + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: medium + resource_class: << parameters.resource_class >> + parallelism: 1 + steps: + - restore_cached_workspace + - restore_cached_system_tests_deps + # this is a temporary work around while we wait for circle to resolve issues with packages + # with an @ character in windows during save_cache. + # @see https://github.com/cypress-io/cypress/issues/30343 for more details. + - when: + condition: + equal: [ *windows-executor, << parameters.executor >> ] + steps: + - run: + name: reinstall dependencies to work around cache issue (Windows only) + command: rm -rf node_modules && yarn + # TODO: Remove this once we switch off self-hosted M1 runners + - when: + condition: + equal: [ *darwin-arm64-executor, << parameters.executor >> ] + steps: + - run: rm -f /tmp/cypress/junit/* + - unless: + condition: + or: + - 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 + steps: + - run: + name: Run v8 integration tests + command: | + source ./scripts/ensure-node.sh + yarn test-integration --scope=@tooling/{packherd,v8-snapshot,electron-mksnapshot} + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 3 + - when: + condition: + or: + - equal: [ *linux-arm64-executor, << parameters.executor >> ] + steps: + - run: + name: Run v8 integration tests + command: | + source ./scripts/ensure-node.sh + yarn test-integration --scope=@tooling/packherd + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 1 + + driver-integration-memory-tests: + <<: *defaults + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: medium + resource_class: << parameters.resource_class >> + parallelism: 1 + steps: + - restore_cached_workspace + # this is a temporary work around while we wait for circle to resolve issues with packages + # with an @ character in windows during save_cache. + # @see https://github.com/cypress-io/cypress/issues/30343 for more details. + - when: + condition: + equal: [ *windows-executor, << parameters.executor >> ] + steps: + - run: + name: reinstall dependencies to work around cache issue (Windows only) + command: rm -rf node_modules && yarn + - run: + name: Driver memory tests in Electron + environment: + CYPRESS_CONFIG_ENV: production + command: | + echo Current working directory is $PWD + node --version + if [[ `node ../../scripts/get-platform-key.js` == 'linux-arm64' ]]; then + # these are missing on Circle and there is no way to pre-install them on Arm + sudo apt-get update + sudo apt-get install -y libgbm-dev + fi + + CYPRESS_INTERNAL_MEMORY_SAVE_STATS=true \ + DEBUG=cypress*memory \ + yarn cypress:run --browser electron --spec "cypress/e2e/memory/*.cy.*" + working_directory: packages/driver + - sanitize-verify-and-store-mocha-results + + unit-tests: + <<: *defaults + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: medium + executor: + type: executor + default: linux-x64 + resource_class: << parameters.resource_class >> + parallelism: 1 + steps: + - restore_cached_workspace + - install-browsers: + install-chrome: true + executor: << parameters.executor >> + - when: + condition: + # several snapshots fails for windows due to paths. + # until these are fixed, run the tests that are working. + equal: [ *windows-executor, << parameters.executor >> ] + steps: + - run: yarn test-scripts scripts/**/*spec.js + - sanitize-verify-and-store-mocha-results + - unless: + condition: + equal: [ *windows-executor, << parameters.executor >> ] + steps: + - run: + name: Enable IPv6 in Docker + command: | + cat \<<'EOF' | sudo tee /etc/docker/daemon.json + { + "ipv6": true, + "fixed-cidr-v6": "2001:db8:1::/64" + } + EOF + cat \<<'EOF' | sudo tee /etc/hosts + 127.0.0.1 localhost + ::1 localhost + EOF + sudo service docker restart + - run: + name: Test scripts + command: | + source ./scripts/ensure-node.sh + yarn test-scripts + - run: + name: Test each individual package + command: | + source ./scripts/ensure-node.sh + # this is needed since we are have to be running as root to test some packages + sudo -E env "PATH=$PATH" yarn test + - run: + name: Test types + command: | + source ./scripts/ensure-node.sh + yarn lerna run types + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 18 + + verify-release-readiness: + <<: *defaults + resource_class: small + parallelism: 1 + environment: + GITHUB_TOKEN: $GH_TOKEN + steps: + - restore_cached_workspace + - update_known_hosts + - run: yarn test-npm-package-release-script + - run: node ./scripts/semantic-commits/validate-binary-changelog.js + - store_artifacts: + path: /tmp/releaseData + + lint-types: + <<: *defaults + parallelism: 1 + steps: + - restore_cached_workspace + - run: + command: ls -la types + working_directory: cli + - run: + command: ls -la chai + working_directory: cli/types + - run: + name: "Lint types 🧹" + command: yarn workspace cypress dtslint + + server-unit-tests: + <<: *defaults + parallelism: 1 + steps: + - restore_cached_workspace + - run: yarn test-unit --scope=@packages/server + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 1 + + server-unit-tests-cloud-environment: + <<: *defaults + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: medium + resource_class: << parameters.resource_class >> + parallelism: 1 + steps: + - restore_cached_workspace + # TODO: Remove this once we switch off self-hosted M1 runners + - when: + condition: + equal: [ *darwin-arm64-executor, << parameters.executor >> ] + steps: + - run: rm -f /tmp/cypress/junit/* + # this is a temporary work around while we wait for circle to resolve issues with packages + # with an @ character in windows during save_cache. + # @see https://github.com/cypress-io/cypress/issues/30343 for more details. + - when: + condition: + equal: [ *windows-executor, << parameters.executor >> ] + steps: + - run: + name: reinstall dependencies to work around cache issue (Windows only) + command: rm -rf node_modules && yarn + - run: yarn workspace @packages/server test-unit cloud/environment_spec.ts + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 1 + + server-integration-tests: + <<: *defaults + parallelism: 1 + steps: + - restore_cached_workspace + - install-browsers: + install-chrome: true + - run: yarn test-integration --scope=@packages/server + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 1 + + server-performance-tests: + <<: *defaults + steps: + - restore_cached_workspace + - install-browsers: + install-chrome: true + install-firefox: true + - run: + command: yarn workspace @packages/server test-performance + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 1 + + system-tests-node-modules-install: + <<: *defaults + steps: + - restore_cached_workspace + - update_cached_system_tests_deps + + binary-system-tests: + parallelism: 2 + working_directory: ~/cypress + environment: + <<: *defaultsEnvironment + PLATFORM: linux + machine: + # using `machine` gives us a Linux VM that can run Docker + image: ubuntu-2004:2024.05.1 + docker_layer_caching: true + resource_class: medium + steps: + - maybe_skip_binary_jobs + - run-binary-system-tests + yarn-pnp-preprocessor-system-test: + parallelism: 1 + working_directory: ~/cypress + docker: + # we need an image with yarn 4 berry installed on it to run this test + - image: *base-internal-yarn-berry + environment: + # needed to inform the bootstrap-docker-container.sh script to link the binary in the system-test project directory + REPO_DIR: /root/cypress + TEST_PROJECT_DIR: ./system-tests/projects/yarn-v4.3.1-pnp-dep-resolution + USE_YARN_TO_INSTALL_CYPRESS_BINARY: true + steps: + - maybe_skip_binary_jobs + - attach_workspace: + at: ~/ + # required node is set in the docker container already with yarn 4 + - run: + name: Install monorepo dependencies with yarn v1.22.22 + command: | + # we need to install the monorepo dependencies here in a fresh manner. + # set to the expected version of yarn and install the dependencies + yarn set version 1.22.22 + yarn install --ignore-scripts + - run: + name: install dependencies in yarn-v4.3.1-pnp-dep-resolution with yarn berry + 4.3.1 + command: | + yarn set version 4.3.1 + cd ./system-tests/projects/yarn-v4.3.1-pnp-dep-resolution && yarn + - run: + name: Bootstrap the Cypress binary and run binary system test + command: | + # we need to bootstrap the binary into our project directory and run the tests + source ./system-tests/scripts/bootstrap-docker-container.sh 'yarn cypress run' + # We can remove this job a once https://github.com/sveltejs/svelte-loader/issues/243 is resolved. + svelte-webpack-system-test: + parallelism: 1 + working_directory: ~/cypress + docker: + - image: *base-internal-bullseye + environment: + # needed to inform the bootstrap-docker-container.sh script to link the binary in the system-test project directory + REPO_DIR: /root/cypress + TEST_PROJECT_DIR: ./system-tests/projects/svelte-webpack-configured + USE_YARN_TO_INSTALL_CYPRESS_BINARY: true + steps: + - maybe_skip_binary_jobs + - attach_workspace: + at: ~/ + - run: + name: Install monorepo dependencies + command: yarn install --ignore-scripts + - run: + name: install dependencies + command: cd ./system-tests/projects/svelte-webpack-configured && yarn + - run: + name: Bootstrap the Cypress binary and run binary system test + command: | + # we need to bootstrap the binary into our project directory and run the tests + source ./system-tests/scripts/bootstrap-docker-container.sh 'yarn cypress run --component --spec src/mount.cy.ts src/App.cy.ts' + + system-tests-chrome: + <<: *defaults + resource_class: medium+ + parallelism: 8 + steps: + - run-system-tests: + browser: chrome + + system-tests-electron: + <<: *defaults + resource_class: medium+ + parallelism: 8 + steps: + - run-system-tests: + browser: electron + + system-tests-firefox: + <<: *defaults + resource_class: medium+ + parallelism: 8 + steps: + - run-system-tests: + browser: firefox + + system-tests-webkit: + <<: *defaults + resource_class: medium+ + parallelism: 8 + steps: + - run-system-tests: + browser: webkit + + system-tests-non-root: + <<: *defaults + steps: + - restore_cached_workspace + - run: + environment: + CYPRESS_COMMERCIAL_RECOMMENDATIONS: '0' + command: yarn workspace @tooling/system-tests test:ci "test/non_root*spec*" + --browser electron + - sanitize-verify-and-store-mocha-results + + run-frontend-shared-component-tests-chrome: + <<: *defaults + parameters: + <<: *defaultsParameters + percy: + type: boolean + default: false + parallelism: 3 + steps: + - run-new-ui-tests: + browser: chrome + executor: << parameters.executor >> + percy: << parameters.percy >> + package: frontend-shared + type: ct + + run-launchpad-component-tests-chrome: + <<: *defaults + parameters: + <<: *defaultsParameters + percy: + type: boolean + default: false + parallelism: 7 + steps: + - run-new-ui-tests: + browser: chrome + executor: << parameters.executor >> + percy: << parameters.percy >> + package: launchpad + type: ct + # debug: cypress:*,engine:socket + + run-launchpad-integration-tests-chrome: + <<: *defaults + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: large + percy: + type: boolean + default: false + resource_class: << parameters.resource_class >> + parallelism: 3 + steps: + - run-new-ui-tests: + browser: chrome + executor: << parameters.executor >> + percy: << parameters.percy >> + package: launchpad + type: e2e + + run-app-component-tests-chrome: + <<: *defaults + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: medium+ + percy: + type: boolean + default: false + parallelism: 7 + steps: + - run-new-ui-tests: + browser: chrome + executor: << parameters.executor >> + percy: << parameters.percy >> + package: app + type: ct + + run-app-integration-tests-chrome: + <<: *defaults + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: large + percy: + type: boolean + default: false + resource_class: << parameters.resource_class >> + parallelism: 8 + steps: + - run-new-ui-tests: + browser: chrome + executor: << parameters.executor >> + percy: << parameters.percy >> + package: app + type: e2e + + driver-integration-tests-chrome: + <<: *defaults + parallelism: 5 + resource_class: medium+ + steps: + - run-driver-integration-tests: + browser: chrome + install-chrome-channel: stable + + driver-integration-tests-chrome-inject-document-domain: + <<: *defaults + parallelism: 5 + resource_class: medium+ + steps: + - run-driver-integration-tests: + browser: chrome + install-chrome-channel: stable + inject-document-domain: true + + driver-integration-tests-chrome-beta: + <<: *defaults + resource_class: medium+ + parallelism: 5 + steps: + - run-driver-integration-tests: + browser: chrome:beta + install-chrome-channel: beta + + driver-integration-tests-chrome-beta-inject-document-domain: + <<: *defaults + resource_class: medium+ + parallelism: 5 + steps: + - run-driver-integration-tests: + browser: chrome:beta + install-chrome-channel: beta + inject-document-domain: true + + driver-integration-tests-firefox: + <<: *defaults + resource_class: medium+ + parallelism: 5 + steps: + - run-driver-integration-tests: + browser: firefox + + driver-integration-tests-electron: + <<: *defaults + parallelism: 5 + steps: + - run-driver-integration-tests: + browser: electron + + driver-integration-tests-webkit: + <<: *defaults + resource_class: large + parallelism: 5 + steps: + - run-driver-integration-tests: + browser: webkit + # inject document domain must be true for webkit, as cy.origin is not supported + inject-document-domain: true + + run-reporter-component-tests-chrome: + <<: *defaults + parameters: + <<: *defaultsParameters + percy: + type: boolean + default: false + parallelism: 2 + steps: + - run-new-ui-tests: + browser: chrome + executor: << parameters.executor >> + percy: << parameters.percy >> + package: reporter + type: ct + + reporter-integration-tests: + <<: *defaults + resource_class: medium+ + parallelism: 3 + steps: + - restore_cached_workspace + - run: + command: yarn build-for-tests + working_directory: packages/reporter + - run: + command: | + CYPRESS_CONFIG_ENV=production \ + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ + PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ + PERCY_ENABLE=${PERCY_TOKEN:-0} \ + PERCY_PARALLEL_TOTAL=-1 \ + yarn percy exec --parallel -- -- \ + yarn cypress:run --record --parallel --group reporter --runner-ui + working_directory: packages/reporter + - sanitize-verify-and-store-mocha-results + + run-webpack-dev-server-integration-tests: + <<: *defaults + resource_class: medium+ + parallelism: 2 + steps: + - restore_cached_workspace + - restore_cached_system_tests_deps + - install-browsers: + install-chrome: true + - run: + command: | + CYPRESS_CONFIG_ENV=production \ + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ + PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ + PERCY_ENABLE=${PERCY_TOKEN:-0} \ + PERCY_PARALLEL_TOTAL=-1 \ + yarn percy exec --parallel -- -- \ + yarn cypress:run --record --parallel --group webpack-dev-server + working_directory: npm/webpack-dev-server + - sanitize-verify-and-store-mocha-results + + run-vite-dev-server-integration-tests: + <<: *defaults + # parallelism: 3 TODO: Add parallelism once we have more specs + steps: + - restore_cached_workspace + - restore_cached_system_tests_deps + - install-browsers: + install-chrome: true + - run: + command: | + CYPRESS_CONFIG_ENV=production \ + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ + PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ + PERCY_ENABLE=${PERCY_TOKEN:-0} \ + PERCY_PARALLEL_TOTAL=-1 \ + yarn percy exec --parallel -- -- \ + yarn cypress:run --record --parallel --group vite-dev-server + working_directory: npm/vite-dev-server + - sanitize-verify-and-store-mocha-results + + npm-webpack-preprocessor: + <<: *defaults + steps: + - restore_cached_workspace + - run: + name: Build + command: yarn lerna run build --scope=@cypress/webpack-preprocessor + - run: + name: Run tests + command: yarn workspace @cypress/webpack-preprocessor test + + npm-webpack-dev-server: + <<: *defaults + steps: + - restore_cached_workspace + - restore_cached_system_tests_deps + - run: + name: Run tests + command: yarn workspace @cypress/webpack-dev-server test + - run: + name: Run tests + command: yarn workspace @cypress/webpack-dev-server test + + npm-vite-dev-server: + <<: *defaults + steps: + - restore_cached_workspace + - run: + name: Run tests + command: yarn test + working_directory: npm/vite-dev-server + - sanitize-verify-and-store-mocha-results: + testResultsPath: npm/vite-dev-server/test_results + + npm-webpack-batteries-included-preprocessor: + <<: *defaults + resource_class: small + steps: + - restore_cached_workspace + - run: + name: Run tests + command: yarn workspace @cypress/webpack-batteries-included-preprocessor test + + npm-vue: + <<: *defaults + steps: + - restore_cached_workspace + - run: + name: Build + command: yarn lerna run build --scope=@cypress/vue + - run: + name: Run tests + command: yarn test + working_directory: npm/vue + - sanitize-verify-and-store-mocha-results: + testResultsPath: npm/vue/test_results + + npm-angular: + <<: *defaults + steps: + - restore_cached_workspace + - run: + name: Build + command: yarn lerna run build --scope=@cypress/angular + + npm-puppeteer-unit-tests: + <<: *defaults + steps: + - restore_cached_workspace + - run: + name: Build + command: yarn lerna run build --scope=@cypress/puppeteer + - run: + name: Run tests + command: yarn test + working_directory: npm/puppeteer + - sanitize-verify-and-store-mocha-results: + testResultsPath: npm/puppeteer/test_results + + npm-puppeteer-cypress-tests: + <<: *defaults + resource_class: small + steps: + - restore_cached_workspace + - restore_cached_system_tests_deps + - install-browsers: + install-chrome: true + - run: + command: yarn cypress:run + working_directory: npm/puppeteer + - sanitize-verify-and-store-mocha-results + + npm-react: + <<: *defaults + steps: + - restore_cached_workspace + - run: + name: Build + command: yarn lerna run build --scope=@cypress/react + - run: + name: Run tests + command: yarn test + working_directory: npm/react + - sanitize-verify-and-store-mocha-results: + testResultsPath: npm/react/test_results + + npm-vite-plugin-cypress-esm: + <<: *defaults + steps: + - restore_cached_workspace + - run: + name: Build + command: yarn lerna run build --scope=@cypress/vite-plugin-cypress-esm + - run: + name: Run tests + command: yarn test + working_directory: npm/vite-plugin-cypress-esm + - sanitize-verify-and-store-mocha-results: + testResultsPath: npm/vite-plugin-cypress-esm/test_results + + npm-mount-utils: + <<: *defaults + steps: + - restore_cached_workspace + - run: + name: Build + command: yarn lerna run build --scope=@cypress/mount-utils + + npm-grep: + <<: *defaults + resource_class: small + steps: + - restore_cached_workspace + - run: + name: Run tests + command: yarn workspace @cypress/grep cy:run + - sanitize-verify-and-store-mocha-results: + testResultsPath: npm/grep/test_results + + npm-eslint-plugin-dev: + <<: *defaults + steps: + - restore_cached_workspace + - run: + name: Run tests + command: yarn workspace @cypress/eslint-plugin-dev test + + npm-cypress-schematic: + <<: *defaults + steps: + - restore_cached_workspace + - run: + name: Build + Install + command: | + yarn lerna run build --scope=@cypress/schematic + - run: + name: Run unit tests + command: | + yarn test + working_directory: npm/cypress-schematic + + npm-release: + <<: *defaults + resource_class: medium+ + steps: + - restore_cached_workspace + - run: + name: Release packages after all jobs pass + command: yarn npm-release + + create-build-artifacts: + <<: *defaults + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: xlarge + resource_class: << parameters.resource_class >> + steps: + - restore_cached_workspace + # this is a temporary work around while we wait for circle to resolve issues with packages + # with an @ character in windows during save_cache. + # @see https://github.com/cypress-io/cypress/issues/30343 for more details. + - when: + condition: + equal: [ *windows-executor, << parameters.executor >> ] + steps: + - run: + name: reinstall dependencies to work around cache issue (Windows only) + command: rm -rf node_modules && yarn + - check-if-binary-exists + - build-and-package-binary + - build-cypress-npm-package: + executor: << parameters.executor >> + - setup_should_persist_artifacts + - verify_should_persist_artifacts + - upload-build-artifacts + - post-install-comment + + create-and-trigger-packaging-artifacts: + <<: *defaults + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: small + resource_class: << parameters.resource_class >> + steps: + - maybe_skip_binary_jobs + - restore_cached_workspace + - check-if-binary-exists + - setup_should_persist_artifacts + - trigger-publish-binary-pipeline + + get-published-artifacts: + <<: *defaults + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: medium + resource_class: << parameters.resource_class >> + steps: + - maybe_skip_binary_jobs + - restore_cached_workspace + - run: + name: Check pipeline info + command: cat ~/triggered_pipeline.json + - setup_should_persist_artifacts + - run: + name: Download binary artifacts + command: | + source ./scripts/ensure-node.sh + node ./scripts/binary/get-published-artifacts.js --pipelineInfo ~/triggered_pipeline.json --platformKey $(node ./scripts/get-platform-key.js) + - persist_to_workspace: + root: ~/ + paths: + - cypress/cypress.zip + - cypress/cypress.tgz + - verify_should_persist_artifacts + - persist_to_workspace: + root: ~/ + paths: + - cypress/binary-url.json + - cypress/npm-package-url.json + - post-install-comment: + package_url_path: ~/cypress/npm-package-url.json + binary_url_path: ~/cypress/binary-url.json + + test-kitchensink: + <<: *defaults + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: medium+ + resource_class: << parameters.resource_class >> + steps: + - restore_cached_workspace + - clone-repo-and-checkout-branch: + repo: cypress-example-kitchensink + - install-required-node + - run: + name: Install prod dependencies + command: yarn --production --ignore-engines + working_directory: /tmp/cypress-example-kitchensink + - run: + name: Example server + command: yarn start + working_directory: /tmp/cypress-example-kitchensink + background: true + - run: + name: Run Kitchensink example project + command: | + yarn cypress:run --project /tmp/cypress-example-kitchensink + + test-kitchensink-against-staging: + <<: *defaults + steps: + - restore_cached_workspace + - clone-repo-and-checkout-branch: + repo: cypress-example-kitchensink + - install-required-node + - run: + name: Install prod dependencies + command: yarn --production + working_directory: /tmp/cypress-example-kitchensink + - run: + name: Example server + command: yarn start + working_directory: /tmp/cypress-example-kitchensink + background: true + - run: + name: Run Kitchensink example project + command: | + source ./scripts/ensure-node.sh + CYPRESS_PROJECT_ID=$TEST_KITCHENSINK_PROJECT_ID \ + CYPRESS_RECORD_KEY=$TEST_KITCHENSINK_RECORD_KEY \ + CYPRESS_INTERNAL_ENV=staging \ + yarn cypress:run --project /tmp/cypress-example-kitchensink --record + + test-against-staging: + <<: *defaults + steps: + - restore_cached_workspace + - clone-repo-and-checkout-branch: + repo: cypress-test-tiny + - run: + name: Run test project + command: | + CYPRESS_PROJECT_ID=$TEST_TINY_PROJECT_ID \ + CYPRESS_RECORD_KEY=$TEST_TINY_RECORD_KEY \ + CYPRESS_INTERNAL_ENV=staging \ + yarn cypress:run --project /tmp/cypress-test-tiny --record + + test-npm-module-and-verify-binary: + <<: *defaults + resource_class: small + steps: + - restore_cached_workspace + # make sure we have cypress.zip received + - run: ls -l + - run: ls -l cypress.zip cypress.tgz + - run: mkdir test-binary + - run: + name: Create new NPM package + working_directory: test-binary + command: npm init -y + - run: + # install NPM from built NPM package folder + name: Install Cypress + working_directory: test-binary + # force installing the freshly built binary + command: CYPRESS_INSTALL_BINARY=/root/cypress/cypress.zip npm i + /root/cypress/cypress.tgz + - run: + name: Cypress version + working_directory: test-binary + command: $(yarn bin cypress) version + - run: + name: Verify Cypress binary + working_directory: test-binary + command: $(yarn bin cypress) verify + - run: + name: Cypress help + working_directory: test-binary + command: $(yarn bin cypress) help + - run: + name: Cypress info + working_directory: test-binary + command: $(yarn bin cypress) info + + test-npm-module-on-minimum-node-version: + <<: *defaults + resource_class: small + docker: + - image: *base-internal-minimum-node + steps: + - maybe_skip_binary_jobs + - restore_workspace_binaries + - run: mkdir test-binary + - run: + name: Create new NPM package + working_directory: test-binary + command: npm init -y + - run: + name: Install Cypress + working_directory: test-binary + command: CYPRESS_INSTALL_BINARY=/root/cypress/cypress.zip npm install + /root/cypress/cypress.tgz + - run: + name: Verify Cypress binary + working_directory: test-binary + command: npx cypress verify + - run: + name: Print Cypress version + working_directory: test-binary + command: npx cypress version + - run: + name: Cypress info + working_directory: test-binary + command: npx cypress info + + test-types-cypress-and-jest: + parameters: + executor: + description: Executor name to use + type: executor + default: cy-doc + wd: + description: Working directory, should be OUTSIDE cypress monorepo folder + type: string + default: /root/test-cypress-and-jest + <<: *defaults + resource_class: small + steps: + - maybe_skip_binary_jobs + - restore_workspace_binaries + - run: mkdir <> + - run: + name: Create new NPM package ⚗️ + working_directory: <> + command: npm init -y + - run: + name: Install dependencies 📦 + working_directory: <> + environment: + CYPRESS_INSTALL_BINARY: /root/cypress/cypress.zip + # let's install Cypress, Jest and any other package that might conflict + # https://github.com/cypress-io/cypress/issues/6690 + + # Todo: Add `jest` back into the list once https://github.com/yargs/yargs-parser/issues/452 + # is resolved. + command: | + npm install /root/cypress/cypress.tgz \ + typescript @types/jest enzyme @types/enzyme + - run: + name: Test types clash ⚔️ + working_directory: <> + command: | + echo "console.log('hello world')" > hello.ts + npx tsc hello.ts --noEmit + + test-full-typescript-project: + parameters: + executor: + description: Executor name to use + type: executor + default: cy-doc + <<: *defaults + resource_class: small + steps: + - maybe_skip_binary_jobs + - restore_workspace_binaries + - clone-repo-and-checkout-branch: + repo: cypress-test-tiny + - run: + name: Checkout Typescript Example + working_directory: /tmp/cypress-test-tiny + command: | + git checkout full-typescript + - run: + name: Install dependencies 📦 + working_directory: /tmp/cypress-test-tiny + environment: + CYPRESS_INSTALL_BINARY: /root/cypress/cypress.zip + command: | + npm install /root/cypress/cypress.tgz typescript + - run: + name: Run project tests 🗳 + working_directory: /tmp/cypress-test-tiny + command: npm run cypress:run + + # install NPM + binary zip and run against staging API + test-binary-against-staging: + <<: *defaults + steps: + - restore_workspace_binaries + - clone-repo-and-checkout-branch: + repo: cypress-test-tiny + - run: + name: Install Cypress + working_directory: /tmp/cypress-test-tiny + # force installing the freshly built binary + command: CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i --legacy-peer-deps + ~/cypress/cypress.tgz + - run: + name: Run test project + working_directory: /tmp/cypress-test-tiny + command: | + CYPRESS_PROJECT_ID=$TEST_TINY_PROJECT_ID \ + CYPRESS_RECORD_KEY=$TEST_TINY_RECORD_KEY \ + CYPRESS_INTERNAL_ENV=staging \ + $(yarn bin cypress) run --record + + test-binary-against-recipes-firefox: + <<: *defaults + steps: + - test-binary-against-repo: + repo: cypress-example-recipes + command: npm run test:ci:firefox + browser: firefox + + test-binary-against-recipes-chrome: + <<: *defaults + steps: + - test-binary-against-repo: + repo: cypress-example-recipes + command: npm run test:ci:chrome + browser: chrome + + test-binary-against-recipes: + <<: *defaults + parallelism: 4 + steps: + - test-binary-against-repo: + repo: cypress-example-recipes + # Split the specs up across 4 different machines to run in parallel + command: npm run test:ci -- --chunk $CIRCLE_NODE_INDEX --total-chunks + $CIRCLE_NODE_TOTAL + browser: electron + + # This is a special job. It allows you to test the current + # built test runner against a pull request in the repo + # cypress-example-recipes. + # Imagine you are working on a feature and want to show / test a recipe + # You would need to run the built test runner before release + # against a PR that cannot be merged until the new version + # of the test runner is released. + # Use: + # specify pull request number + # and the recipe folder + + # test-binary-against-recipe-pull-request: + # <<: *defaults + # steps: + # # test a specific pull request by number from cypress-example-recipes + # - test-binary-against-repo: + # repo: cypress-example-recipes + # command: npm run test:ci + # pull_request_id: 515 + # folder: examples/fundamentals__typescript + + test-binary-against-kitchensink: + <<: *defaults + steps: + - maybe_skip_binary_jobs + - test-binary-against-repo: + repo: cypress-example-kitchensink + browser: electron + + test-binary-against-kitchensink-firefox: + <<: *defaults + steps: + - test-binary-against-repo: + repo: cypress-example-kitchensink + browser: firefox + + test-binary-against-kitchensink-chrome: + <<: *defaults + steps: + - test-binary-against-repo: + repo: cypress-example-kitchensink + browser: chrome + executor: << parameters.executor >> + + test-binary-against-todomvc-firefox: + <<: *defaults + steps: + - test-binary-against-repo: + repo: cypress-example-todomvc + browser: firefox + + test-binary-against-cypress-realworld-app: + <<: *defaults + resource_class: medium+ + steps: + - test-binary-against-rwa: + repo: cypress-realworld-app + browser: chrome + + test-binary-as-specific-user: + <<: *defaults + steps: + - maybe_skip_binary_jobs + - restore_workspace_binaries + - clone-repo-and-checkout-branch: + repo: cypress-test-tiny + # the user should be "node" + - run: whoami + - run: pwd + # prints the current user's effective user id + # for root it is 0 + # for other users it is a positive integer + - run: node -e 'console.log(process.geteuid())' + # make sure the binary and NPM package files are present + - run: ls -l + - run: ls -l cypress.zip cypress.tgz + - run: + # install NPM from built NPM package folder + name: Install Cypress + working_directory: /tmp/cypress-test-tiny + # force installing the freshly built binary + command: CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i + ~/cypress/cypress.tgz + - run: + name: Cypress help + working_directory: /tmp/cypress-test-tiny + command: $(yarn bin cypress) help + - run: + name: Cypress info + working_directory: /tmp/cypress-test-tiny + command: $(yarn bin cypress) info + - run: + name: Verify Cypress binary + working_directory: /tmp/cypress-test-tiny + command: DEBUG=cypress:cli $(yarn bin cypress) verify + - run: + name: Run Cypress binary + working_directory: /tmp/cypress-test-tiny + command: DEBUG=cypress:cli $(yarn bin cypress) run diff --git a/.circleci/src/workflows/workflows/@main.yml b/.circleci/src/workflows/workflows/@main.yml new file mode 100644 index 00000000000..87a17d9318f --- /dev/null +++ b/.circleci/src/workflows/workflows/@main.yml @@ -0,0 +1,1047 @@ + + +linux-x64: + when: &full-workflow-filters + or: + - equal: [ develop, << pipeline.git.branch >> ] + # use the following branch as well to ensure that v8 snapshot cache updates are fully tested + - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] + - matches: + pattern: /^release\/\d+\.\d+\.\d+$/ + value: << pipeline.git.branch >> + jobs: + - node_modules_install: + build-better-sqlite3: true + - 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:percy + required_env_var: PERCY_TOKEN + requires: + - 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 + # Cypress run must be completed to fetch Accessibility report + - verify-accessibility-results: + context: test-runner:cypress-record-key + requires: + - 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 + - driver-integration-tests-firefox + - driver-integration-tests-chrome + - driver-integration-tests-chrome-inject-document-domain + - driver-integration-tests-chrome-beta-inject-document-domain + - driver-integration-tests-electron + - driver-integration-tests-webkit + - driver-integration-memory-tests + - 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-inject-document-domain: + context: test-runner:cypress-record-key + requires: + - build + - driver-integration-tests-chrome-beta: + context: test-runner:cypress-record-key + requires: + - build + - driver-integration-tests-chrome-beta-inject-document-domain: + 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-puppeteer-unit-tests: + requires: + - build + - npm-puppeteer-cypress-tests: + requires: + - build + - npm-react: + requires: + - build + - npm-angular: + requires: + - build + - npm-mount-utils: + requires: + - build + - npm-grep: + requires: + - build + - npm-eslint-plugin-dev: + requires: + - build + - npm-cypress-schematic: + requires: + - build + - v8-integration-tests: + requires: + - system-tests-node-modules-install + + - ready-to-release: + # filters: *mainBuildFilters + requires: + - check-ts + - npm-angular + - npm-eslint-plugin-dev + - npm-puppeteer-unit-tests + - npm-puppeteer-cypress-tests + - npm-react + - npm-mount-utils + - npm-grep + - 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-chrome-inject-document-domain + - driver-integration-tests-chrome-beta-inject-document-domain + - driver-integration-tests-electron + - driver-integration-tests-webkit + - driver-integration-memory-tests + - system-tests-non-root + - system-tests-firefox + - system-tests-electron + - system-tests-chrome + - system-tests-webkit + - 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 + - yarn-pnp-preprocessor-system-test + - svelte-webpack-system-test + - test-kitchensink + - unit-tests + - verify-release-readiness + - v8-integration-tests + + - npm-release: + filters: &mainBuildFilters + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + # use the following branch as well to ensure that v8 snapshot cache updates are fully tested + - 'update-v8-snapshot-cache-on-develop' + - 'chore/refactor_cli_to_ts' + context: test-runner:npm-release + requires: + - ready-to-release + + - create-and-trigger-packaging-artifacts: + context: + - test-runner:upload + - test-runner:build-binary + - publish-binary + requires: + - node_modules_install + - 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 + filters: *mainBuildFilters + requires: + - build + - test-kitchensink: + requires: + - build + - test-kitchensink-against-staging: + executor: kitchensink-executor + context: test-runner:record-tests + filters: *mainBuildFilters + requires: + - build + - test-npm-module-on-minimum-node-version: + context: publish-binary + requires: + - get-published-artifacts + - test-types-cypress-and-jest: + context: publish-binary + requires: + - get-published-artifacts + - test-full-typescript-project: + context: publish-binary + requires: + - get-published-artifacts + - test-binary-against-kitchensink: + context: publish-binary + requires: + - get-published-artifacts + - test-npm-module-and-verify-binary: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-staging: + context: test-runner:record-tests + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-kitchensink-chrome: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-recipes-firefox: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-recipes-chrome: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-recipes: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-kitchensink-firefox: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-todomvc-firefox: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-cypress-realworld-app: + context: test-runner:cypress-record-key + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-as-specific-user: + name: "test binary as a non-root user" + executor: non-root-docker-user + context: publish-binary + requires: + - get-published-artifacts + - test-binary-as-specific-user: + name: "test binary as a root user" + context: publish-binary + requires: + - get-published-artifacts + - binary-system-tests: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install + - yarn-pnp-preprocessor-system-test: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install + - svelte-webpack-system-test: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install + +linux-x64-contributor: + when: + matches: + pattern: /^pull\/[0-9]+/ + value: << pipeline.git.branch >> + jobs: + - node_modules_install + - build: + is_contributor_pr: true + requires: + - node_modules_install + # In subsequent jobs, we use some contexts that are restricted to members of the Cypress organization. + # This job will allow for a Cypress member to approve and run the rest of the restricted jobs in the pipeline after the contributor code has been reviewed. + - contributor-pr: + type: approval + requires: + - build + # verify-accessibility-results is required for status checks, however, it will be skipped for contributors so it + # can run in any order + - verify-accessibility-results + - check-ts: + requires: + - build + - lint: + name: linux-lint + requires: + - build + - percy-finalize: + context: test-runner:percy + required_env_var: PERCY_TOKEN # skips job if not defined (external PR) + requires: + - 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 + - lint-types: + requires: + - build + # unit, integration and e2e tests + - cli-visual-tests: + context: test-runner:percy + requires: + - contributor-pr + - unit-tests: + is_contributor_pr: true + requires: + - build + - verify-release-readiness: + context: test-runner:npm-release + requires: + - contributor-pr + - 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: + - contributor-pr + - 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: + - contributor-pr + - driver-integration-tests-chrome-inject-document-domain: + context: test-runner:cypress-record-key + requires: + - contributor-pr + - driver-integration-tests-chrome-beta: + context: test-runner:cypress-record-key + requires: + - contributor-pr + - driver-integration-tests-chrome-beta-inject-document-domain: + context: test-runner:cypress-record-key + requires: + - contributor-pr + - driver-integration-tests-firefox: + context: test-runner:cypress-record-key + requires: + - contributor-pr + - driver-integration-tests-electron: + context: test-runner:cypress-record-key + requires: + - contributor-pr + - driver-integration-tests-webkit: + context: test-runner:cypress-record-key + requires: + - contributor-pr + - 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: + - contributor-pr + - run-launchpad-integration-tests-chrome: + context: + [ + test-runner:cypress-record-key, + test-runner:launchpad-tests, + test-runner:percy + ] + percy: true + requires: + - contributor-pr + - run-launchpad-component-tests-chrome: + context: + [ + test-runner:cypress-record-key, + test-runner:launchpad-tests, + test-runner:percy + ] + percy: true + requires: + - contributor-pr + - run-app-integration-tests-chrome: + context: + [ + test-runner:cypress-record-key, + test-runner:launchpad-tests, + test-runner:percy + ] + percy: true + requires: + - contributor-pr + - 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: + - contributor-pr + - run-reporter-component-tests-chrome: + context: [ test-runner:cypress-record-key, test-runner:percy ] + percy: true + requires: + - contributor-pr + - reporter-integration-tests: + context: [ test-runner:cypress-record-key, test-runner:percy ] + requires: + - contributor-pr + - 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-puppeteer-unit-tests: + requires: + - build + - npm-puppeteer-cypress-tests: + requires: + - build + - npm-react: + requires: + - build + - npm-angular: + requires: + - build + - npm-mount-utils: + requires: + - build + - npm-grep: + requires: + - build + - npm-eslint-plugin-dev: + requires: + - build + - npm-cypress-schematic: + requires: + - build + - v8-integration-tests: + requires: + - system-tests-node-modules-install + + - ready-to-release: + requires: + - check-ts + - npm-angular + - npm-eslint-plugin-dev + - npm-puppeteer-unit-tests + - npm-puppeteer-cypress-tests + - npm-react + - npm-mount-utils + - npm-grep + - 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-tests-webkit + - driver-integration-memory-tests + - system-tests-non-root + - system-tests-firefox + - system-tests-electron + - system-tests-chrome + - system-tests-webkit + - 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 + - v8-integration-tests + + - npm-release: + context: test-runner:npm-release + requires: + - ready-to-release + + - create-and-trigger-packaging-artifacts: + context: [ test-runner:upload, test-runner:build-binary, publish-binary ] + requires: + - contributor-pr + - get-published-artifacts: + context: [ publish-binary, test-runner:commit-status-checks ] + requires: + - create-and-trigger-packaging-artifacts + # various testing scenarios, like building full binary + # and testing it on a real project + - test-against-staging: + context: test-runner:record-tests + filters: *mainBuildFilters + requires: + - build + - test-kitchensink: + requires: + - build + - test-kitchensink-against-staging: + executor: kitchensink-executor + context: test-runner:record-tests + filters: *mainBuildFilters + requires: + - build + - test-npm-module-on-minimum-node-version: + context: publish-binary + requires: + - get-published-artifacts + - test-types-cypress-and-jest: + context: publish-binary + requires: + - get-published-artifacts + - test-full-typescript-project: + context: publish-binary + requires: + - get-published-artifacts + - test-binary-against-kitchensink: + context: publish-binary + requires: + - get-published-artifacts + - test-npm-module-and-verify-binary: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-staging: + context: test-runner:record-tests + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-kitchensink-chrome: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-recipes-firefox: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-recipes-chrome: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-recipes: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-kitchensink-firefox: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-todomvc-firefox: + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-against-cypress-realworld-app: + context: test-runner:cypress-record-key + filters: *mainBuildFilters + requires: + - get-published-artifacts + - test-binary-as-specific-user: + name: "test binary as a non-root user" + executor: non-root-docker-user + context: publish-binary + requires: + - get-published-artifacts + - test-binary-as-specific-user: + name: "test binary as a root user" + context: publish-binary + requires: + - get-published-artifacts + - binary-system-tests: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install + +linux-arm64: + when: *full-workflow-filters + jobs: + - node_modules_install: + name: linux-arm64-node-modules-install + executor: linux-arm64 + resource_class: arm.medium + only-cache-for-root-user: true + + - build: + name: linux-arm64-build + context: test-runner:env-canary + executor: linux-arm64 + resource_class: arm.medium + requires: + - linux-arm64-node-modules-install + + - create-and-trigger-packaging-artifacts: + name: linux-arm64-create-and-trigger-packaging-artifacts + context: + [ + test-runner:upload, + test-runner:commit-status-checks, + test-runner:build-binary, + publish-binary + ] + executor: linux-arm64 + resource_class: arm.medium + requires: + - linux-arm64-node-modules-install + + - wait-for-binary-publish: + name: linux-arm64-wait-for-binary-publish + type: approval + requires: + - linux-arm64-create-and-trigger-packaging-artifacts + + - get-published-artifacts: + name: linux-arm64-get-published-artifacts + context: [ publish-binary, test-runner:commit-status-checks ] + executor: linux-arm64 + resource_class: arm.medium + requires: + - linux-arm64-wait-for-binary-publish + + - v8-integration-tests: + executor: linux-arm64 + resource_class: arm.medium + requires: + - linux-arm64-build + - driver-integration-memory-tests: + executor: linux-arm64 + resource_class: arm.medium + requires: + - linux-arm64-build + - server-unit-tests-cloud-environment: + executor: linux-arm64 + resource_class: arm.medium + requires: + - linux-arm64-build + +darwin-x64: + when: *full-workflow-filters + jobs: + - node_modules_install: + name: darwin-x64-node-modules-install + executor: darwin-amd64 + resource_class: cypress-io/intel-macstadium + only-cache-for-root-user: true + + - build: + name: darwin-x64-build + context: test-runner:env-canary + executor: darwin-amd64 + resource_class: cypress-io/intel-macstadium + requires: + - darwin-x64-node-modules-install + + - create-build-artifacts: + name: darwin-x64-create-build-artifacts + context: + - test-runner:sign-mac-binary + - test-runner:upload + - test-runner:commit-status-checks + - test-runner:build-binary + executor: darwin-amd64 + resource_class: cypress-io/intel-macstadium + requires: + - darwin-x64-build + + - v8-integration-tests: + name: darwin-x64-v8-integration-tests + executor: darwin-amd64 + resource_class: cypress-io/intel-macstadium + requires: + - darwin-x64-build + + - driver-integration-memory-tests: + name: darwin-x64-driver-integration-memory-tests + executor: darwin-amd64 + resource_class: cypress-io/intel-macstadium + requires: + - darwin-x64-build + + - server-unit-tests-cloud-environment: + name: darwin-x64-driver-server-unit-tests-cloud-environment + executor: darwin-amd64 + resource_class: cypress-io/intel-macstadium + requires: + - darwin-x64-build + +darwin-arm64: + when: *full-workflow-filters + jobs: + - node_modules_install: + name: darwin-arm64-node-modules-install + executor: darwin-arm64 + resource_class: cypress-io/m1-macstadium + only-cache-for-root-user: true + + - build: + name: darwin-arm64-build + context: test-runner:env-canary + executor: darwin-arm64 + resource_class: cypress-io/m1-macstadium + requires: + - darwin-arm64-node-modules-install + + - create-build-artifacts: + name: darwin-arm64-create-build-artifacts + context: + - test-runner:sign-mac-binary + - test-runner:upload + - test-runner:commit-status-checks + - test-runner:build-binary + executor: darwin-arm64 + resource_class: cypress-io/m1-macstadium + requires: + - darwin-arm64-build + + - v8-integration-tests: + name: darwin-arm64-v8-integration-tests + executor: darwin-arm64 + resource_class: cypress-io/m1-macstadium + requires: + - darwin-arm64-build + - driver-integration-memory-tests: + name: darwin-arm64-driver-integration-memory-tests + executor: darwin-arm64 + resource_class: cypress-io/m1-macstadium + requires: + - darwin-arm64-build + - server-unit-tests-cloud-environment: + name: darwin-arm64-server-unit-tests-cloud-environment + executor: darwin-arm64 + resource_class: cypress-io/m1-macstadium + requires: + - darwin-arm64-build + +windows: + when: *full-workflow-filters + jobs: + - node_modules_install: + name: windows-node-modules-install + executor: windows + resource_class: windows.medium + only-cache-for-root-user: true + + - build: + name: windows-build + context: test-runner:env-canary + executor: windows + resource_class: windows.large + requires: + - windows-node-modules-install + + - run-app-integration-tests-chrome: + name: windows-run-app-integration-tests-chrome + executor: windows + resource_class: windows.large + context: [ test-runner:cypress-record-key, test-runner:launchpad-tests ] + requires: + - windows-build + + - run-launchpad-integration-tests-chrome: + name: windows-run-launchpad-integration-tests-chrome + executor: windows + resource_class: windows.large + context: [ test-runner:cypress-record-key, test-runner:launchpad-tests ] + requires: + - windows-build + + - unit-tests: + name: windows-unit-tests + executor: windows + resource_class: windows.medium + requires: + - windows-build + + - server-unit-tests-cloud-environment: + name: windows-server-unit-tests-cloud-environment + executor: windows + resource_class: windows.medium + requires: + - windows-build + + - create-build-artifacts: + name: windows-create-build-artifacts + executor: windows + resource_class: windows.large + context: + - test-runner:sign-windows-binary + - test-runner:upload + - test-runner:commit-status-checks + - test-runner:build-binary + requires: + - windows-build + + - test-binary-against-kitchensink-chrome: + name: windows-test-binary-against-kitchensink-chrome + executor: windows + requires: + - windows-create-build-artifacts + + - v8-integration-tests: + name: windows-v8-integration-tests + executor: windows + resource_class: windows.medium + requires: + - windows-build + - driver-integration-memory-tests: + name: windows-driver-integration-memory-tests + executor: windows + resource_class: windows.medium + requires: + - windows-build diff --git a/.circleci/src/workflows/workflows/pull-request.yml b/.circleci/src/workflows/workflows/pull-request.yml new file mode 100644 index 00000000000..2d69cb42f10 --- /dev/null +++ b/.circleci/src/workflows/workflows/pull-request.yml @@ -0,0 +1,319 @@ + +when: + and: + - not: + matches: + pattern: /^release\// + value: << pipeline.git.branch >> + - not: + matches: + pattern: /^develop/ + value: << pipeline.git.branch >> + - not: + matches: + pattern: /^pull\/[0-9]+/ + value: << pipeline.git.branch >> + +jobs: + - node_modules_install: + build-better-sqlite3: true + - 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:percy + required_env_var: PERCY_TOKEN + requires: + - 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 + # Cypress run must be completed to fetch Accessibility report + - verify-accessibility-results: + context: test-runner:cypress-record-key + requires: + - 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 + - driver-integration-tests-firefox + - driver-integration-tests-chrome + - driver-integration-tests-chrome-inject-document-domain + - driver-integration-tests-chrome-beta-inject-document-domain + - driver-integration-tests-electron + - driver-integration-tests-webkit + - driver-integration-memory-tests + - 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-inject-document-domain: + context: test-runner:cypress-record-key + requires: + - build + - driver-integration-tests-chrome-beta: + context: test-runner:cypress-record-key + requires: + - build + - driver-integration-tests-chrome-beta-inject-document-domain: + 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-puppeteer-unit-tests: + requires: + - build + - npm-puppeteer-cypress-tests: + requires: + - build + - npm-react: + requires: + - build + - npm-angular: + requires: + - build + - npm-mount-utils: + requires: + - build + - npm-grep: + requires: + - build + - npm-eslint-plugin-dev: + requires: + - build + - npm-cypress-schematic: + requires: + - build + - v8-integration-tests: + requires: + - system-tests-node-modules-install + + - create-and-trigger-packaging-artifacts: + context: + - test-runner:upload + - test-runner:build-binary + - publish-binary + requires: + - node_modules_install + - 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 + - test-kitchensink: + requires: + - build + - test-npm-module-on-minimum-node-version: + context: publish-binary + requires: + - get-published-artifacts + - test-types-cypress-and-jest: + context: publish-binary + requires: + - get-published-artifacts + - test-full-typescript-project: + context: publish-binary + requires: + - get-published-artifacts + - test-binary-against-kitchensink: + context: publish-binary + requires: + - get-published-artifacts + - test-binary-as-specific-user: + name: "test binary as a non-root user" + executor: non-root-docker-user + context: publish-binary + requires: + - get-published-artifacts + - test-binary-as-specific-user: + name: "test binary as a root user" + context: publish-binary + requires: + - get-published-artifacts + - binary-system-tests: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install + - yarn-pnp-preprocessor-system-test: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install + - svelte-webpack-system-test: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index 6a4ed33b7d1..7d0249ee259 100644 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -1,419 +1,259 @@ -version: 2.1 - -chrome-stable-version: &chrome-stable-version "140.0.7339.127" -chrome-beta-version: &chrome-beta-version "141.0.7390.16" -firefox-stable-version: &firefox-stable-version "142.0" - -orbs: - browser-tools: circleci/browser-tools@2.1.1 - -defaults: &defaults - parallelism: 1 - working_directory: ~/cypress - parameters: &defaultsParameters - executor: - type: executor - default: cy-doc - only-cache-for-root-user: - type: boolean - default: false - executor: <> - environment: - ## set specific timezone - &defaultsEnvironment - TZ: "/usr/share/zoneinfo/America/New_York" - - ## store artifacts here - CIRCLE_ARTIFACTS: /tmp/artifacts - - ## set so that e2e tests are consistent - COLUMNS: 100 - LINES: 24 - -mainBuildFilters: &mainBuildFilters - filters: - branches: - only: - - develop - - /^release\/\d+\.\d+\.\d+$/ - # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - - 'update-v8-snapshot-cache-on-develop' - - 'renovate/electron-36.x' - -# usually we don't build Mac app - it takes a long time -# but sometimes we want to really confirm we are doing the right thing -# so just add your branch to the list here to build and test on Mac -macWorkflowFilters: &darwin-workflow-filters - when: - or: - - equal: [ develop, << pipeline.git.branch >> ] - # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] - - equal: [ 'renovate/electron-36.x', << pipeline.git.branch >> ] - - matches: - pattern: /^release\/\d+\.\d+\.\d+$/ - value: << pipeline.git.branch >> - -linuxArm64WorkflowFilters: &linux-arm64-workflow-filters - when: - or: - - equal: [ develop, << pipeline.git.branch >> ] - # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] - - equal: [ 'renovate/electron-36.x', << pipeline.git.branch >> ] - - matches: - pattern: /^release\/\d+\.\d+\.\d+$/ - value: << pipeline.git.branch >> - -# uncomment & add to the branch conditions below to disable the main linux -# flow if we don't want to test it for a certain branch -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 -# add your branch to this list to run the full Windows build on your PR -windowsWorkflowFilters: &windows-workflow-filters - when: - or: - - equal: [ develop, << pipeline.git.branch >> ] - # use the following branch as well to ensure that v8 snapshot cache updates are fully tested - - equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ] - - equal: [ 'renovate/electron-36.x', << pipeline.git.branch >> ] - - matches: - pattern: /^release\/\d+\.\d+\.\d+$/ - value: << pipeline.git.branch >> - -executors: - # the Docker image with Cypress dependencies and Chrome browser - cy-doc: - docker: - - image: cypress/base-internal:22.18.0-bullseye - # by default, we use "medium" to balance performance + CI costs. bump or reduce on a per-job basis if needed. - resource_class: medium - environment: - PLATFORM: linux - - kitchensink-executor: - docker: - - image: cypress/base-internal:22.18.0-bullseye - # by default, we use "medium" to balance performance + CI costs. bump or reduce on a per-job basis if needed. - resource_class: medium - environment: - PLATFORM: linux - - # Docker image with non-root "node" user - non-root-docker-user: - docker: - - image: cypress/base-internal:22.18.0-bullseye - user: node - environment: - PLATFORM: linux - - # executor to run on Mac OS - # https://circleci.com/docs/2.0/executor-types/#using-macos - # https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions - darwin-amd64: - machine: true - environment: - PLATFORM: darwin - - # executor to run on Windows - based off of the windows-orb default executor since it is - # not customizable enough to align with our existing setup. - # https://github.com/CircleCI-Public/windows-orb/blob/master/src/executors/default.yml - # https://circleci.com/docs/2.0/hello-world-windows/#software-pre-installed-in-the-windows-image - windows: &windows-executor - machine: - image: windows-server-2022-gui:stable - shell: bash.exe -eo pipefail - resource_class: windows.large - environment: - PLATFORM: windows - - darwin-arm64: &darwin-arm64-executor - machine: true - environment: - PLATFORM: darwin - - linux-arm64: &linux-arm64-executor - machine: - image: ubuntu-2004:2024.11.1 - resource_class: arm.medium - environment: - PLATFORM: linux - # TODO: Disabling snapshots for now on Linux Arm 64 architectures. Will revisit with https://github.com/cypress-io/cypress/issues/23557 - DISABLE_SNAPSHOT_REQUIRE: 1 - linux-x64: &linux-x64-executor - machine: - image: ubuntu-2004:2024.11.1 - resource_class: medium - environment: - PLATFORM: linux - +base-internal-bullseye: cypress/base-internal:22.18.0-bullseye +base-internal-minimum-node: cypress/base-internal:22.15.1 +base-internal-yarn-berry: cypress/base-internal:22.18.0-yarn-berry +chrome-beta-version: 141.0.7390.16 +chrome-stable-version: 140.0.7339.127 commands: - # This command inserts SHOULD_PERSIST_ARTIFACTS into BASH_ENV. This way, we can define the variable in one place and use it in multiple steps. - # Run this command in a job before you want to use the SHOULD_PERSIST_ARTIFACTS variable. - setup_should_persist_artifacts: + build-and-package-binary: steps: - run: - name: Set environment variable to determine whether or not to persist artifacts command: | - echo "Setting SHOULD_PERSIST_ARTIFACTS variable" - echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "renovate/electron-36.x" ]]; then - export SHOULD_PERSIST_ARTIFACTS=true - fi' >> "$BASH_ENV" - # You must run `setup_should_persist_artifacts` command and be using bash before running this command - verify_should_persist_artifacts: - steps: + set -e + NEEDS_CODE_SIGNING_WINDOWS=`node -p 'process.platform === "win32"'` + NEEDS_CODE_SIGNING_MAC=`node -p 'process.platform === "darwin"'` + + if [[ "$NEEDS_CODE_SIGNING_MAC" == "true" ]]; then + echo "Checking for required environment variables..." + if [ -z "$CSC_LINK" ]; then + echo "Need to provide environment variable CSC_LINK" + echo "with base64 encoded certificate .p12 file" + exit 1 + fi + if [ -z "$CSC_KEY_PASSWORD" ]; then + echo "Need to provide environment variable CSC_KEY_PASSWORD" + echo "with password for unlocking certificate .p12 file" + exit 1 + fi + echo "Succeeded." + elif [[ "$NEEDS_CODE_SIGNING_WINDOWS" == "true" ]]; then + echo "Checking for required environment variables..." + if [ -z "$WINDOWS_SIGN_USER_NAME" ]; then + echo "Need to provide environment variable WINDOWS_SIGN_USER_NAME" + echo "with password for fetching and signing certificate" + exit 1 + fi + if [ -z "$WINDOWS_SIGN_USER_PASSWORD" ]; then + echo "Need to provide environment variable WINDOWS_SIGN_USER_PASSWORD" + echo "for fetching and signing certificate" + exit 1 + fi + if [ -z "$WINDOWS_SIGN_CREDENTIAL_ID" ]; then + echo "Need to provide environment variable WINDOWS_SIGN_CREDENTIAL_ID" + echo "for identifying certificate" + exit 1 + fi + if [ -z "$WINDOWS_SIGN_USER_TOTP" ]; then + echo "Need to provide environment variable WINDOWS_SIGN_USER_TOTP" + echo "for signing certificate" + exit 1 + fi + echo "Succeeded." + else + echo "Not code signing for this platform" + fi + name: Check environment variables before code sign (if on Mac/Windows) - run: - name: Check current branch to persist artifacts command: | - if [[ -z "$SHOULD_PERSIST_ARTIFACTS" ]]; then - echo "Not uploading artifacts or posting install comment for this branch." - circleci-agent step halt + source ./scripts/ensure-node.sh + node --version + if [[ `node ./scripts/get-platform-key.js` == 'linux-arm64' ]]; then + # these are missing on Circle and there is no way to pre-install them on Arm + sudo apt-get update + sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb + DISABLE_SNAPSHOT_REQUIRE=1 yarn binary-build --version $(node ./scripts/get-next-version.js) + else + yarn binary-build --version $(node ./scripts/get-next-version.js) fi - - maybe_skip_binary_jobs: - steps: + name: Build the Cypress binary + no_output_timeout: 45m - run: - name: Skip binary job if external PR command: | - if [[ -z "$CIRCLE_TOKEN" ]]; then - echo "There is no CIRCLE_TOKEN set for this job. Cannot trigger binary build. Skipping job." - circleci-agent step halt + source ./scripts/ensure-node.sh + node --version + if [[ `node ./scripts/get-platform-key.js` == 'linux-arm64' ]]; then + # these are missing on Circle and there is no way to pre-install them on Arm + sudo apt-get update + sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb + DISABLE_SNAPSHOT_REQUIRE=1 yarn binary-package --version $(node ./scripts/get-next-version.js) + else + yarn binary-package --version $(node ./scripts/get-next-version.js) fi - - restore_workspace_binaries: - steps: - - attach_workspace: - at: ~/ - # make sure we have cypress.zip received - - run: ls -l - - run: ls -l cypress.zip cypress.tgz - - run: node --version - - run: npm --version - - restore_cached_workspace: - steps: - - attach_workspace: - at: ~/ - - install-required-node - - unpack-dependencies - - restore_cached_binary: - steps: - - attach_workspace: - at: ~/ - - prepare-modules-cache: - parameters: - dont-move: - type: boolean - default: false - steps: - - run: node scripts/circle-cache.js --action prepare - - unless: - condition: << parameters.dont-move >> - steps: - - run: - name: Move to /tmp dir for consistent caching across root/non-root users - command: | - mkdir -p /tmp/node_modules_cache - mv ~/cypress/node_modules /tmp/node_modules_cache/root_node_modules - mv ~/cypress/cli/node_modules /tmp/node_modules_cache/cli_node_modules - mv ~/cypress/system-tests/node_modules /tmp/node_modules_cache/system-tests_node_modules - mv ~/cypress/globbed_node_modules /tmp/node_modules_cache/globbed_node_modules - - install-webkit-deps: - steps: + environment: + DEBUG: electron-builder,electron-osx-sign*,electron-notarize* + name: Package the Cypress binary + no_output_timeout: 45m - run: - name: Install WebKit dependencies command: | - npx playwright install webkit - npx playwright install-deps webkit - + source ./scripts/ensure-node.sh + node --version + yarn binary-smoke-test --version $(node ./scripts/get-next-version.js) + name: Smoke Test the Cypress binary + - run: + command: | + if [[ $PLATFORM == 'linux' ]]; then + # on Arm, CI runs as non-root, on x64 CI runs as root but there is no sudo binary + if [[ `whoami` == 'root' ]]; then + apt-get update && apt-get install -y zip + else + sudo apt-get update && sudo apt-get install -y zip + fi + fi + source ./scripts/ensure-node.sh + yarn binary-zip + name: Zip the binary + - persist_to_workspace: + paths: + - cypress/cypress.zip + root: ~/ build-and-persist: description: Save entire folder as artifact for other jobs to run without reinstalling steps: - run: - name: Sync Cloud Validations command: | source ./scripts/ensure-node.sh yarn gulp syncCloudValidations + name: Sync Cloud Validations - run: - name: Build packages command: | source ./scripts/ensure-node.sh yarn build + name: Build packages - run: - name: Generate v8 snapshot command: | source ./scripts/ensure-node.sh # Minification takes some time. We only really need to do that for the binary (and we regenerate snapshots separately there) V8_UPDATE_METAFILE=1 V8_SNAPSHOT_DISABLE_MINIFY=1 yarn build-v8-snapshot-prod - - prepare-modules-cache # So we don't throw these in the workspace cache + name: Generate v8 snapshot + - prepare-modules-cache - persist_to_workspace: - root: ~/ paths: - cypress - - install_cache_helpers_dependencies: - steps: - - run: - # Dependencies needed by circle-cache.js, before we "yarn" or unpack cached node_modules - name: Cache Helper Dependencies - working_directory: ~/ - command: npm i glob@7.1.6 fs-extra@10.0.0 minimist@1.2.5 - fast-json-stable-stringify@2.1.0 - - unpack-dependencies: - description: 'Unpacks dependencies associated with the current workflow' + root: ~/ + build-better-sqlite3: + description: Build better-sqlite3 for glibc 2.31 steps: - - install_cache_helpers_dependencies - - run: - name: Generate Circle Cache Key - command: node scripts/circle-cache.js --action cacheKey > circle_cache_key + - setup_remote_docker - run: - name: Generate platform key - command: node ./scripts/get-platform-key.js > platform_key - - restore_cache: - name: Restore cache state, to check for known modules cache existence - key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" - }}-node-modules-cache-{{ checksum "circle_cache_key" }} - - run: - name: Move node_modules back from /tmp command: | - if [[ -d "/tmp/node_modules_cache" ]]; then - mv /tmp/node_modules_cache/root_node_modules ~/cypress/node_modules - mv /tmp/node_modules_cache/cli_node_modules ~/cypress/cli/node_modules - mv /tmp/node_modules_cache/system-tests_node_modules ~/cypress/system-tests/node_modules - mv /tmp/node_modules_cache/globbed_node_modules ~/cypress/globbed_node_modules - rm -rf /tmp/node_modules_cache + if [[ ! -f better_sqlite3.node ]]; then + set -x + apt update && apt install -y docker.io + docker run -d --name better-sqlite3-builder cypress/base-internal:22.18.0-glibc-2.31 /bin/bash -c "sleep 1000000000" + docker cp ~/cypress/node_modules/better-sqlite3 better-sqlite3-builder:/better-sqlite3 + docker exec -it better-sqlite3-builder /bin/bash -c "cd /better-sqlite3 && source /root/.bashrc && chown -R root:root . && npm install --ignore-scripts && npx --no-install prebuild -r electron -t 36.8.1 --include-regex 'better_sqlite3.node$'" + docker cp better-sqlite3-builder:/better-sqlite3/build/Release/better_sqlite3.node ~/cypress/node_modules/better-sqlite3/build/Release/better_sqlite3.node + docker rm -f better-sqlite3-builder + cp ~/cypress/node_modules/better-sqlite3/build/Release/better_sqlite3.node ~/cypress/better_sqlite3.node + else + cp ~/cypress/better_sqlite3.node ~/cypress/node_modules/better-sqlite3/build/Release/better_sqlite3.node fi + name: Build better-sqlite3 for glibc 2.31 + - save_cache: + key: better-sqlite3-{{ checksum "node_modules/better-sqlite3/package.json" }}-{{ + checksum "node_modules/electron/package.json" }} + paths: + - better_sqlite3.node - run: - name: Restore all node_modules to proper workspace folders - command: node scripts/circle-cache.js --action unpack - - restore_cached_system_tests_deps: - description: 'Restore the cached node_modules for projects in - "system-tests/projects/**"' + command: | + rm ~/cypress/better_sqlite3.node + name: Clean up top level better-sqlite3 file + build-cypress-npm-package: + parameters: + executor: + default: cy-doc + type: executor steps: - run: - name: Generate Circle Cache key for system tests - command: ./system-tests/scripts/cache-key.sh > system_tests_cache_key + command: | + source ./scripts/ensure-node.sh + yarn get-next-version --npm + name: Bump NPM version - run: - name: Generate platform key - command: node ./scripts/get-platform-key.js > platform_key - - restore_cache: - name: Restore system tests node_modules cache - keys: - - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum - "platform_key" }}-system-tests-projects-node-modules-cache-{{ - checksum "system_tests_cache_key" }} - - update_cached_system_tests_deps: - description: 'Update the cached node_modules for projects in "system-tests/projects/**"' - steps: + command: | + source ./scripts/ensure-node.sh + yarn lerna run build-cli + name: Build NPM package - run: - name: Generate Circle Cache key for system tests - command: ./system-tests/scripts/cache-key.sh > system_tests_cache_key + command: ls -la types + working_directory: cli/build - run: - name: Generate platform key - command: node ./scripts/get-platform-key.js > platform_key - - restore_cache: - name: Restore cache state, to check for known modules cache existence - keys: - - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum - "platform_key" - }}-state-of-system-tests-projects-node-modules-cache-{{ checksum - "system_tests_cache_key" }} + command: ls -la vue mount-utils react + working_directory: cli/build + - unless: + condition: + equal: + - environment: + PLATFORM: windows + machine: + image: windows-server-2022-gui:stable + shell: bash.exe -eo pipefail + resource_class: windows.large + - << parameters.executor >> + steps: + - run: + command: | + source ./scripts/ensure-node.sh + yarn workspace cypress size + name: list NPM package contents - run: - name: Bail if specific cache exists - command: | - if [[ -f "/tmp/system_tests_node_modules_installed" ]]; then - echo "No updates to system tests node modules, exiting" - circleci-agent step halt - fi - - restore_cache: - name: Restore system tests node_modules cache - keys: - - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum - "platform_key" }}-system-tests-projects-node-modules-cache-{{ - checksum "system_tests_cache_key" }} - - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum - "platform_key" }}-system-tests-projects-node-modules-cache- + command: yarn pack --filename ../../cypress.tgz + name: pack NPM package + working_directory: cli/build - run: - name: Update system-tests node_modules cache - command: yarn workspace @tooling/system-tests projects:yarn:install - - save_cache: - name: Save system tests node_modules cache - key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" - }}-system-tests-projects-node-modules-cache-{{ checksum - "system_tests_cache_key" }} - paths: - - /tmp/cy-system-tests-node-modules - - run: touch /tmp/system_tests_node_modules_installed - - save_cache: - name: Save system tests node_modules cache state key - key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" - }}-state-of-system-tests-projects-node-modules-cache-{{ checksum - "system_tests_cache_key" }} + command: ls -l + name: list created NPM package + - persist_to_workspace: paths: - - /tmp/system_tests_node_modules_installed - + - cypress/cypress.tgz + root: ~/ caching-dependency-installer: - description: 'Installs & caches the dependencies based on yarn lock & package - json dependencies' + description: Installs & caches the dependencies based on yarn lock & package + json dependencies parameters: - only-cache-for-root-user: - type: boolean - default: false build-better-sqlite3: + default: false type: boolean + only-cache-for-root-user: default: false + type: boolean steps: - install_cache_helpers_dependencies - run: - name: Generate Circle Cache Key command: node scripts/circle-cache.js --action cacheKey > circle_cache_key + name: Generate Circle Cache Key - run: - name: Generate platform key command: node ./scripts/get-platform-key.js > platform_key + name: Generate platform key - when: condition: <> steps: - restore_cache: - name: Restore cache state, to check for known modules cache existence key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" }}-state-of-node-modules-cache-{{ checksum "circle_cache_key" }}-better-sqlite3 + name: Restore cache state, to check for known modules cache existence - unless: condition: <> steps: - restore_cache: - name: Restore cache state, to check for known modules cache existence key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" }}-state-of-node-modules-cache-{{ checksum "circle_cache_key" }} + name: Restore cache state, to check for known modules cache existence - run: - name: Bail if cache exists command: | if [[ -f "node_modules_installed" ]]; then echo "Node modules already cached for dependencies, exiting" circleci-agent step halt fi + name: Bail if cache exists - run: date +%Y-%U > cache_date - restore_cache: - name: Restore weekly yarn cache keys: - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" }}-deps-root-weekly-{{ checksum "cache_date" }} + name: Restore weekly yarn cache - run: - name: Install Node Modules command: | if [[ `node ./scripts/get-platform-key.js` == 'linux-arm64' ]]; then # Building better-sqlite3 on arm64 requires gcc-10 @@ -438,20 +278,21 @@ commands: # https://docs.percy.io/docs/caching-asset-discovery-browser-in-ci PERCY_POSTINSTALL_BROWSER=true \ yarn --prefer-offline --frozen-lockfile --cache-folder ~/.yarn + name: Install Node Modules no_output_timeout: 20m - when: condition: <> steps: - build-better-sqlite3 - prepare-modules-cache: - dont-move: <> # we don't move, so we don't hit any issues unpacking symlinks + dont-move: <> - when: - condition: <> # we don't move to /tmp since we don't need to worry about different users + condition: <> steps: - save_cache: - name: Saving node modules for root, cli, and all globbed workspace packages key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" }}-node-modules-cache-{{ checksum "circle_cache_key" }} + name: Saving node modules for root, cli, and all globbed workspace packages paths: - node_modules - cli/node_modules @@ -461,9 +302,9 @@ commands: condition: <> steps: - save_cache: - name: Saving node modules for root, cli, and all globbed workspace packages key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" }}-node-modules-cache-{{ checksum "circle_cache_key" }} + name: Saving node modules for root, cli, and all globbed workspace packages paths: - /tmp/node_modules_cache - run: touch node_modules_installed @@ -471,250 +312,337 @@ commands: condition: <> steps: - save_cache: - name: Saving node-modules cache state key key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" }}-state-of-node-modules-cache-{{ checksum "circle_cache_key" }}-better-sqlite3 + name: Saving node-modules cache state key paths: - node_modules_installed - unless: condition: <> steps: - save_cache: - name: Saving node-modules cache state key key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" }}-state-of-node-modules-cache-{{ checksum "circle_cache_key" }} + name: Saving node-modules cache state key paths: - node_modules_installed - save_cache: - name: Save weekly yarn cache key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" }}-deps-root-weekly-{{ checksum "cache_date" }} + name: Save weekly yarn cache paths: - ~/.yarn - ~/.cy-npm-cache - - verify-build-setup: - description: Common commands run when setting up for build or yarn install - parameters: - executor: - type: executor - default: cy-doc + check-if-binary-exists: steps: - - run: pwd - ##- run: - ## name: print global yarn cache path and size - ## command: du -sh $(yarn global bin) - - run: - name: print yarn version - command: yarn versions - - unless: - condition: - # stop-only does not correctly match on windows: https://github.com/bahmutov/stop-only/issues/78 - equal: [ *windows-executor, << parameters.executor >> ] - steps: - - run: - name: Stop .only # this will catch ".only"s in js/coffee as well - command: | - source ./scripts/ensure-node.sh - yarn stop-only-all + - run-on-dependencies: + command: build + package: internal-scripts - run: - name: Check terminal variables - ## make sure the TERM is set to 'xterm' in node (Linux only) - ## else colors (and tests) will fail - ## See the following information - ## * http://andykdocs.de/development/Docker/Fixing+the+Docker+TERM+variable+issue - ## * https://unix.stackexchange.com/questions/43945/whats-the-difference-between-various-term-variables command: | source ./scripts/ensure-node.sh - yarn check-terminal - - install-required-node: - # https://discuss.circleci.com/t/switch-nodejs-version-on-machine-executor-solved/26675/2 - description: Install Node version matching .node-version + yarn gulp e2eTestScaffold + yarn check-binary-on-cdn --version $(node ./scripts/get-next-version.js) --type binary --file cypress.zip + name: Check if binary exists, exit if it does + clone-repo-and-checkout-branch: + description: | + Clones an external repo and then checks out the branch that matches the next version otherwise uses 'master' branch. + parameters: + pull_request_id: + default: 0 + description: Pull request number to check out before installing and testing + type: integer + repo: + description: 'Name of the github repo to clone like: cypress-example-kitchensink' + type: string steps: + - restore_cached_binary - run: - name: Install Node - command: | - source ./scripts/ensure-node.sh - echo "Installing Yarn" - npm install yarn --location=global # ensure yarn is installed with the correct node engine - yarn check-node-version - - run: - name: Check Node command: | - source ./scripts/ensure-node.sh - yarn check-node-version + git clone --depth 1 --no-single-branch https://github.com/cypress-io/<>.git . + cd ~/cypress/.. + # install some deps for get-next-version + npm i semver@7.3.2 conventional-recommended-bump@6.1.0 conventional-changelog-angular@5.0.12 minimist@1.2.5 + NEXT_VERSION=$(node ./cypress/scripts/get-next-version.js) + cd - + + git checkout $NEXT_VERSION || true + name: 'Cloning test project and checking out release branch: + <>' + working_directory: /tmp/<> + - when: + condition: <> + steps: + - run: + command: | + git fetch origin pull/<>/head:pr-<> + git checkout pr-<> + name: Check out PR <> + working_directory: /tmp/<> install-browsers: description: Install Google Chrome or Firefox parameters: executor: + default: cy-doc description: The executor in use. Only used if Windows for workaround purposes type: executor - default: cy-doc - install-chrome: - description: whether or not to install google chrome - type: boolean - default: false + firefox-version: + default: "142.0" + description: Firefox version to install + type: string google-chrome-channel: + default: stable description: Google Chrome channel to install type: string - # can be stable, beta, dev, or canary - default: stable + google-chrome-for-testing-version: + default: 140.0.7339.127 + description: Google Chrome for Testing version to install + type: string google-chrome-version: + default: 140.0.7339.127 description: Google Chrome version to install type: string - # latest can also be used here - default: *chrome-stable-version + install-chrome: + default: false + description: whether or not to install google chrome + type: boolean install-chrome-for-testing: + default: false description: whether or not to install google chrome for testing type: boolean - default: false - google-chrome-for-testing-version: - description: Google Chrome for Testing version to install - type: string - # latest can also be used here - default: *chrome-stable-version install-firefox: + default: false description: whether or not to install firefox type: boolean - default: false - firefox-version: - description: Firefox version to install - type: string - # latest can also be used here - default: *firefox-stable-version steps: - when: condition: not: - equal: [ *windows-executor, << parameters.executor >> ] - # see https://circleci.com/developer/orbs/orb/circleci/browser-tools + equal: + - environment: + PLATFORM: windows + machine: + image: windows-server-2022-gui:stable + shell: bash.exe -eo pipefail + resource_class: windows.large + - << parameters.executor >> steps: - when: condition: - equal: [ true, << parameters.install-firefox >> ] + equal: + - true + - << parameters.install-firefox >> steps: - browser-tools/install_firefox: - # https://download-installer.cdn.mozilla.net/pub/firefox/releases/ version: << parameters.firefox-version >> - when: condition: - equal: [ true, << parameters.install-chrome >> ] + equal: + - true + - << parameters.install-chrome >> steps: - browser-tools/install_chrome: - # https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable channel: << parameters.google-chrome-channel >> chrome_version: << parameters.google-chrome-version >> - when: condition: - equal: [ 'beta', << parameters.google-chrome-channel>> ] + equal: + - beta + - << parameters.google-chrome-channel>> steps: - run: - # When the beta is downloaded with this orb, - # google-chrome-beta is linked in addition to google-chrome, - # which we do not expect and errors out when running Cypress - name: remove linked google-chrome binary command: | rm /usr/bin/google-chrome + name: remove linked google-chrome binary - when: condition: - equal: [ true, << parameters.install-chrome-for-testing >> ] + equal: + - true + - << parameters.install-chrome-for-testing >> steps: - run: - name: Install unzip command: | apt-get update && apt-get install -y unzip + name: Install unzip - browser-tools/install_chrome_for_testing: - version: << parameters.google-chrome-for-testing-version >> install_chromedriver: false - - # This code builds better-sqlite3 on Debian 11 (Bullseye). This is necessary because Debian 10 has the oldest glibc version (2.31) that we support. - # - # Since this is running Docker remote (because the job running the command may not be using an executor with the appropriate glibc version), we need to - # copy the project into the container, and copy the built plugin out of the container because the host running docker does not have access to the - # project directory so volume mounts are not possible. The built plugin is copied to the project directory so it can be injected into the final binary. - build-better-sqlite3: - description: Build better-sqlite3 for glibc 2.31 + version: << parameters.google-chrome-for-testing-version >> + install-required-node: + description: Install Node version matching .node-version steps: - - setup_remote_docker - run: - name: Build better-sqlite3 for glibc 2.31 command: | - if [[ ! -f better_sqlite3.node ]]; then - set -x - apt update && apt install -y docker.io - docker run -d --name better-sqlite3-builder cypress/base-internal:22.18.0-glibc-2.31 /bin/bash -c "sleep 1000000000" - docker cp ~/cypress/node_modules/better-sqlite3 better-sqlite3-builder:/better-sqlite3 - docker exec -it better-sqlite3-builder /bin/bash -c "cd /better-sqlite3 && source /root/.bashrc && chown -R root:root . && npm install --ignore-scripts && npx --no-install prebuild -r electron -t 36.8.1 --include-regex 'better_sqlite3.node$'" - docker cp better-sqlite3-builder:/better-sqlite3/build/Release/better_sqlite3.node ~/cypress/node_modules/better-sqlite3/build/Release/better_sqlite3.node - docker rm -f better-sqlite3-builder - cp ~/cypress/node_modules/better-sqlite3/build/Release/better_sqlite3.node ~/cypress/better_sqlite3.node - else - cp ~/cypress/better_sqlite3.node ~/cypress/node_modules/better-sqlite3/build/Release/better_sqlite3.node + source ./scripts/ensure-node.sh + echo "Installing Yarn" + npm install yarn --location=global # ensure yarn is installed with the correct node engine + yarn check-node-version + name: Install Node + - run: + command: | + source ./scripts/ensure-node.sh + yarn check-node-version + name: Check Node + install-webkit-deps: + steps: + - run: + command: | + npx playwright install webkit + npx playwright install-deps webkit + name: Install WebKit dependencies + install_cache_helpers_dependencies: + steps: + - run: + command: npm i glob@7.1.6 fs-extra@10.0.0 minimist@1.2.5 + fast-json-stable-stringify@2.1.0 + name: Cache Helper Dependencies + working_directory: ~/ + maybe_skip_binary_jobs: + steps: + - run: + command: | + if [[ -z "$CIRCLE_TOKEN" ]]; then + echo "There is no CIRCLE_TOKEN set for this job. Cannot trigger binary build. Skipping job." + circleci-agent step halt fi - - save_cache: - key: better-sqlite3-{{ checksum "node_modules/better-sqlite3/package.json" }}-{{ - checksum "node_modules/electron/package.json" }} - paths: - - better_sqlite3.node + name: Skip binary job if external PR + post-install-comment: + description: Post GitHub comment with a blurb on how to install pre-release version + parameters: + binary_url_path: + default: binary-url.json + type: string + package_url_path: + default: npm-package-url.json + type: string + steps: - run: - name: Clean up top level better-sqlite3 file command: | - rm ~/cypress/better_sqlite3.node - + node scripts/add-install-comment.js \ + --npm << parameters.package_url_path >> \ + --binary << parameters.binary_url_path >> + name: Post pre-release install comment + prepare-modules-cache: + parameters: + dont-move: + default: false + type: boolean + steps: + - run: node scripts/circle-cache.js --action prepare + - unless: + condition: << parameters.dont-move >> + steps: + - run: + command: | + mkdir -p /tmp/node_modules_cache + mv ~/cypress/node_modules /tmp/node_modules_cache/root_node_modules + mv ~/cypress/cli/node_modules /tmp/node_modules_cache/cli_node_modules + mv ~/cypress/system-tests/node_modules /tmp/node_modules_cache/system-tests_node_modules + mv ~/cypress/globbed_node_modules /tmp/node_modules_cache/globbed_node_modules + name: Move to /tmp dir for consistent caching across root/non-root users + restore_cached_binary: + steps: + - attach_workspace: + at: ~/ + restore_cached_system_tests_deps: + description: Restore the cached node_modules for projects in "system-tests/projects/**" + steps: + - run: + command: ./system-tests/scripts/cache-key.sh > system_tests_cache_key + name: Generate Circle Cache key for system tests + - run: + command: node ./scripts/get-platform-key.js > platform_key + name: Generate platform key + - restore_cache: + keys: + - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum + "platform_key" }}-system-tests-projects-node-modules-cache-{{ + checksum "system_tests_cache_key" }} + name: Restore system tests node_modules cache + restore_cached_workspace: + steps: + - attach_workspace: + at: ~/ + - install-required-node + - unpack-dependencies + restore_workspace_binaries: + steps: + - attach_workspace: + at: ~/ + - run: ls -l + - run: ls -l cypress.zip cypress.tgz + - run: node --version + - run: npm --version + run-binary-system-tests: + steps: + - restore_cached_workspace + - restore_cached_system_tests_deps + - run: + command: | + ALL_SPECS=`circleci tests glob "$HOME/cypress/system-tests/test-binary/*spec*"` + SPECS=`echo $ALL_SPECS | xargs -n 1 | circleci tests split --split-by=timings` + echo SPECS=$SPECS + yarn workspace @tooling/system-tests test:ci $SPECS + environment: + CYPRESS_COMMERCIAL_RECOMMENDATIONS: "0" + name: Run system tests + - sanitize-verify-and-store-mocha-results run-driver-integration-tests: parameters: browser: description: browser shortname to target type: string - install-chrome-channel: - description: chrome channel to install - type: string - default: 'stable' firefox-version: + default: "142.0" description: firefox version to install type: string - default: *firefox-stable-version inject-document-domain: + default: false description: run subset of tests with injectDocumentDomain config enabled type: boolean - default: false - + install-chrome-channel: + default: stable + description: chrome channel to install + type: string steps: - restore_cached_workspace - when: condition: - equal: [ chrome, << parameters.browser >> ] + equal: + - chrome + - << parameters.browser >> steps: - install-browsers: install-chrome: true - when: condition: - equal: [ chrome:beta, << parameters.browser >> ] + equal: + - chrome:beta + - << parameters.browser >> steps: - install-browsers: - install-chrome: true google-chrome-channel: << parameters.install-chrome-channel >> - google-chrome-version: *chrome-beta-version + google-chrome-version: 141.0.7390.16 + install-chrome: true - when: condition: - equal: [ firefox, << parameters.browser >> ] + equal: + - firefox + - << parameters.browser >> steps: - install-browsers: - install-firefox: true firefox-version: << parameters.firefox-version >> + install-firefox: true - when: condition: - equal: [ webkit, << parameters.browser >> ] + equal: + - webkit + - << parameters.browser >> steps: - install-webkit-deps - run: - name: Run driver tests in Cypress - environment: - CYPRESS_CONFIG_ENV: production command: | echo Current working directory is $PWD echo Total containers $CIRCLE_NODE_TOTAL @@ -742,67 +670,64 @@ commands: fi yarn $YARN_CMD --browser <> --spec $TESTFILES --runner-ui fi + environment: + CYPRESS_CONFIG_ENV: production + name: Run driver tests in Cypress working_directory: packages/driver - sanitize-verify-and-store-mocha-results - - windows-install-chrome: - parameters: - browser: - description: browser shortname to target - type: string - steps: - - run: - # TODO: How can we have preinstalled browsers on CircleCI? - name: 'Install Chrome on Windows' - command: | - # install with `--ignore-checksums` to avoid checksum error - # https://www.gep13.co.uk/blog/chocolatey-error-hashes-do-not-match - [[ $PLATFORM == 'windows' && '<>' == 'chrome' ]] && choco install googlechrome -y --ignore-checksums || [[ $PLATFORM != 'windows' ]] - run-new-ui-tests: parameters: - package: - description: package to target - type: enum - enum: [ 'frontend-shared', 'launchpad', 'app', 'reporter' ] browser: description: browser shortname to target type: string + debug: + default: "" + description: debug option + type: string executor: description: the executor in use. Only used if Windows for workaround purposes type: executor + package: + description: package to target + enum: + - frontend-shared + - launchpad + - app + - reporter + type: enum percy: + default: false description: enable percy type: boolean - default: false type: description: ct or e2e + enum: + - ct + - e2e type: enum - enum: [ 'ct', 'e2e' ] - debug: - description: debug option - type: string - default: '' steps: - restore_cached_workspace - # this is a temporary work around while we wait for circle to resolve issues with packages - # with an @ character in windows during save_cache. - # @see https://github.com/cypress-io/cypress/issues/30343 for more details. - when: condition: - equal: [ *windows-executor, << parameters.executor >> ] + equal: + - environment: + PLATFORM: windows + machine: + image: windows-server-2022-gui:stable + shell: bash.exe -eo pipefail + resource_class: windows.large + - << parameters.executor >> steps: - run: - name: reinstall dependencies to work around cache issue (Windows only) command: rm -rf node_modules && yarn + name: reinstall dependencies to work around cache issue (Windows only) - install-browsers: + executor: << parameters.executor >> install-chrome: true install-firefox: true - executor: << parameters.executor >> - windows-install-chrome: browser: <> - run: - name: Run <> UI tests command: | echo Current working directory is $PWD echo Total containers $CIRCLE_NODE_TOTAL @@ -846,6 +771,7 @@ commands: PERCY_PARALLEL_TOTAL=-1 \ yarn workspace @packages/<> cypress:run:<> --browser <> --spec $TESTFILES fi + name: Run <> UI tests - run: command: | if [[ <> == 'app' && <> == 'true' && -d "packages/app/cypress/screenshots/runner/screenshot/screenshot.cy.tsx/percy" ]]; then @@ -857,7 +783,22 @@ commands: echo "skipping percy screenshots uploading" fi - sanitize-verify-and-store-mocha-results - + run-on-dependencies: + parameters: + command: + description: Command to run on the dependencies. + type: string + package: + description: Package to build all dependencies for. All dependencies in the + dependency chain must have a build script. + type: string + steps: + - run: + command: | + source ./scripts/ensure-node.sh + yarn lerna run <> --scope=<> --include-dependencies + name: Exec << parameters.command >> recursively on << parameters.package >> + dependencies. run-system-tests: parameters: browser: @@ -868,7 +809,9 @@ commands: - restore_cached_system_tests_deps - when: condition: - equal: [ webkit, << parameters.browser >> ] + equal: + - webkit + - << parameters.browser >> steps: - install-webkit-deps - install-browsers: @@ -876,9 +819,6 @@ commands: install-chrome-for-testing: true install-firefox: true - run: - name: Run system tests - environment: - CYPRESS_COMMERCIAL_RECOMMENDATIONS: '0' command: | ALL_SPECS=`circleci tests glob "/root/cypress/system-tests/test/*spec*"` SPECS= @@ -893,271 +833,99 @@ commands: SPECS=`echo $SPECS | xargs -n 1 | circleci tests split --split-by=timings` echo SPECS=$SPECS yarn workspace @tooling/system-tests test:ci $SPECS --browser <> - - sanitize-verify-and-store-mocha-results - - run-binary-system-tests: - steps: - - restore_cached_workspace - - restore_cached_system_tests_deps - - run: - name: Run system tests environment: - CYPRESS_COMMERCIAL_RECOMMENDATIONS: '0' - command: | - ALL_SPECS=`circleci tests glob "$HOME/cypress/system-tests/test-binary/*spec*"` - SPECS=`echo $ALL_SPECS | xargs -n 1 | circleci tests split --split-by=timings` - echo SPECS=$SPECS - yarn workspace @tooling/system-tests test:ci $SPECS + CYPRESS_COMMERCIAL_RECOMMENDATIONS: "0" + name: Run system tests - sanitize-verify-and-store-mocha-results - - post-install-comment: - parameters: - package_url_path: - type: string - default: npm-package-url.json - binary_url_path: - type: string - default: binary-url.json - description: Post GitHub comment with a blurb on how to install pre-release version - steps: - - run: - name: Post pre-release install comment - command: | - node scripts/add-install-comment.js \ - --npm << parameters.package_url_path >> \ - --binary << parameters.binary_url_path >> - sanitize-verify-and-store-mocha-results: description: Double-check that Mocha tests ran as expected. parameters: expectedResultCount: + default: 0 description: The number of result files to expect, ie, the number of Mocha test suites that ran. type: integer - ## pass a default magic number of 0 to assert that at least 1 test ran - default: 0 testResultsPath: + default: /tmp/cypress description: The path to the test results type: string - default: /tmp/cypress steps: - run: - name: 'Sanitize Mocha Results' - when: always command: | source ./scripts/ensure-node.sh yarn sanitize:mocha:results + name: Sanitize Mocha Results + when: always - run: - name: 'Verify Mocha Results' command: | source ./scripts/ensure-node.sh yarn verify:mocha:results <> + name: Verify Mocha Results - store_test_results: path: <> - - clone-repo-and-checkout-branch: - description: | - Clones an external repo and then checks out the branch that matches the next version otherwise uses 'master' branch. - parameters: - repo: - description: "Name of the github repo to clone like: cypress-example-kitchensink" - type: string - pull_request_id: - description: Pull request number to check out before installing and testing - type: integer - default: 0 - steps: - - restore_cached_binary - - run: - name: "Cloning test project and checking out release branch: - <>" - working_directory: /tmp/<> - command: | - git clone --depth 1 --no-single-branch https://github.com/cypress-io/<>.git . - - cd ~/cypress/.. - # install some deps for get-next-version - npm i semver@7.3.2 conventional-recommended-bump@6.1.0 conventional-changelog-angular@5.0.12 minimist@1.2.5 - NEXT_VERSION=$(node ./cypress/scripts/get-next-version.js) - cd - - - git checkout $NEXT_VERSION || true - - when: - condition: <> - steps: - - run: - name: Check out PR <> - working_directory: /tmp/<> - command: | - git fetch origin pull/<>/head:pr-<> - git checkout pr-<> - - test-binary-against-rwa: - description: | - Takes the built binary and NPM package, clones the RWA repo - and runs the new version of Cypress against it. - parameters: - repo: - description: "Name of the github repo to clone like" - type: string - default: "cypress-realworld-app" - browser: - description: Name of the browser to use, like "electron", "chrome", "firefox" - type: enum - enum: [ "", "electron", "chrome", "firefox" ] - default: "" - command: - description: Test command to run to start Cypress tests - type: string - default: "CYPRESS_INTERNAL_ENABLE_TELEMETRY=1 - CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY CYPRESS_PROJECT_ID=ypt4pf yarn - cypress:run" - # if the repo to clone and test is a monorepo, you can - # run tests inside a specific subfolder - folder: - description: Subfolder to test in - type: string - default: "" - # you can test new features in the test runner against recipes or other repos - # by opening a pull request in those repos and running this test job - # against a pull request number in the example repo - pull_request_id: - description: Pull request number to check out before installing and testing - type: integer - default: 0 - server-start-command: - description: Server start command for repo - type: string - default: "CI=true yarn start" + setup_should_persist_artifacts: steps: - - clone-repo-and-checkout-branch: - repo: <> - - when: - condition: <> - steps: - - run: - name: Check out PR <> - working_directory: /tmp/<> - command: | - git fetch origin pull/<>/head:pr-<> - git checkout pr-<> - git log -n 2 - - run: - command: yarn - working_directory: /tmp/<> - run: - name: Install Cypress - working_directory: /tmp/<> - # force installing the freshly built binary command: | - CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i --legacy-peer-deps ~/cypress/cypress.tgz && [[ -f yarn.lock ]] && yarn - - install-browsers: - install-chrome: true - - run: - name: Print Cypress version - working_directory: /tmp/<> - command: npx cypress version - - run: - name: Types check 🧩 (maybe) - working_directory: /tmp/<> - command: yarn types - - run: - # NOTE: we do not need to wait for the vite dev server to start - working_directory: /tmp/<> - command: <> - background: true - - when: - condition: <> - steps: - - when: - condition: <> - steps: - - run: - name: Run tests using browser "<>" - working_directory: /tmp/<>/<> - command: | - <> --browser <> --record false - - unless: - condition: <> - steps: - - run: - name: Run tests using command - working_directory: /tmp/<>/<> - command: <> - - unless: - condition: <> - steps: - - when: - condition: <> - steps: - - run: - name: Run tests using browser "<>" - working_directory: /tmp/<> - command: <> --browser <> --record false - - unless: - condition: <> - steps: - - run: - name: Run tests using command - working_directory: /tmp/<> - command: <> - + echo "Setting SHOULD_PERSIST_ARTIFACTS variable" + echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "chore/refactor_cli_to_ts" ]]; then + export SHOULD_PERSIST_ARTIFACTS=true + fi' >> "$BASH_ENV" + name: Set environment variable to determine whether or not to persist artifacts test-binary-against-repo: description: | Takes the built binary and NPM package, clones given example repo and runs the new version of Cypress against it. parameters: - repo: - description: "Name of the github repo to clone like: cypress-example-kitchensink" - type: string browser: + default: "" description: Name of the browser to use, like "electron", "chrome", "firefox" + enum: + - "" + - electron + - chrome + - firefox type: enum - enum: [ "", "electron", "chrome", "firefox" ] - default: "" - command: - description: Test command to run to start Cypress tests - type: string - default: "npm run e2e" build-project: + default: true description: Should the project build script be executed type: boolean - default: true - # if the repo to clone and test is a monorepo, you can - # run tests inside a specific subfolder + command: + default: npm run e2e + description: Test command to run to start Cypress tests + type: string + executor: + default: cy-doc + description: The executor in use. Only used if Windows for workaround purposes + type: executor folder: + default: "" description: Subfolder to test in type: string - default: "" - # you can test new features in the test runner against recipes or other repos - # by opening a pull request in those repos and running this test job - # against a pull request number in the example repo pull_request_id: + default: 0 description: Pull request number to check out before installing and testing type: integer - default: 0 - wait-on: - description: Whether to use wait-on to wait on a server to be booted + repo: + description: 'Name of the github repo to clone like: cypress-example-kitchensink' type: string - default: "" server-start-command: + default: npm start --if-present description: Server start command for repo type: string - default: "npm start --if-present" - executor: - description: The executor in use. Only used if Windows for workaround purposes - type: executor - default: cy-doc + wait-on: + default: "" + description: Whether to use wait-on to wait on a server to be booted + type: string steps: - run: - name: Install yarn if not already installed command: | yarn --version || npm i -g yarn + name: Install yarn if not already installed - clone-repo-and-checkout-branch: - repo: <> pull_request_id: <> + repo: <> - run: - # Ensure we're installing the node-version for the cloned repo command: | if [[ -f .node-version ]]; then branch="<< pipeline.git.branch >>" @@ -1176,7 +944,6 @@ commands: fi working_directory: /tmp/<> - run: - # Install deps + Cypress binary with yarn if yarn.lock present command: | source ./ci-ensure-node.sh if [[ -f yarn.lock ]]; then @@ -1188,46 +955,48 @@ commands: fi working_directory: /tmp/<> - run: - name: Print Cypress version - working_directory: /tmp/<> command: | source ./ci-ensure-node.sh npx cypress version - - run: - name: Types check 🧩 (maybe) + name: Print Cypress version working_directory: /tmp/<> + - run: command: | source ./ci-ensure-node.sh [[ -f yarn.lock ]] && yarn types || npm run types --if-present + name: "Types check 🧩 (maybe)" + working_directory: /tmp/<> - when: condition: <> steps: - run: - name: Build 🏗 (maybe) - working_directory: /tmp/<> command: | source ./ci-ensure-node.sh [[ -f yarn.lock ]] && yarn build || npm run build --if-present + name: "Build 🏗 (maybe)" + working_directory: /tmp/<> - run: - working_directory: /tmp/<> + background: true command: | source ./ci-ensure-node.sh <> - background: true + working_directory: /tmp/<> - when: condition: not: - equal: [ "", <> ] + equal: + - "" + - <> steps: - run: - name: "Waiting on server to boot: <>" command: | npm i -g wait-on npx wait-on <> --timeout 120000 + name: 'Waiting on server to boot: <>' - install-browsers: + executor: << parameters.executor >> install-chrome: true install-firefox: true - executor: << parameters.executor >> - windows-install-chrome: browser: <> - when: @@ -1237,17 +1006,17 @@ commands: condition: <> steps: - run: - name: Run tests using browser "<>" - working_directory: /tmp/<>/<> command: | <> -- --browser <> + name: Run tests using browser "<>" + working_directory: /tmp/<>/<> - unless: condition: <> steps: - run: + command: <> name: Run tests using command working_directory: /tmp/<>/<> - command: <> - unless: condition: <> steps: @@ -1255,406 +1024,465 @@ commands: condition: <> steps: - run: - name: Run tests using browser "<>" - working_directory: /tmp/<> command: | source ./ci-ensure-node.sh <> -- --browser <> + name: Run tests using browser "<>" + working_directory: /tmp/<> - unless: condition: <> steps: - run: - name: Run tests using command - working_directory: /tmp/<> command: | source ./ci-ensure-node.sh <> - - check-if-binary-exists: - steps: - - run-on-dependencies: - package: internal-scripts - command: build - - run: - name: Check if binary exists, exit if it does - command: | - source ./scripts/ensure-node.sh - yarn gulp e2eTestScaffold - yarn check-binary-on-cdn --version $(node ./scripts/get-next-version.js) --type binary --file cypress.zip - - run-on-dependencies: + name: Run tests using command + working_directory: /tmp/<> + test-binary-against-rwa: + description: | + Takes the built binary and NPM package, clones the RWA repo + and runs the new version of Cypress against it. parameters: - package: - description: Package to build all dependencies for. All dependencies in the - dependency chain must have a build script. - type: string + browser: + default: "" + description: Name of the browser to use, like "electron", "chrome", "firefox" + enum: + - "" + - electron + - chrome + - firefox + type: enum command: - description: Command to run on the dependencies. + default: CYPRESS_INTERNAL_ENABLE_TELEMETRY=1 CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY + CYPRESS_PROJECT_ID=ypt4pf yarn cypress:run + description: Test command to run to start Cypress tests + type: string + folder: + default: "" + description: Subfolder to test in + type: string + pull_request_id: + default: 0 + description: Pull request number to check out before installing and testing + type: integer + repo: + default: cypress-realworld-app + description: Name of the github repo to clone like + type: string + server-start-command: + default: CI=true yarn start + description: Server start command for repo type: string steps: + - clone-repo-and-checkout-branch: + repo: <> + - when: + condition: <> + steps: + - run: + command: | + git fetch origin pull/<>/head:pr-<> + git checkout pr-<> + git log -n 2 + name: Check out PR <> + working_directory: /tmp/<> - run: - name: Exec << parameters.command >> recursively on << parameters.package >> - dependencies. - command: | - source ./scripts/ensure-node.sh - yarn lerna run <> --scope=<> --include-dependencies - - build-and-package-binary: - steps: + command: yarn + working_directory: /tmp/<> - run: - name: Check environment variables before code sign (if on Mac/Windows) - # NOTE - # our code sign works via electron-builder - # by default, electron-builder will NOT sign app built in a pull request - # even our internal one (!) - # Usually this is not a problem, since we only build and test binary - # built on the "develop" branch - # but if you need to really build and sign a binary in a PR - # set variable CSC_FOR_PULL_REQUEST=true command: | - set -e - NEEDS_CODE_SIGNING_WINDOWS=`node -p 'process.platform === "win32"'` - NEEDS_CODE_SIGNING_MAC=`node -p 'process.platform === "darwin"'` - - if [[ "$NEEDS_CODE_SIGNING_MAC" == "true" ]]; then - echo "Checking for required environment variables..." - if [ -z "$CSC_LINK" ]; then - echo "Need to provide environment variable CSC_LINK" - echo "with base64 encoded certificate .p12 file" - exit 1 - fi - if [ -z "$CSC_KEY_PASSWORD" ]; then - echo "Need to provide environment variable CSC_KEY_PASSWORD" - echo "with password for unlocking certificate .p12 file" - exit 1 - fi - echo "Succeeded." - elif [[ "$NEEDS_CODE_SIGNING_WINDOWS" == "true" ]]; then - echo "Checking for required environment variables..." - if [ -z "$WINDOWS_SIGN_USER_NAME" ]; then - echo "Need to provide environment variable WINDOWS_SIGN_USER_NAME" - echo "with password for fetching and signing certificate" - exit 1 - fi - if [ -z "$WINDOWS_SIGN_USER_PASSWORD" ]; then - echo "Need to provide environment variable WINDOWS_SIGN_USER_PASSWORD" - echo "for fetching and signing certificate" - exit 1 - fi - if [ -z "$WINDOWS_SIGN_CREDENTIAL_ID" ]; then - echo "Need to provide environment variable WINDOWS_SIGN_CREDENTIAL_ID" - echo "for identifying certificate" - exit 1 - fi - if [ -z "$WINDOWS_SIGN_USER_TOTP" ]; then - echo "Need to provide environment variable WINDOWS_SIGN_USER_TOTP" - echo "for signing certificate" - exit 1 - fi - echo "Succeeded." - else - echo "Not code signing for this platform" - fi - - run: - name: Build the Cypress binary - no_output_timeout: "45m" - command: | - source ./scripts/ensure-node.sh - node --version - if [[ `node ./scripts/get-platform-key.js` == 'linux-arm64' ]]; then - # these are missing on Circle and there is no way to pre-install them on Arm - sudo apt-get update - sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb - DISABLE_SNAPSHOT_REQUIRE=1 yarn binary-build --version $(node ./scripts/get-next-version.js) - else - yarn binary-build --version $(node ./scripts/get-next-version.js) - fi + CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i --legacy-peer-deps ~/cypress/cypress.tgz && [[ -f yarn.lock ]] && yarn + name: Install Cypress + working_directory: /tmp/<> + - install-browsers: + install-chrome: true - run: - name: Package the Cypress binary - environment: - DEBUG: electron-builder,electron-osx-sign*,electron-notarize* - # notarization on Mac can take a while - no_output_timeout: "45m" - command: | - source ./scripts/ensure-node.sh - node --version - if [[ `node ./scripts/get-platform-key.js` == 'linux-arm64' ]]; then - # these are missing on Circle and there is no way to pre-install them on Arm - sudo apt-get update - sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb - DISABLE_SNAPSHOT_REQUIRE=1 yarn binary-package --version $(node ./scripts/get-next-version.js) - else - yarn binary-package --version $(node ./scripts/get-next-version.js) - fi + command: npx cypress version + name: Print Cypress version + working_directory: /tmp/<> - run: - name: Smoke Test the Cypress binary - command: | - source ./scripts/ensure-node.sh - node --version - yarn binary-smoke-test --version $(node ./scripts/get-next-version.js) + command: yarn types + name: "Types check 🧩 (maybe)" + working_directory: /tmp/<> - run: - name: Zip the binary - command: | - if [[ $PLATFORM == 'linux' ]]; then - # on Arm, CI runs as non-root, on x64 CI runs as root but there is no sudo binary - if [[ `whoami` == 'root' ]]; then - apt-get update && apt-get install -y zip - else - sudo apt-get update && sudo apt-get install -y zip - fi - fi - source ./scripts/ensure-node.sh - yarn binary-zip - - persist_to_workspace: - root: ~/ - paths: - - cypress/cypress.zip - + background: true + command: <> + working_directory: /tmp/<> + - when: + condition: <> + steps: + - when: + condition: <> + steps: + - run: + command: | + <> --browser <> --record false + name: Run tests using browser "<>" + working_directory: /tmp/<>/<> + - unless: + condition: <> + steps: + - run: + command: <> + name: Run tests using command + working_directory: /tmp/<>/<> + - unless: + condition: <> + steps: + - when: + condition: <> + steps: + - run: + command: <> --browser <> --record false + name: Run tests using browser "<>" + working_directory: /tmp/<> + - unless: + condition: <> + steps: + - run: + command: <> + name: Run tests using command + working_directory: /tmp/<> trigger-publish-binary-pipeline: steps: - run: - name: "Trigger publish-binary pipeline" command: | source ./scripts/ensure-node.sh echo $SHOULD_PERSIST_ARTIFACTS node ./scripts/binary/trigger-publish-binary-pipeline.js + name: Trigger publish-binary pipeline - persist_to_workspace: - root: ~/ paths: - triggered_pipeline.json - - build-cypress-npm-package: - parameters: - executor: - type: executor - default: cy-doc + root: ~/ + unpack-dependencies: + description: Unpacks dependencies associated with the current workflow steps: + - install_cache_helpers_dependencies - run: - name: Bump NPM version - command: | - source ./scripts/ensure-node.sh - yarn get-next-version --npm + command: node scripts/circle-cache.js --action cacheKey > circle_cache_key + name: Generate Circle Cache Key + - run: + command: node ./scripts/get-platform-key.js > platform_key + name: Generate platform key + - restore_cache: + key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" + }}-node-modules-cache-{{ checksum "circle_cache_key" }} + name: Restore cache state, to check for known modules cache existence - run: - name: Build NPM package command: | - source ./scripts/ensure-node.sh - yarn lerna run build-cli + if [[ -d "/tmp/node_modules_cache" ]]; then + mv /tmp/node_modules_cache/root_node_modules ~/cypress/node_modules + mv /tmp/node_modules_cache/cli_node_modules ~/cypress/cli/node_modules + mv /tmp/node_modules_cache/system-tests_node_modules ~/cypress/system-tests/node_modules + mv /tmp/node_modules_cache/globbed_node_modules ~/cypress/globbed_node_modules + rm -rf /tmp/node_modules_cache + fi + name: Move node_modules back from /tmp - run: - command: ls -la types - working_directory: cli/build + command: node scripts/circle-cache.js --action unpack + name: Restore all node_modules to proper workspace folders + update_cached_system_tests_deps: + description: Update the cached node_modules for projects in "system-tests/projects/**" + steps: - run: - command: ls -la vue mount-utils react - working_directory: cli/build - - unless: - condition: - equal: [ *windows-executor, << parameters.executor >> ] - steps: - - run: - name: list NPM package contents - command: | - source ./scripts/ensure-node.sh - yarn workspace cypress size + command: ./system-tests/scripts/cache-key.sh > system_tests_cache_key + name: Generate Circle Cache key for system tests - run: - name: pack NPM package - working_directory: cli/build - command: yarn pack --filename ../../cypress.tgz + command: node ./scripts/get-platform-key.js > platform_key + name: Generate platform key + - restore_cache: + keys: + - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum + "platform_key" + }}-state-of-system-tests-projects-node-modules-cache-{{ checksum + "system_tests_cache_key" }} + name: Restore cache state, to check for known modules cache existence - run: - name: list created NPM package - command: ls -l - - persist_to_workspace: - root: ~/ + command: | + if [[ -f "/tmp/system_tests_node_modules_installed" ]]; then + echo "No updates to system tests node modules, exiting" + circleci-agent step halt + fi + name: Bail if specific cache exists + - restore_cache: + keys: + - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum + "platform_key" }}-system-tests-projects-node-modules-cache-{{ + checksum "system_tests_cache_key" }} + - v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum + "platform_key" }}-system-tests-projects-node-modules-cache- + name: Restore system tests node_modules cache + - run: + command: yarn workspace @tooling/system-tests projects:yarn:install + name: Update system-tests node_modules cache + - save_cache: + key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" + }}-system-tests-projects-node-modules-cache-{{ checksum + "system_tests_cache_key" }} + name: Save system tests node_modules cache paths: - - cypress/cypress.tgz - + - /tmp/cy-system-tests-node-modules + - run: touch /tmp/system_tests_node_modules_installed + - save_cache: + key: v{{ checksum ".circleci/cache-version.txt" }}-{{ checksum "platform_key" + }}-state-of-system-tests-projects-node-modules-cache-{{ checksum + "system_tests_cache_key" }} + name: Save system tests node_modules cache state key + paths: + - /tmp/system_tests_node_modules_installed + update_known_hosts: + description: Ensures that we have the latest Git public keys to prevent git+ssh + from failing. + steps: + - run: + command: | + mkdir -p ~/.ssh + ssh-keyscan github.com >> ~/.ssh/known_hosts + name: Update known_hosts with github.com keys upload-build-artifacts: steps: - run: ls -l - run: - name: Upload unique binary to S3 command: | node scripts/binary.js upload-build-artifact \ --type binary \ --file cypress.zip \ --version $(node -p "require('./package.json').version") + name: Upload unique binary to S3 - run: - name: Upload NPM package to S3 command: | node scripts/binary.js upload-build-artifact \ --type npm-package \ --file cypress.tgz \ --version $(node -p "require('./package.json').version") + name: Upload NPM package to S3 - run: ls -l - run: cat binary-url.json - run: cat npm-package-url.json - persist_to_workspace: - root: ~/ paths: - cypress/binary-url.json - cypress/npm-package-url.json - - update_known_hosts: - description: Ensures that we have the latest Git public keys to prevent git+ssh - from failing. + root: ~/ + verify-build-setup: + description: Common commands run when setting up for build or yarn install + parameters: + executor: + default: cy-doc + type: executor steps: + - run: pwd + - run: + command: yarn versions + name: print yarn version + - unless: + condition: + equal: + - environment: + PLATFORM: windows + machine: + image: windows-server-2022-gui:stable + shell: bash.exe -eo pipefail + resource_class: windows.large + - << parameters.executor >> + steps: + - run: + command: | + source ./scripts/ensure-node.sh + yarn stop-only-all + name: Stop .only - run: - name: Update known_hosts with github.com keys command: | - mkdir -p ~/.ssh - ssh-keyscan github.com >> ~/.ssh/known_hosts - -jobs: - ## Checks if we already have a valid cache for the node_modules_install and if it has, - ## skips ahead to the build step, otherwise installs and caches the node_modules - node_modules_install: - <<: *defaults + source ./scripts/ensure-node.sh + yarn check-terminal + name: Check terminal variables + verify_should_persist_artifacts: + steps: + - run: + command: | + if [[ -z "$SHOULD_PERSIST_ARTIFACTS" ]]; then + echo "Not uploading artifacts or posting install comment for this branch." + circleci-agent step halt + fi + name: Check current branch to persist artifacts + windows-install-chrome: parameters: - <<: *defaultsParameters - resource_class: + browser: + description: browser shortname to target type: string - default: medium - build-better-sqlite3: - type: boolean - default: false - resource_class: << parameters.resource_class >> steps: - - update_known_hosts - - checkout - - install-required-node - - verify-build-setup: - executor: << parameters.executor >> - - persist_to_workspace: - root: ~/ - paths: - - cypress - - .ssh - - .nvm # mac / linux - - ProgramData/nvm # windows - - caching-dependency-installer: - only-cache-for-root-user: <> - build-better-sqlite3: <> - - ## restores node_modules from previous step & builds if first step skipped + - run: + command: | + # install with `--ignore-checksums` to avoid checksum error + # https://www.gep13.co.uk/blog/chocolatey-error-hashes-do-not-match + [[ $PLATFORM == 'windows' && '<>' == 'chrome' ]] && choco install googlechrome -y --ignore-checksums || [[ $PLATFORM != 'windows' ]] + name: Install Chrome on Windows +defaults: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + working_directory: ~/cypress +executors: + cy-doc: + docker: + - image: cypress/base-internal:22.18.0-bullseye + environment: + PLATFORM: linux + resource_class: medium + darwin-amd64: + environment: + PLATFORM: darwin + machine: true + darwin-arm64: + environment: + PLATFORM: darwin + machine: true + kitchensink-executor: + docker: + - image: cypress/base-internal:22.18.0-bullseye + environment: + PLATFORM: linux + resource_class: medium + linux-arm64: + environment: + DISABLE_SNAPSHOT_REQUIRE: 1 + PLATFORM: linux + machine: + image: ubuntu-2004:2024.11.1 + resource_class: arm.medium + linux-x64: + environment: + PLATFORM: linux + machine: + image: ubuntu-2004:2024.11.1 + resource_class: medium + non-root-docker-user: + docker: + - image: cypress/base-internal:22.18.0-bullseye + user: node + environment: + PLATFORM: linux + windows: + environment: + PLATFORM: windows + machine: + image: windows-server-2022-gui:stable + shell: bash.exe -eo pipefail + resource_class: windows.large +firefox-stable-version: "142.0" +jobs: + binary-system-tests: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + PLATFORM: linux + TZ: /usr/share/zoneinfo/America/New_York + machine: + docker_layer_caching: true + image: ubuntu-2004:2024.05.1 + parallelism: 2 + resource_class: medium + steps: + - maybe_skip_binary_jobs + - run-binary-system-tests + working_directory: ~/cypress build: - <<: *defaults + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 parameters: - <<: *defaultsParameters - resource_class: - type: string - default: large + executor: + default: cy-doc + type: executor is_contributor_pr: + default: false type: boolean + only-cache-for-root-user: default: false + type: boolean + resource_class: + default: large + type: string resource_class: << parameters.resource_class >> steps: - restore_cached_workspace - # this is a temporary work around while we wait for circle to resolve issues with packages - # with an @ character in windows during save_cache. - # @see https://github.com/cypress-io/cypress/issues/30343 for more details. - when: condition: - equal: [ *windows-executor, << parameters.executor >> ] + equal: + - environment: + PLATFORM: windows + machine: + image: windows-server-2022-gui:stable + shell: bash.exe -eo pipefail + resource_class: windows.large + - << parameters.executor >> steps: - run: - name: reinstall dependencies to work around cache issue (Windows only) command: rm -rf node_modules && yarn + name: reinstall dependencies to work around cache issue (Windows only) - run: - name: Top level packages command: yarn list --depth=0 || true + name: Top level packages - run: - name: Check env canaries command: node ./scripts/circle-env.js --check-canaries --is-contributor-pr << parameters.is_contributor_pr >> + name: Check env canaries - build-and-persist - - lint: - <<: *defaults - steps: - - restore_cached_workspace - - run: - name: Linting 🧹 - command: | - yarn clean - git clean -df - yarn lint - - run: - name: cypress info (dev) - command: node cli/bin/cypress info --dev - + working_directory: ~/cypress check-ts: - <<: *defaults + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean steps: - restore_cached_workspace - install-required-node - run: - name: Check TS Types command: NODE_OPTIONS=--max_old_space_size=4096 yarn check-ts --concurrency=1 - - # a special job that closes the Percy build started by the required jobs - percy-finalize: - <<: *defaults - resource_class: small - parameters: - <<: *defaultsParameters - required_env_var: - type: env_var_name - steps: - - restore_cached_workspace - - run: - # if this is an external pull request, the environment variables - # are NOT set for security reasons, thus no need to to finalize Percy, - # since there will be no visual tests - name: Check if <> is set - command: | - if [[ -v <> ]]; then - echo "Internal PR, good to go" - else - echo "This is an external PR, cannot access other services" - circleci-agent step halt - fi - - run: - # Sometimes, even though all the circle jobs have finished, Percy times out during `build:finalize` - # If all other jobs finish but `build:finalize` fails, we retry it once - name: Finalize percy build - allows single retry - command: | - PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ - yarn percy build:finalize || yarn percy build:finalize - - # verify accessibility scores from Cypress - verify-accessibility-results: - <<: *defaults - resource_class: small - steps: - - run: | - if [[ -z "$MAIN_RECORD_KEY" ]]; then - echo "skipping for contributor PRs since we don't record to the cloud" - circleci-agent step halt - fi - - update_known_hosts - - run: - name: checkout - command: git clone -b "$CIRCLE_BRANCH" "$CIRCLE_REPOSITORY_URL" --depth 1 - - run: - name: Install extract-cloud-results package - command: | - npm install https://cdn.cypress.io/extract-cloud-results/v1/extract-cloud-results.tgz - - run: - name: Verify Accessibility Results - command: | - cp ./cypress/scripts/verify-accessibility-results.js verify-accessibility-results.js - CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY node verify-accessibility-results.js - - ready-to-release: - <<: *defaults - resource_class: small - parameters: - <<: *defaultsParameters - steps: - - run: - name: Ready to release - command: echo 'Ready to release' - + name: Check TS Types + working_directory: ~/cypress cli-visual-tests: - <<: *defaults + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean resource_class: small steps: - restore_cached_workspace @@ -1671,91 +1499,119 @@ jobs: environment: FORCE_COLOR: 2 - run: - name: Upload CLI snapshots for diffing command: | PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ PERCY_ENABLE=${PERCY_TOKEN:-0} \ PERCY_PARALLEL_TOTAL=-1 \ yarn percy snapshot ./cli/visual-snapshots - - v8-integration-tests: - <<: *defaults + name: Upload CLI snapshots for diffing + working_directory: ~/cypress + create-and-trigger-packaging-artifacts: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 parameters: - <<: *defaultsParameters - resource_class: - type: string - default: medium + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: + default: small + type: string resource_class: << parameters.resource_class >> + steps: + - maybe_skip_binary_jobs + - restore_cached_workspace + - check-if-binary-exists + - setup_should_persist_artifacts + - trigger-publish-binary-pipeline + working_directory: ~/cypress + create-build-artifacts: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: + default: xlarge + type: string + resource_class: << parameters.resource_class >> steps: - restore_cached_workspace - - restore_cached_system_tests_deps - # this is a temporary work around while we wait for circle to resolve issues with packages - # with an @ character in windows during save_cache. - # @see https://github.com/cypress-io/cypress/issues/30343 for more details. - when: condition: - equal: [ *windows-executor, << parameters.executor >> ] + equal: + - environment: + PLATFORM: windows + machine: + image: windows-server-2022-gui:stable + shell: bash.exe -eo pipefail + resource_class: windows.large + - << parameters.executor >> steps: - run: - name: reinstall dependencies to work around cache issue (Windows only) command: rm -rf node_modules && yarn - # TODO: Remove this once we switch off self-hosted M1 runners - - when: - condition: - equal: [ *darwin-arm64-executor, << parameters.executor >> ] - steps: - - run: rm -f /tmp/cypress/junit/* - - unless: - condition: - or: - - 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 - steps: - - run: - name: Run v8 integration tests - command: | - source ./scripts/ensure-node.sh - yarn test-integration --scope=@tooling/{packherd,v8-snapshot,electron-mksnapshot} - - sanitize-verify-and-store-mocha-results: - expectedResultCount: 3 - - when: - condition: - or: - - equal: [ *linux-arm64-executor, << parameters.executor >> ] - steps: - - run: - name: Run v8 integration tests - command: | - source ./scripts/ensure-node.sh - yarn test-integration --scope=@tooling/packherd - - sanitize-verify-and-store-mocha-results: - expectedResultCount: 1 - + name: reinstall dependencies to work around cache issue (Windows only) + - check-if-binary-exists + - build-and-package-binary + - build-cypress-npm-package: + executor: << parameters.executor >> + - setup_should_persist_artifacts + - verify_should_persist_artifacts + - upload-build-artifacts + - post-install-comment + working_directory: ~/cypress driver-integration-memory-tests: - <<: *defaults + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 parameters: - <<: *defaultsParameters + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean resource_class: - type: string default: medium + type: string resource_class: << parameters.resource_class >> - parallelism: 1 steps: - restore_cached_workspace - # this is a temporary work around while we wait for circle to resolve issues with packages - # with an @ character in windows during save_cache. - # @see https://github.com/cypress-io/cypress/issues/30343 for more details. - when: condition: - equal: [ *windows-executor, << parameters.executor >> ] + equal: + - environment: + PLATFORM: windows + machine: + image: windows-server-2022-gui:stable + shell: bash.exe -eo pipefail + resource_class: windows.large + - << parameters.executor >> steps: - run: - name: reinstall dependencies to work around cache issue (Windows only) command: rm -rf node_modules && yarn + name: reinstall dependencies to work around cache issue (Windows only) - run: - name: Driver memory tests in Electron - environment: - CYPRESS_CONFIG_ENV: production command: | echo Current working directory is $PWD node --version @@ -1768,773 +1624,1575 @@ jobs: CYPRESS_INTERNAL_MEMORY_SAVE_STATS=true \ DEBUG=cypress*memory \ yarn cypress:run --browser electron --spec "cypress/e2e/memory/*.cy.*" + environment: + CYPRESS_CONFIG_ENV: production + name: Driver memory tests in Electron working_directory: packages/driver - sanitize-verify-and-store-mocha-results - - unit-tests: - <<: *defaults + working_directory: ~/cypress + driver-integration-tests-chrome: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 5 parameters: - <<: *defaultsParameters - resource_class: - type: string - default: medium - resource_class: << parameters.resource_class >> - parallelism: 1 + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: medium+ steps: - - restore_cached_workspace - - install-browsers: - install-chrome: true - executor: << parameters.executor >> - - when: - condition: - # several snapshots fails for windows due to paths. - # until these are fixed, run the tests that are working. - equal: [ *windows-executor, << parameters.executor >> ] - steps: - - run: yarn test-scripts scripts/**/*spec.js - - sanitize-verify-and-store-mocha-results - - unless: - condition: - equal: [ *windows-executor, << parameters.executor >> ] - steps: - - run: - name: Enable IPv6 in Docker - command: | - cat \<<'EOF' | sudo tee /etc/docker/daemon.json - { - "ipv6": true, - "fixed-cidr-v6": "2001:db8:1::/64" - } - EOF - cat \<<'EOF' | sudo tee /etc/hosts - 127.0.0.1 localhost - ::1 localhost - EOF - sudo service docker restart - - run: - name: Test scripts - command: | - source ./scripts/ensure-node.sh - yarn test-scripts - - run: - name: Test each individual package - command: | - source ./scripts/ensure-node.sh - # this is needed since we are have to be running as root to test some packages - sudo -E env "PATH=$PATH" yarn test - - run: - name: Test types - command: | - source ./scripts/ensure-node.sh - yarn lerna run types - - sanitize-verify-and-store-mocha-results: - expectedResultCount: 18 - - verify-release-readiness: - <<: *defaults - resource_class: small - parallelism: 1 + - run-driver-integration-tests: + browser: chrome + install-chrome-channel: stable + working_directory: ~/cypress + driver-integration-tests-chrome-beta: environment: - GITHUB_TOKEN: $GH_TOKEN + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 5 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: medium+ steps: - - restore_cached_workspace - - update_known_hosts - - run: yarn test-npm-package-release-script - - run: node ./scripts/semantic-commits/validate-binary-changelog.js - - store_artifacts: - path: /tmp/releaseData - - lint-types: - <<: *defaults - parallelism: 1 + - run-driver-integration-tests: + browser: chrome:beta + install-chrome-channel: beta + working_directory: ~/cypress + driver-integration-tests-chrome-beta-inject-document-domain: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 5 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: medium+ steps: - - restore_cached_workspace - - run: - command: ls -la types - working_directory: cli - - run: - command: ls -la chai - working_directory: cli/types - - run: - name: "Lint types 🧹" - command: yarn workspace cypress dtslint - - server-unit-tests: - <<: *defaults - parallelism: 1 + - run-driver-integration-tests: + browser: chrome:beta + inject-document-domain: true + install-chrome-channel: beta + working_directory: ~/cypress + driver-integration-tests-chrome-inject-document-domain: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 5 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: medium+ steps: - - restore_cached_workspace - - run: yarn test-unit --scope=@packages/server - - sanitize-verify-and-store-mocha-results: - expectedResultCount: 1 - - server-unit-tests-cloud-environment: - <<: *defaults + - run-driver-integration-tests: + browser: chrome + inject-document-domain: true + install-chrome-channel: stable + working_directory: ~/cypress + driver-integration-tests-electron: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 5 parameters: - <<: *defaultsParameters - resource_class: - type: string - default: medium - resource_class: << parameters.resource_class >> - parallelism: 1 + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean steps: - - restore_cached_workspace - # TODO: Remove this once we switch off self-hosted M1 runners - - when: - condition: - equal: [ *darwin-arm64-executor, << parameters.executor >> ] - steps: - - run: rm -f /tmp/cypress/junit/* - # this is a temporary work around while we wait for circle to resolve issues with packages - # with an @ character in windows during save_cache. - # @see https://github.com/cypress-io/cypress/issues/30343 for more details. - - when: - condition: - equal: [ *windows-executor, << parameters.executor >> ] - steps: - - run: - name: reinstall dependencies to work around cache issue (Windows only) - command: rm -rf node_modules && yarn - - run: yarn workspace @packages/server test-unit cloud/environment_spec.ts - - sanitize-verify-and-store-mocha-results: - expectedResultCount: 1 - - server-integration-tests: - <<: *defaults - parallelism: 1 - steps: - - restore_cached_workspace - - install-browsers: - install-chrome: true - - run: yarn test-integration --scope=@packages/server - - sanitize-verify-and-store-mocha-results: - expectedResultCount: 1 - - server-performance-tests: - <<: *defaults - steps: - - restore_cached_workspace - - install-browsers: - install-chrome: true - install-firefox: true - - run: - command: yarn workspace @packages/server test-performance - - sanitize-verify-and-store-mocha-results: - expectedResultCount: 1 - - system-tests-node-modules-install: - <<: *defaults + - run-driver-integration-tests: + browser: electron + working_directory: ~/cypress + driver-integration-tests-firefox: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 5 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: medium+ steps: - - restore_cached_workspace - - update_cached_system_tests_deps - - binary-system-tests: - parallelism: 2 + - run-driver-integration-tests: + browser: firefox working_directory: ~/cypress + driver-integration-tests-webkit: environment: - <<: *defaultsEnvironment - PLATFORM: linux - machine: - # using `machine` gives us a Linux VM that can run Docker - image: ubuntu-2004:2024.05.1 - docker_layer_caching: true - resource_class: medium + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 5 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: large steps: - - maybe_skip_binary_jobs - - run-binary-system-tests - yarn-pnp-preprocessor-system-test: - parallelism: 1 + - run-driver-integration-tests: + browser: webkit + inject-document-domain: true working_directory: ~/cypress - docker: - # we need an image with yarn 4 berry installed on it to run this test - - image: cypress/base-internal:22.18.0-yarn-berry + get-published-artifacts: environment: - # needed to inform the bootstrap-docker-container.sh script to link the binary in the system-test project directory - REPO_DIR: /root/cypress - TEST_PROJECT_DIR: ./system-tests/projects/yarn-v4.3.1-pnp-dep-resolution - USE_YARN_TO_INSTALL_CYPRESS_BINARY: true + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: + default: medium + type: string + resource_class: << parameters.resource_class >> steps: - maybe_skip_binary_jobs - - attach_workspace: - at: ~/ - # required node is set in the docker container already with yarn 4 - - run: - name: Install monorepo dependencies with yarn v1.22.22 - command: | - # we need to install the monorepo dependencies here in a fresh manner. - # set to the expected version of yarn and install the dependencies - yarn set version 1.22.22 - yarn install --ignore-scripts + - restore_cached_workspace - run: - name: install dependencies in yarn-v4.3.1-pnp-dep-resolution with yarn berry - 4.3.1 - command: | - yarn set version 4.3.1 - cd ./system-tests/projects/yarn-v4.3.1-pnp-dep-resolution && yarn + command: cat ~/triggered_pipeline.json + name: Check pipeline info + - setup_should_persist_artifacts - run: - name: Bootstrap the Cypress binary and run binary system test command: | - # we need to bootstrap the binary into our project directory and run the tests - source ./system-tests/scripts/bootstrap-docker-container.sh 'yarn cypress run' - # We can remove this job a once https://github.com/sveltejs/svelte-loader/issues/243 is resolved. - svelte-webpack-system-test: - parallelism: 1 + source ./scripts/ensure-node.sh + node ./scripts/binary/get-published-artifacts.js --pipelineInfo ~/triggered_pipeline.json --platformKey $(node ./scripts/get-platform-key.js) + name: Download binary artifacts + - persist_to_workspace: + paths: + - cypress/cypress.zip + - cypress/cypress.tgz + root: ~/ + - verify_should_persist_artifacts + - persist_to_workspace: + paths: + - cypress/binary-url.json + - cypress/npm-package-url.json + root: ~/ + - post-install-comment: + binary_url_path: ~/cypress/binary-url.json + package_url_path: ~/cypress/npm-package-url.json working_directory: ~/cypress - docker: - - image: cypress/base-internal:22.18.0-bullseye + lint: environment: - # needed to inform the bootstrap-docker-container.sh script to link the binary in the system-test project directory - REPO_DIR: /root/cypress - TEST_PROJECT_DIR: ./system-tests/projects/svelte-webpack-configured - USE_YARN_TO_INSTALL_CYPRESS_BINARY: true + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean steps: - - maybe_skip_binary_jobs - - attach_workspace: - at: ~/ - - run: - name: Install monorepo dependencies - command: yarn install --ignore-scripts - - run: - name: install dependencies - command: cd ./system-tests/projects/svelte-webpack-configured && yarn + - restore_cached_workspace - run: - name: Bootstrap the Cypress binary and run binary system test command: | - # we need to bootstrap the binary into our project directory and run the tests - source ./system-tests/scripts/bootstrap-docker-container.sh 'yarn cypress run --component --spec src/mount.cy.ts src/App.cy.ts' - - system-tests-chrome: - <<: *defaults - resource_class: medium+ - parallelism: 8 - steps: - - run-system-tests: - browser: chrome - - system-tests-electron: - <<: *defaults - resource_class: medium+ - parallelism: 8 - steps: - - run-system-tests: - browser: electron - - system-tests-firefox: - <<: *defaults - resource_class: medium+ - parallelism: 8 - steps: - - run-system-tests: - browser: firefox - - system-tests-webkit: - <<: *defaults - resource_class: medium+ - parallelism: 8 - steps: - - run-system-tests: - browser: webkit - - system-tests-non-root: - <<: *defaults - steps: - - restore_cached_workspace + yarn clean + git clean -df + yarn lint + name: "Linting 🧹" - run: - environment: - CYPRESS_COMMERCIAL_RECOMMENDATIONS: '0' - command: yarn workspace @tooling/system-tests test:ci "test/non_root*spec*" - --browser electron - - sanitize-verify-and-store-mocha-results - - run-frontend-shared-component-tests-chrome: - <<: *defaults + command: node cli/bin/cypress info --dev + name: cypress info (dev) + working_directory: ~/cypress + lint-types: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 parameters: - <<: *defaultsParameters - percy: - type: boolean + executor: + default: cy-doc + type: executor + only-cache-for-root-user: default: false - parallelism: 3 + type: boolean steps: - - run-new-ui-tests: - browser: chrome - executor: << parameters.executor >> - percy: << parameters.percy >> - package: frontend-shared - type: ct - - run-launchpad-component-tests-chrome: - <<: *defaults + - restore_cached_workspace + - run: + command: ls -la types + working_directory: cli + - run: + command: ls -la chai + working_directory: cli/types + - run: + command: yarn workspace cypress dtslint + name: "Lint types 🧹" + working_directory: ~/cypress + node_modules_install: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 parameters: - <<: *defaultsParameters - percy: + build-better-sqlite3: + default: false type: boolean + executor: + default: cy-doc + type: executor + only-cache-for-root-user: default: false - parallelism: 7 - steps: - - run-new-ui-tests: - browser: chrome - executor: << parameters.executor >> - percy: << parameters.percy >> - package: launchpad - type: ct - # debug: cypress:*,engine:socket - - run-launchpad-integration-tests-chrome: - <<: *defaults - parameters: - <<: *defaultsParameters + type: boolean resource_class: + default: medium type: string - default: large - percy: - type: boolean - default: false resource_class: << parameters.resource_class >> - parallelism: 3 steps: - - run-new-ui-tests: - browser: chrome + - update_known_hosts + - checkout + - install-required-node + - verify-build-setup: executor: << parameters.executor >> - percy: << parameters.percy >> - package: launchpad - type: e2e - - run-app-component-tests-chrome: - <<: *defaults + - persist_to_workspace: + paths: + - cypress + - .ssh + - .nvm + - ProgramData/nvm + root: ~/ + - caching-dependency-installer: + build-better-sqlite3: <> + only-cache-for-root-user: <> + working_directory: ~/cypress + npm-angular: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 parameters: - <<: *defaultsParameters - resource_class: - type: string - default: medium+ - percy: - type: boolean + executor: + default: cy-doc + type: executor + only-cache-for-root-user: default: false - parallelism: 7 - steps: - - run-new-ui-tests: - browser: chrome - executor: << parameters.executor >> - percy: << parameters.percy >> - package: app - type: ct - - run-app-integration-tests-chrome: - <<: *defaults - parameters: - <<: *defaultsParameters - resource_class: - type: string - default: large - percy: type: boolean - default: false - resource_class: << parameters.resource_class >> - parallelism: 8 - steps: - - run-new-ui-tests: - browser: chrome - executor: << parameters.executor >> - percy: << parameters.percy >> - package: app - type: e2e - - driver-integration-tests-chrome: - <<: *defaults - parallelism: 5 - resource_class: medium+ - steps: - - run-driver-integration-tests: - browser: chrome - install-chrome-channel: stable - - driver-integration-tests-chrome-inject-document-domain: - <<: *defaults - parallelism: 5 - resource_class: medium+ - steps: - - run-driver-integration-tests: - browser: chrome - install-chrome-channel: stable - inject-document-domain: true - - driver-integration-tests-chrome-beta: - <<: *defaults - resource_class: medium+ - parallelism: 5 - steps: - - run-driver-integration-tests: - browser: chrome:beta - install-chrome-channel: beta - - driver-integration-tests-chrome-beta-inject-document-domain: - <<: *defaults - resource_class: medium+ - parallelism: 5 - steps: - - run-driver-integration-tests: - browser: chrome:beta - install-chrome-channel: beta - inject-document-domain: true - - driver-integration-tests-firefox: - <<: *defaults - resource_class: medium+ - parallelism: 5 steps: - - run-driver-integration-tests: - browser: firefox - - driver-integration-tests-electron: - <<: *defaults - parallelism: 5 - steps: - - run-driver-integration-tests: - browser: electron - - driver-integration-tests-webkit: - <<: *defaults - resource_class: large - parallelism: 5 - steps: - - run-driver-integration-tests: - browser: webkit - # inject document domain must be true for webkit, as cy.origin is not supported - inject-document-domain: true - - run-reporter-component-tests-chrome: - <<: *defaults + - restore_cached_workspace + - run: + command: yarn lerna run build --scope=@cypress/angular + name: Build + working_directory: ~/cypress + npm-cypress-schematic: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 parameters: - <<: *defaultsParameters - percy: - type: boolean + executor: + default: cy-doc + type: executor + only-cache-for-root-user: default: false - parallelism: 2 - steps: - - run-new-ui-tests: - browser: chrome - executor: << parameters.executor >> - percy: << parameters.percy >> - package: reporter - type: ct - - reporter-integration-tests: - <<: *defaults - resource_class: medium+ - parallelism: 3 + type: boolean steps: - restore_cached_workspace - run: - command: yarn build-for-tests - working_directory: packages/reporter + command: | + yarn lerna run build --scope=@cypress/schematic + name: Build + Install - run: command: | - CYPRESS_CONFIG_ENV=production \ - CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ - PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ - PERCY_ENABLE=${PERCY_TOKEN:-0} \ - PERCY_PARALLEL_TOTAL=-1 \ - yarn percy exec --parallel -- -- \ - yarn cypress:run --record --parallel --group reporter --runner-ui - working_directory: packages/reporter - - sanitize-verify-and-store-mocha-results - - run-webpack-dev-server-integration-tests: - <<: *defaults - resource_class: medium+ - parallelism: 2 + yarn test + name: Run unit tests + working_directory: npm/cypress-schematic + working_directory: ~/cypress + npm-eslint-plugin-dev: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean steps: - restore_cached_workspace - - restore_cached_system_tests_deps - - install-browsers: - install-chrome: true - run: - command: | - CYPRESS_CONFIG_ENV=production \ - CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ - PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ - PERCY_ENABLE=${PERCY_TOKEN:-0} \ - PERCY_PARALLEL_TOTAL=-1 \ - yarn percy exec --parallel -- -- \ - yarn cypress:run --record --parallel --group webpack-dev-server - working_directory: npm/webpack-dev-server - - sanitize-verify-and-store-mocha-results - - run-vite-dev-server-integration-tests: - <<: *defaults - # parallelism: 3 TODO: Add parallelism once we have more specs + command: yarn workspace @cypress/eslint-plugin-dev test + name: Run tests + working_directory: ~/cypress + npm-grep: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: small steps: - restore_cached_workspace - - restore_cached_system_tests_deps - - install-browsers: - install-chrome: true - run: - command: | - CYPRESS_CONFIG_ENV=production \ - CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ - PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ - PERCY_ENABLE=${PERCY_TOKEN:-0} \ - PERCY_PARALLEL_TOTAL=-1 \ - yarn percy exec --parallel -- -- \ - yarn cypress:run --record --parallel --group vite-dev-server - working_directory: npm/vite-dev-server - - sanitize-verify-and-store-mocha-results - - npm-webpack-preprocessor: - <<: *defaults + command: yarn workspace @cypress/grep cy:run + name: Run tests + - sanitize-verify-and-store-mocha-results: + testResultsPath: npm/grep/test_results + working_directory: ~/cypress + npm-mount-utils: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean steps: - restore_cached_workspace - run: + command: yarn lerna run build --scope=@cypress/mount-utils name: Build - command: yarn lerna run build --scope=@cypress/webpack-preprocessor - - run: - name: Run tests - command: yarn workspace @cypress/webpack-preprocessor test - - npm-webpack-dev-server: - <<: *defaults + working_directory: ~/cypress + npm-puppeteer-cypress-tests: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: small steps: - restore_cached_workspace - restore_cached_system_tests_deps + - install-browsers: + install-chrome: true - run: - name: Run tests - command: yarn workspace @cypress/webpack-dev-server test - - run: - name: Run tests - command: yarn workspace @cypress/webpack-dev-server test - - npm-vite-dev-server: - <<: *defaults - steps: - - restore_cached_workspace - - run: - name: Run tests - command: yarn test - working_directory: npm/vite-dev-server - - sanitize-verify-and-store-mocha-results: - testResultsPath: npm/vite-dev-server/test_results - - npm-webpack-batteries-included-preprocessor: - <<: *defaults - resource_class: small - steps: - - restore_cached_workspace - - run: - name: Run tests - command: yarn workspace @cypress/webpack-batteries-included-preprocessor test - - npm-vue: - <<: *defaults + command: yarn cypress:run + working_directory: npm/puppeteer + - sanitize-verify-and-store-mocha-results + working_directory: ~/cypress + npm-puppeteer-unit-tests: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean steps: - restore_cached_workspace - run: + command: yarn lerna run build --scope=@cypress/puppeteer name: Build - command: yarn lerna run build --scope=@cypress/vue - run: - name: Run tests command: yarn test - working_directory: npm/vue + name: Run tests + working_directory: npm/puppeteer - sanitize-verify-and-store-mocha-results: - testResultsPath: npm/vue/test_results - - npm-angular: - <<: *defaults - steps: - - restore_cached_workspace - - run: - name: Build - command: yarn lerna run build --scope=@cypress/angular - - npm-puppeteer-unit-tests: - <<: *defaults + testResultsPath: npm/puppeteer/test_results + working_directory: ~/cypress + npm-react: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean steps: - restore_cached_workspace - run: + command: yarn lerna run build --scope=@cypress/react name: Build - command: yarn lerna run build --scope=@cypress/puppeteer - run: - name: Run tests command: yarn test - working_directory: npm/puppeteer + name: Run tests + working_directory: npm/react - sanitize-verify-and-store-mocha-results: - testResultsPath: npm/puppeteer/test_results - - npm-puppeteer-cypress-tests: - <<: *defaults - resource_class: small + testResultsPath: npm/react/test_results + working_directory: ~/cypress + npm-release: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: medium+ steps: - restore_cached_workspace - - restore_cached_system_tests_deps - - install-browsers: - install-chrome: true - run: - command: yarn cypress:run - working_directory: npm/puppeteer - - sanitize-verify-and-store-mocha-results - - npm-react: - <<: *defaults + command: yarn npm-release + name: Release packages after all jobs pass + working_directory: ~/cypress + npm-vite-dev-server: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean steps: - restore_cached_workspace - run: - name: Build - command: yarn lerna run build --scope=@cypress/react - - run: - name: Run tests command: yarn test - working_directory: npm/react + name: Run tests + working_directory: npm/vite-dev-server - sanitize-verify-and-store-mocha-results: - testResultsPath: npm/react/test_results - + testResultsPath: npm/vite-dev-server/test_results + working_directory: ~/cypress npm-vite-plugin-cypress-esm: - <<: *defaults + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean steps: - restore_cached_workspace - run: - name: Build command: yarn lerna run build --scope=@cypress/vite-plugin-cypress-esm + name: Build - run: - name: Run tests command: yarn test + name: Run tests working_directory: npm/vite-plugin-cypress-esm - sanitize-verify-and-store-mocha-results: testResultsPath: npm/vite-plugin-cypress-esm/test_results - - npm-mount-utils: - <<: *defaults + working_directory: ~/cypress + npm-vue: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean steps: - restore_cached_workspace - run: + command: yarn lerna run build --scope=@cypress/vue name: Build - command: yarn lerna run build --scope=@cypress/mount-utils - - npm-grep: - <<: *defaults - resource_class: small - steps: - - restore_cached_workspace - run: + command: yarn test name: Run tests - command: yarn workspace @cypress/grep cy:run + working_directory: npm/vue - sanitize-verify-and-store-mocha-results: - testResultsPath: npm/grep/test_results - - npm-eslint-plugin-dev: - <<: *defaults + testResultsPath: npm/vue/test_results + working_directory: ~/cypress + npm-webpack-batteries-included-preprocessor: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: small steps: - restore_cached_workspace - run: + command: yarn workspace @cypress/webpack-batteries-included-preprocessor test name: Run tests - command: yarn workspace @cypress/eslint-plugin-dev test - - npm-cypress-schematic: - <<: *defaults + working_directory: ~/cypress + npm-webpack-dev-server: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean steps: - restore_cached_workspace + - restore_cached_system_tests_deps - run: - name: Build + Install - command: | - yarn lerna run build --scope=@cypress/schematic + command: yarn workspace @cypress/webpack-dev-server test + name: Run tests - run: - name: Run unit tests - command: | - yarn test - working_directory: npm/cypress-schematic - - npm-release: - <<: *defaults - resource_class: medium+ + command: yarn workspace @cypress/webpack-dev-server test + name: Run tests + working_directory: ~/cypress + npm-webpack-preprocessor: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean steps: - restore_cached_workspace - run: - name: Release packages after all jobs pass - command: yarn npm-release - - create-build-artifacts: - <<: *defaults + command: yarn lerna run build --scope=@cypress/webpack-preprocessor + name: Build + - run: + command: yarn workspace @cypress/webpack-preprocessor test + name: Run tests + working_directory: ~/cypress + percy-finalize: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 parameters: - <<: *defaultsParameters - resource_class: - type: string - default: xlarge - resource_class: << parameters.resource_class >> + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + required_env_var: + type: env_var_name + resource_class: small steps: - restore_cached_workspace - # this is a temporary work around while we wait for circle to resolve issues with packages - # with an @ character in windows during save_cache. - # @see https://github.com/cypress-io/cypress/issues/30343 for more details. - - when: - condition: - equal: [ *windows-executor, << parameters.executor >> ] - steps: - - run: - name: reinstall dependencies to work around cache issue (Windows only) - command: rm -rf node_modules && yarn - - check-if-binary-exists - - build-and-package-binary - - build-cypress-npm-package: - executor: << parameters.executor >> - - setup_should_persist_artifacts - - verify_should_persist_artifacts - - upload-build-artifacts - - post-install-comment - - create-and-trigger-packaging-artifacts: - <<: *defaults - parameters: - <<: *defaultsParameters - resource_class: + - run: + command: | + if [[ -v <> ]]; then + echo "Internal PR, good to go" + else + echo "This is an external PR, cannot access other services" + circleci-agent step halt + fi + name: Check if <> is set + - run: + command: | + PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ + yarn percy build:finalize || yarn percy build:finalize + name: Finalize percy build - allows single retry + working_directory: ~/cypress + ready-to-release: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: small + steps: + - run: + command: echo 'Ready to release' + name: Ready to release + working_directory: ~/cypress + reporter-integration-tests: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 3 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: medium+ + steps: + - restore_cached_workspace + - run: + command: yarn build-for-tests + working_directory: packages/reporter + - run: + command: | + CYPRESS_CONFIG_ENV=production \ + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ + PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ + PERCY_ENABLE=${PERCY_TOKEN:-0} \ + PERCY_PARALLEL_TOTAL=-1 \ + yarn percy exec --parallel -- -- \ + yarn cypress:run --record --parallel --group reporter --runner-ui + working_directory: packages/reporter + - sanitize-verify-and-store-mocha-results + working_directory: ~/cypress + run-app-component-tests-chrome: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 7 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + percy: + default: false + type: boolean + resource_class: + default: medium+ + type: string + steps: + - run-new-ui-tests: + browser: chrome + executor: << parameters.executor >> + package: app + percy: << parameters.percy >> + type: ct + working_directory: ~/cypress + run-app-integration-tests-chrome: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 8 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + percy: + default: false + type: boolean + resource_class: + default: large type: string - default: small resource_class: << parameters.resource_class >> steps: - - maybe_skip_binary_jobs - - restore_cached_workspace - - check-if-binary-exists - - setup_should_persist_artifacts - - trigger-publish-binary-pipeline - - get-published-artifacts: - <<: *defaults + - run-new-ui-tests: + browser: chrome + executor: << parameters.executor >> + package: app + percy: << parameters.percy >> + type: e2e + working_directory: ~/cypress + run-frontend-shared-component-tests-chrome: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 3 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + percy: + default: false + type: boolean + steps: + - run-new-ui-tests: + browser: chrome + executor: << parameters.executor >> + package: frontend-shared + percy: << parameters.percy >> + type: ct + working_directory: ~/cypress + run-launchpad-component-tests-chrome: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 7 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + percy: + default: false + type: boolean + steps: + - run-new-ui-tests: + browser: chrome + executor: << parameters.executor >> + package: launchpad + percy: << parameters.percy >> + type: ct + working_directory: ~/cypress + run-launchpad-integration-tests-chrome: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 3 parameters: - <<: *defaultsParameters + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + percy: + default: false + type: boolean resource_class: + default: large type: string - default: medium resource_class: << parameters.resource_class >> steps: - - maybe_skip_binary_jobs + - run-new-ui-tests: + browser: chrome + executor: << parameters.executor >> + package: launchpad + percy: << parameters.percy >> + type: e2e + working_directory: ~/cypress + run-reporter-component-tests-chrome: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 2 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + percy: + default: false + type: boolean + steps: + - run-new-ui-tests: + browser: chrome + executor: << parameters.executor >> + package: reporter + percy: << parameters.percy >> + type: ct + working_directory: ~/cypress + run-vite-dev-server-integration-tests: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: - restore_cached_workspace + - restore_cached_system_tests_deps + - install-browsers: + install-chrome: true - run: - name: Check pipeline info - command: cat ~/triggered_pipeline.json - - setup_should_persist_artifacts + command: | + CYPRESS_CONFIG_ENV=production \ + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ + PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ + PERCY_ENABLE=${PERCY_TOKEN:-0} \ + PERCY_PARALLEL_TOTAL=-1 \ + yarn percy exec --parallel -- -- \ + yarn cypress:run --record --parallel --group vite-dev-server + working_directory: npm/vite-dev-server + - sanitize-verify-and-store-mocha-results + working_directory: ~/cypress + run-webpack-dev-server-integration-tests: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 2 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: medium+ + steps: + - restore_cached_workspace + - restore_cached_system_tests_deps + - install-browsers: + install-chrome: true - run: - name: Download binary artifacts command: | - source ./scripts/ensure-node.sh - node ./scripts/binary/get-published-artifacts.js --pipelineInfo ~/triggered_pipeline.json --platformKey $(node ./scripts/get-platform-key.js) - - persist_to_workspace: - root: ~/ - paths: - - cypress/cypress.zip - - cypress/cypress.tgz - - verify_should_persist_artifacts - - persist_to_workspace: - root: ~/ - paths: - - cypress/binary-url.json - - cypress/npm-package-url.json - - post-install-comment: - package_url_path: ~/cypress/npm-package-url.json - binary_url_path: ~/cypress/binary-url.json - + CYPRESS_CONFIG_ENV=production \ + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \ + PERCY_PARALLEL_NONCE=$CIRCLE_WORKFLOW_WORKSPACE_ID \ + PERCY_ENABLE=${PERCY_TOKEN:-0} \ + PERCY_PARALLEL_TOTAL=-1 \ + yarn percy exec --parallel -- -- \ + yarn cypress:run --record --parallel --group webpack-dev-server + working_directory: npm/webpack-dev-server + - sanitize-verify-and-store-mocha-results + working_directory: ~/cypress + server-integration-tests: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - restore_cached_workspace + - install-browsers: + install-chrome: true + - run: yarn test-integration --scope=@packages/server + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 1 + working_directory: ~/cypress + server-performance-tests: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - restore_cached_workspace + - install-browsers: + install-chrome: true + install-firefox: true + - run: + command: yarn workspace @packages/server test-performance + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 1 + working_directory: ~/cypress + server-unit-tests: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - restore_cached_workspace + - run: yarn test-unit --scope=@packages/server + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 1 + working_directory: ~/cypress + server-unit-tests-cloud-environment: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: + default: medium + type: string + resource_class: << parameters.resource_class >> + steps: + - restore_cached_workspace + - when: + condition: + equal: + - environment: + PLATFORM: darwin + machine: true + - << parameters.executor >> + steps: + - run: rm -f /tmp/cypress/junit/* + - when: + condition: + equal: + - environment: + PLATFORM: windows + machine: + image: windows-server-2022-gui:stable + shell: bash.exe -eo pipefail + resource_class: windows.large + - << parameters.executor >> + steps: + - run: + command: rm -rf node_modules && yarn + name: reinstall dependencies to work around cache issue (Windows only) + - run: yarn workspace @packages/server test-unit cloud/environment_spec.ts + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 1 + working_directory: ~/cypress + svelte-webpack-system-test: + docker: + - image: cypress/base-internal:22.18.0-bullseye + environment: + REPO_DIR: /root/cypress + TEST_PROJECT_DIR: ./system-tests/projects/svelte-webpack-configured + USE_YARN_TO_INSTALL_CYPRESS_BINARY: true + parallelism: 1 + steps: + - maybe_skip_binary_jobs + - attach_workspace: + at: ~/ + - run: + command: yarn install --ignore-scripts + name: Install monorepo dependencies + - run: + command: cd ./system-tests/projects/svelte-webpack-configured && yarn + name: install dependencies + - run: + command: | + # we need to bootstrap the binary into our project directory and run the tests + source ./system-tests/scripts/bootstrap-docker-container.sh 'yarn cypress run --component --spec src/mount.cy.ts src/App.cy.ts' + name: Bootstrap the Cypress binary and run binary system test + working_directory: ~/cypress + system-tests-chrome: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 8 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: medium+ + steps: + - run-system-tests: + browser: chrome + working_directory: ~/cypress + system-tests-electron: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 8 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: medium+ + steps: + - run-system-tests: + browser: electron + working_directory: ~/cypress + system-tests-firefox: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 8 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: medium+ + steps: + - run-system-tests: + browser: firefox + working_directory: ~/cypress + system-tests-node-modules-install: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - restore_cached_workspace + - update_cached_system_tests_deps + working_directory: ~/cypress + system-tests-non-root: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - restore_cached_workspace + - run: + command: yarn workspace @tooling/system-tests test:ci "test/non_root*spec*" + --browser electron + environment: + CYPRESS_COMMERCIAL_RECOMMENDATIONS: "0" + - sanitize-verify-and-store-mocha-results + working_directory: ~/cypress + system-tests-webkit: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 8 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: medium+ + steps: + - run-system-tests: + browser: webkit + working_directory: ~/cypress + test-against-staging: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - restore_cached_workspace + - clone-repo-and-checkout-branch: + repo: cypress-test-tiny + - run: + command: | + CYPRESS_PROJECT_ID=$TEST_TINY_PROJECT_ID \ + CYPRESS_RECORD_KEY=$TEST_TINY_RECORD_KEY \ + CYPRESS_INTERNAL_ENV=staging \ + yarn cypress:run --project /tmp/cypress-test-tiny --record + name: Run test project + working_directory: ~/cypress + test-binary-against-cypress-realworld-app: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: medium+ + steps: + - test-binary-against-rwa: + browser: chrome + repo: cypress-realworld-app + working_directory: ~/cypress + test-binary-against-kitchensink: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - maybe_skip_binary_jobs + - test-binary-against-repo: + browser: electron + repo: cypress-example-kitchensink + working_directory: ~/cypress + test-binary-against-kitchensink-chrome: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - test-binary-against-repo: + browser: chrome + executor: << parameters.executor >> + repo: cypress-example-kitchensink + working_directory: ~/cypress + test-binary-against-kitchensink-firefox: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - test-binary-against-repo: + browser: firefox + repo: cypress-example-kitchensink + working_directory: ~/cypress + test-binary-against-recipes: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 4 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - test-binary-against-repo: + browser: electron + command: npm run test:ci -- --chunk $CIRCLE_NODE_INDEX --total-chunks + $CIRCLE_NODE_TOTAL + repo: cypress-example-recipes + working_directory: ~/cypress + test-binary-against-recipes-chrome: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - test-binary-against-repo: + browser: chrome + command: npm run test:ci:chrome + repo: cypress-example-recipes + working_directory: ~/cypress + test-binary-against-recipes-firefox: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - test-binary-against-repo: + browser: firefox + command: npm run test:ci:firefox + repo: cypress-example-recipes + working_directory: ~/cypress + test-binary-against-staging: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - restore_workspace_binaries + - clone-repo-and-checkout-branch: + repo: cypress-test-tiny + - run: + command: CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i --legacy-peer-deps + ~/cypress/cypress.tgz + name: Install Cypress + working_directory: /tmp/cypress-test-tiny + - run: + command: | + CYPRESS_PROJECT_ID=$TEST_TINY_PROJECT_ID \ + CYPRESS_RECORD_KEY=$TEST_TINY_RECORD_KEY \ + CYPRESS_INTERNAL_ENV=staging \ + $(yarn bin cypress) run --record + name: Run test project + working_directory: /tmp/cypress-test-tiny + working_directory: ~/cypress + test-binary-against-todomvc-firefox: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - test-binary-against-repo: + browser: firefox + repo: cypress-example-todomvc + working_directory: ~/cypress + test-binary-as-specific-user: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + steps: + - maybe_skip_binary_jobs + - restore_workspace_binaries + - clone-repo-and-checkout-branch: + repo: cypress-test-tiny + - run: whoami + - run: pwd + - run: node -e 'console.log(process.geteuid())' + - run: ls -l + - run: ls -l cypress.zip cypress.tgz + - run: + command: CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i + ~/cypress/cypress.tgz + name: Install Cypress + working_directory: /tmp/cypress-test-tiny + - run: + command: $(yarn bin cypress) help + name: Cypress help + working_directory: /tmp/cypress-test-tiny + - run: + command: $(yarn bin cypress) info + name: Cypress info + working_directory: /tmp/cypress-test-tiny + - run: + command: DEBUG=cypress:cli $(yarn bin cypress) verify + name: Verify Cypress binary + working_directory: /tmp/cypress-test-tiny + - run: + command: DEBUG=cypress:cli $(yarn bin cypress) run + name: Run Cypress binary + working_directory: /tmp/cypress-test-tiny + working_directory: ~/cypress + test-full-typescript-project: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + description: Executor name to use + type: executor + resource_class: small + steps: + - maybe_skip_binary_jobs + - restore_workspace_binaries + - clone-repo-and-checkout-branch: + repo: cypress-test-tiny + - run: + command: | + git checkout full-typescript + name: Checkout Typescript Example + working_directory: /tmp/cypress-test-tiny + - run: + command: | + npm install /root/cypress/cypress.tgz typescript + environment: + CYPRESS_INSTALL_BINARY: /root/cypress/cypress.zip + name: "Install dependencies 📦" + working_directory: /tmp/cypress-test-tiny + - run: + command: npm run cypress:run + name: "Run project tests 🗳" + working_directory: /tmp/cypress-test-tiny + working_directory: ~/cypress test-kitchensink: - <<: *defaults + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 parameters: - <<: *defaultsParameters + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean resource_class: - type: string default: medium+ + type: string resource_class: << parameters.resource_class >> steps: - restore_cached_workspace @@ -2542,1383 +3200,1938 @@ jobs: repo: cypress-example-kitchensink - install-required-node - run: - name: Install prod dependencies command: yarn --production --ignore-engines + name: Install prod dependencies working_directory: /tmp/cypress-example-kitchensink - run: - name: Example server + background: true command: yarn start + name: Example server working_directory: /tmp/cypress-example-kitchensink - background: true - run: - name: Run Kitchensink example project command: | yarn cypress:run --project /tmp/cypress-example-kitchensink - + name: Run Kitchensink example project + working_directory: ~/cypress test-kitchensink-against-staging: - <<: *defaults + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean steps: - restore_cached_workspace - clone-repo-and-checkout-branch: repo: cypress-example-kitchensink - install-required-node - run: - name: Install prod dependencies command: yarn --production + name: Install prod dependencies working_directory: /tmp/cypress-example-kitchensink - run: - name: Example server + background: true command: yarn start + name: Example server working_directory: /tmp/cypress-example-kitchensink - background: true - run: - name: Run Kitchensink example project command: | source ./scripts/ensure-node.sh CYPRESS_PROJECT_ID=$TEST_KITCHENSINK_PROJECT_ID \ CYPRESS_RECORD_KEY=$TEST_KITCHENSINK_RECORD_KEY \ CYPRESS_INTERNAL_ENV=staging \ yarn cypress:run --project /tmp/cypress-example-kitchensink --record - - test-against-staging: - <<: *defaults - steps: - - restore_cached_workspace - - clone-repo-and-checkout-branch: - repo: cypress-test-tiny - - run: - name: Run test project - command: | - CYPRESS_PROJECT_ID=$TEST_TINY_PROJECT_ID \ - CYPRESS_RECORD_KEY=$TEST_TINY_RECORD_KEY \ - CYPRESS_INTERNAL_ENV=staging \ - yarn cypress:run --project /tmp/cypress-test-tiny --record - + name: Run Kitchensink example project + working_directory: ~/cypress test-npm-module-and-verify-binary: - <<: *defaults + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean resource_class: small steps: - restore_cached_workspace - # make sure we have cypress.zip received - run: ls -l - run: ls -l cypress.zip cypress.tgz - run: mkdir test-binary - run: + command: npm init -y name: Create new NPM package working_directory: test-binary - command: npm init -y - run: - # install NPM from built NPM package folder - name: Install Cypress - working_directory: test-binary - # force installing the freshly built binary command: CYPRESS_INSTALL_BINARY=/root/cypress/cypress.zip npm i /root/cypress/cypress.tgz + name: Install Cypress + working_directory: test-binary - run: + command: $(yarn bin cypress) version name: Cypress version working_directory: test-binary - command: $(yarn bin cypress) version - run: + command: $(yarn bin cypress) verify name: Verify Cypress binary working_directory: test-binary - command: $(yarn bin cypress) verify - run: + command: $(yarn bin cypress) help name: Cypress help working_directory: test-binary - command: $(yarn bin cypress) help - run: + command: $(yarn bin cypress) info name: Cypress info working_directory: test-binary - command: $(yarn bin cypress) info - + working_directory: ~/cypress test-npm-module-on-minimum-node-version: - <<: *defaults - resource_class: small docker: - - image: cypress/base-internal:22.18.0 + - image: cypress/base-internal:22.15.1 + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: small steps: - maybe_skip_binary_jobs - restore_workspace_binaries - run: mkdir test-binary - run: + command: npm init -y name: Create new NPM package working_directory: test-binary - command: npm init -y - run: - name: Install Cypress - working_directory: test-binary command: CYPRESS_INSTALL_BINARY=/root/cypress/cypress.zip npm install /root/cypress/cypress.tgz + name: Install Cypress + working_directory: test-binary - run: + command: npx cypress verify name: Verify Cypress binary working_directory: test-binary - command: npx cypress verify - run: + command: npx cypress version name: Print Cypress version working_directory: test-binary - command: npx cypress version - run: + command: npx cypress info name: Cypress info working_directory: test-binary - command: npx cypress info - + working_directory: ~/cypress test-types-cypress-and-jest: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + description: Executor name to use + type: executor + wd: + default: /root/test-cypress-and-jest + description: Working directory, should be OUTSIDE cypress monorepo folder + type: string + resource_class: small + steps: + - maybe_skip_binary_jobs + - restore_workspace_binaries + - run: mkdir <> + - run: + command: npm init -y + name: Create new NPM package ⚗️ + working_directory: <> + - run: + command: | + npm install /root/cypress/cypress.tgz \ + typescript @types/jest enzyme @types/enzyme + environment: + CYPRESS_INSTALL_BINARY: /root/cypress/cypress.zip + name: "Install dependencies 📦" + working_directory: <> + - run: + command: | + echo "console.log('hello world')" > hello.ts + npx tsc hello.ts --noEmit + name: Test types clash ⚔️ + working_directory: <> + working_directory: ~/cypress + unit-tests: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: linux-x64 + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: + default: medium + type: string + resource_class: << parameters.resource_class >> + steps: + - restore_cached_workspace + - install-browsers: + executor: << parameters.executor >> + install-chrome: true + - when: + condition: + equal: + - environment: + PLATFORM: windows + machine: + image: windows-server-2022-gui:stable + shell: bash.exe -eo pipefail + resource_class: windows.large + - << parameters.executor >> + steps: + - run: yarn test-scripts scripts/**/*spec.js + - sanitize-verify-and-store-mocha-results + - unless: + condition: + equal: + - environment: + PLATFORM: windows + machine: + image: windows-server-2022-gui:stable + shell: bash.exe -eo pipefail + resource_class: windows.large + - << parameters.executor >> + steps: + - run: + command: | + cat \<<'EOF' | sudo tee /etc/docker/daemon.json + { + "ipv6": true, + "fixed-cidr-v6": "2001:db8:1::/64" + } + EOF + cat \<<'EOF' | sudo tee /etc/hosts + 127.0.0.1 localhost + ::1 localhost + EOF + sudo service docker restart + name: Enable IPv6 in Docker + - run: + command: | + source ./scripts/ensure-node.sh + yarn test-scripts + name: Test scripts + - run: + command: | + source ./scripts/ensure-node.sh + # this is needed since we are have to be running as root to test some packages + sudo -E env "PATH=$PATH" yarn test + name: Test each individual package + - run: + command: | + source ./scripts/ensure-node.sh + yarn lerna run types + name: Test types + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 18 + working_directory: ~/cypress + v8-integration-tests: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 + parameters: + executor: + default: cy-doc + type: executor + only-cache-for-root-user: + default: false + type: boolean + resource_class: + default: medium + type: string + resource_class: << parameters.resource_class >> + steps: + - restore_cached_workspace + - restore_cached_system_tests_deps + - when: + condition: + equal: + - environment: + PLATFORM: windows + machine: + image: windows-server-2022-gui:stable + shell: bash.exe -eo pipefail + resource_class: windows.large + - << parameters.executor >> + steps: + - run: + command: rm -rf node_modules && yarn + name: reinstall dependencies to work around cache issue (Windows only) + - when: + condition: + equal: + - environment: + PLATFORM: darwin + machine: true + - << parameters.executor >> + steps: + - run: rm -f /tmp/cypress/junit/* + - unless: + condition: + or: + - equal: + - environment: + DISABLE_SNAPSHOT_REQUIRE: 1 + PLATFORM: linux + machine: + image: ubuntu-2004:2024.11.1 + resource_class: arm.medium + - << parameters.executor >> + steps: + - run: + command: | + source ./scripts/ensure-node.sh + yarn test-integration --scope=@tooling/{packherd,v8-snapshot,electron-mksnapshot} + name: Run v8 integration tests + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 3 + - when: + condition: + or: + - equal: + - environment: + DISABLE_SNAPSHOT_REQUIRE: 1 + PLATFORM: linux + machine: + image: ubuntu-2004:2024.11.1 + resource_class: arm.medium + - << parameters.executor >> + steps: + - run: + command: | + source ./scripts/ensure-node.sh + yarn test-integration --scope=@tooling/packherd + name: Run v8 integration tests + - sanitize-verify-and-store-mocha-results: + expectedResultCount: 1 + working_directory: ~/cypress + verify-accessibility-results: + environment: + CIRCLE_ARTIFACTS: /tmp/artifacts + COLUMNS: 100 + LINES: 24 + TZ: /usr/share/zoneinfo/America/New_York + executor: <> + parallelism: 1 parameters: executor: - description: Executor name to use - type: executor default: cy-doc - wd: - description: Working directory, should be OUTSIDE cypress monorepo folder - type: string - default: /root/test-cypress-and-jest - <<: *defaults + type: executor + only-cache-for-root-user: + default: false + type: boolean resource_class: small steps: - - maybe_skip_binary_jobs - - restore_workspace_binaries - - run: mkdir <> + - run: | + if [[ -z "$MAIN_RECORD_KEY" ]]; then + echo "skipping for contributor PRs since we don't record to the cloud" + circleci-agent step halt + fi + - update_known_hosts - run: - name: Create new NPM package ⚗️ - working_directory: <> - command: npm init -y + command: git clone -b "$CIRCLE_BRANCH" "$CIRCLE_REPOSITORY_URL" --depth 1 + name: checkout - run: - name: Install dependencies 📦 - working_directory: <> - environment: - CYPRESS_INSTALL_BINARY: /root/cypress/cypress.zip - # let's install Cypress, Jest and any other package that might conflict - # https://github.com/cypress-io/cypress/issues/6690 - - # Todo: Add `jest` back into the list once https://github.com/yargs/yargs-parser/issues/452 - # is resolved. command: | - npm install /root/cypress/cypress.tgz \ - typescript @types/jest enzyme @types/enzyme + npm install https://cdn.cypress.io/extract-cloud-results/v1/extract-cloud-results.tgz + name: Install extract-cloud-results package - run: - name: Test types clash ⚔️ - working_directory: <> command: | - echo "console.log('hello world')" > hello.ts - npx tsc hello.ts --noEmit - - test-full-typescript-project: + cp ./cypress/scripts/verify-accessibility-results.js verify-accessibility-results.js + CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY node verify-accessibility-results.js + name: Verify Accessibility Results + working_directory: ~/cypress + verify-release-readiness: + environment: + GITHUB_TOKEN: $GH_TOKEN + executor: <> + parallelism: 1 parameters: executor: - description: Executor name to use - type: executor default: cy-doc - <<: *defaults + type: executor + only-cache-for-root-user: + default: false + type: boolean resource_class: small + steps: + - restore_cached_workspace + - update_known_hosts + - run: yarn test-npm-package-release-script + - run: node ./scripts/semantic-commits/validate-binary-changelog.js + - store_artifacts: + path: /tmp/releaseData + working_directory: ~/cypress + yarn-pnp-preprocessor-system-test: + docker: + - image: cypress/base-internal:22.18.0-yarn-berry + environment: + REPO_DIR: /root/cypress + TEST_PROJECT_DIR: ./system-tests/projects/yarn-v4.3.1-pnp-dep-resolution + USE_YARN_TO_INSTALL_CYPRESS_BINARY: true + parallelism: 1 steps: - maybe_skip_binary_jobs - - restore_workspace_binaries - - clone-repo-and-checkout-branch: - repo: cypress-test-tiny + - attach_workspace: + at: ~/ - run: - name: Checkout Typescript Example - working_directory: /tmp/cypress-test-tiny command: | - git checkout full-typescript + # we need to install the monorepo dependencies here in a fresh manner. + # set to the expected version of yarn and install the dependencies + yarn set version 1.22.22 + yarn install --ignore-scripts + name: Install monorepo dependencies with yarn v1.22.22 - run: - name: Install dependencies 📦 - working_directory: /tmp/cypress-test-tiny - environment: - CYPRESS_INSTALL_BINARY: /root/cypress/cypress.zip command: | - npm install /root/cypress/cypress.tgz typescript - - run: - name: Run project tests 🗳 - working_directory: /tmp/cypress-test-tiny - command: npm run cypress:run - - # install NPM + binary zip and run against staging API - test-binary-against-staging: - <<: *defaults - steps: - - restore_workspace_binaries - - clone-repo-and-checkout-branch: - repo: cypress-test-tiny - - run: - name: Install Cypress - working_directory: /tmp/cypress-test-tiny - # force installing the freshly built binary - command: CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i --legacy-peer-deps - ~/cypress/cypress.tgz + yarn set version 4.3.1 + cd ./system-tests/projects/yarn-v4.3.1-pnp-dep-resolution && yarn + name: install dependencies in yarn-v4.3.1-pnp-dep-resolution with yarn berry + 4.3.1 - run: - name: Run test project - working_directory: /tmp/cypress-test-tiny command: | - CYPRESS_PROJECT_ID=$TEST_TINY_PROJECT_ID \ - CYPRESS_RECORD_KEY=$TEST_TINY_RECORD_KEY \ - CYPRESS_INTERNAL_ENV=staging \ - $(yarn bin cypress) run --record - - test-binary-against-recipes-firefox: - <<: *defaults - steps: - - test-binary-against-repo: - repo: cypress-example-recipes - command: npm run test:ci:firefox - browser: firefox - - test-binary-against-recipes-chrome: - <<: *defaults - steps: - - test-binary-against-repo: - repo: cypress-example-recipes - command: npm run test:ci:chrome - browser: chrome - - test-binary-against-recipes: - <<: *defaults - parallelism: 4 - steps: - - test-binary-against-repo: - repo: cypress-example-recipes - # Split the specs up across 4 different machines to run in parallel - command: npm run test:ci -- --chunk $CIRCLE_NODE_INDEX --total-chunks - $CIRCLE_NODE_TOTAL - browser: electron - - # This is a special job. It allows you to test the current - # built test runner against a pull request in the repo - # cypress-example-recipes. - # Imagine you are working on a feature and want to show / test a recipe - # You would need to run the built test runner before release - # against a PR that cannot be merged until the new version - # of the test runner is released. - # Use: - # specify pull request number - # and the recipe folder - - # test-binary-against-recipe-pull-request: - # <<: *defaults - # steps: - # # test a specific pull request by number from cypress-example-recipes - # - test-binary-against-repo: - # repo: cypress-example-recipes - # command: npm run test:ci - # pull_request_id: 515 - # folder: examples/fundamentals__typescript - - test-binary-against-kitchensink: - <<: *defaults - steps: - - maybe_skip_binary_jobs - - test-binary-against-repo: - repo: cypress-example-kitchensink - browser: electron - - test-binary-against-kitchensink-firefox: - <<: *defaults - steps: - - test-binary-against-repo: - repo: cypress-example-kitchensink - browser: firefox - - test-binary-against-kitchensink-chrome: - <<: *defaults - steps: - - test-binary-against-repo: - repo: cypress-example-kitchensink - browser: chrome - executor: << parameters.executor >> - - test-binary-against-todomvc-firefox: - <<: *defaults - steps: - - test-binary-against-repo: - repo: cypress-example-todomvc - browser: firefox - - test-binary-against-cypress-realworld-app: - <<: *defaults - resource_class: medium+ - steps: - - test-binary-against-rwa: - repo: cypress-realworld-app - browser: chrome - - test-binary-as-specific-user: - <<: *defaults - steps: - - maybe_skip_binary_jobs - - restore_workspace_binaries - - clone-repo-and-checkout-branch: - repo: cypress-test-tiny - # the user should be "node" - - run: whoami - - run: pwd - # prints the current user's effective user id - # for root it is 0 - # for other users it is a positive integer - - run: node -e 'console.log(process.geteuid())' - # make sure the binary and NPM package files are present - - run: ls -l - - run: ls -l cypress.zip cypress.tgz - - run: - # install NPM from built NPM package folder - name: Install Cypress - working_directory: /tmp/cypress-test-tiny - # force installing the freshly built binary - command: CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i - ~/cypress/cypress.tgz - - run: - name: Cypress help - working_directory: /tmp/cypress-test-tiny - command: $(yarn bin cypress) help - - run: - name: Cypress info - working_directory: /tmp/cypress-test-tiny - command: $(yarn bin cypress) info - - run: - name: Verify Cypress binary - working_directory: /tmp/cypress-test-tiny - command: DEBUG=cypress:cli $(yarn bin cypress) verify - - run: - name: Run Cypress binary - working_directory: /tmp/cypress-test-tiny - command: DEBUG=cypress:cli $(yarn bin cypress) run - -linux-x64-workflow: &linux-x64-workflow - jobs: - - node_modules_install: - build-better-sqlite3: true - - 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:percy - required_env_var: PERCY_TOKEN - requires: - - 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 - # Cypress run must be completed to fetch Accessibility report - - verify-accessibility-results: - context: test-runner:cypress-record-key - requires: - - 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 - - driver-integration-tests-firefox - - driver-integration-tests-chrome - - driver-integration-tests-chrome-inject-document-domain - - driver-integration-tests-chrome-beta-inject-document-domain - - driver-integration-tests-electron - - driver-integration-tests-webkit - - driver-integration-memory-tests - - lint-types: - requires: - - build - # unit, integration and e2e tests - - cli-visual-tests: - context: test-runner:percy - requires: - - build - - unit-tests: - executor: linux-x64 - 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-inject-document-domain: - context: test-runner:cypress-record-key - requires: - - build - - driver-integration-tests-chrome-beta: - context: test-runner:cypress-record-key - requires: - - build - - driver-integration-tests-chrome-beta-inject-document-domain: - 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-puppeteer-unit-tests: - requires: - - build - - npm-puppeteer-cypress-tests: - requires: - - build - - npm-react: - requires: - - build - - npm-angular: - requires: - - build - - npm-mount-utils: - requires: - - build - - npm-grep: - requires: - - build - - npm-eslint-plugin-dev: - requires: - - build - - npm-cypress-schematic: - requires: - - build - - v8-integration-tests: - requires: - - system-tests-node-modules-install - - - ready-to-release: - # <<: *mainBuildFilters - requires: - - check-ts - - npm-angular - - npm-eslint-plugin-dev - - npm-puppeteer-unit-tests - - npm-puppeteer-cypress-tests - - npm-react - - npm-mount-utils - - npm-grep - - 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-chrome-inject-document-domain - - driver-integration-tests-chrome-beta-inject-document-domain - - driver-integration-tests-electron - - driver-integration-tests-webkit - - driver-integration-memory-tests - - system-tests-non-root - - system-tests-firefox - - system-tests-electron - - system-tests-chrome - - system-tests-webkit - - 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 - - yarn-pnp-preprocessor-system-test - - svelte-webpack-system-test - - test-kitchensink - - unit-tests - - verify-release-readiness - - v8-integration-tests - - - npm-release: - <<: *mainBuildFilters - context: test-runner:npm-release - requires: - - ready-to-release - - - create-and-trigger-packaging-artifacts: - context: - - test-runner:upload - - test-runner:build-binary - - publish-binary - requires: - - node_modules_install - - 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: - executor: kitchensink-executor - context: test-runner:record-tests - <<: *mainBuildFilters - requires: - - build - - test-npm-module-on-minimum-node-version: - context: publish-binary - requires: - - get-published-artifacts - - test-types-cypress-and-jest: - context: publish-binary - requires: - - get-published-artifacts - - test-full-typescript-project: - context: publish-binary - requires: - - get-published-artifacts - - test-binary-against-kitchensink: - context: publish-binary - 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 - context: publish-binary - requires: - - get-published-artifacts - - test-binary-as-specific-user: - name: "test binary as a root user" - context: publish-binary - requires: - - get-published-artifacts - - binary-system-tests: - context: publish-binary - requires: - - get-published-artifacts - - system-tests-node-modules-install - - yarn-pnp-preprocessor-system-test: - context: publish-binary - requires: - - get-published-artifacts - - system-tests-node-modules-install - - svelte-webpack-system-test: - context: publish-binary - requires: - - get-published-artifacts - - system-tests-node-modules-install - -linux-x64-contributor-workflow: &linux-x64-contributor-workflow - jobs: - - node_modules_install - - build: - is_contributor_pr: true - requires: - - node_modules_install - # In subsequent jobs, we use some contexts that are restricted to members of the Cypress organization. - # This job will allow for a Cypress member to approve and run the rest of the restricted jobs in the pipeline after the contributor code has been reviewed. - - contributor-pr: - type: approval - requires: - - build - # verify-accessibility-results is required for status checks, however, it will be skipped for contributors so it - # can run in any order - - verify-accessibility-results - - check-ts: - requires: - - build - - lint: - name: linux-lint - requires: - - build - - percy-finalize: - context: test-runner:percy - required_env_var: PERCY_TOKEN # skips job if not defined (external PR) - requires: - - 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 - - lint-types: - requires: - - build - # unit, integration and e2e tests - - cli-visual-tests: - context: test-runner:percy - requires: - - contributor-pr - - unit-tests: - executor: linux-x64 - requires: - - build - - verify-release-readiness: - context: test-runner:npm-release - requires: - - contributor-pr - - 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: - - contributor-pr - - 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: - - contributor-pr - - driver-integration-tests-chrome-inject-document-domain: - context: test-runner:cypress-record-key - requires: - - contributor-pr - - driver-integration-tests-chrome-beta: - context: test-runner:cypress-record-key - requires: - - contributor-pr - - driver-integration-tests-chrome-beta-inject-document-domain: - context: test-runner:cypress-record-key - requires: - - contributor-pr - - driver-integration-tests-firefox: - context: test-runner:cypress-record-key - requires: - - contributor-pr - - driver-integration-tests-electron: - context: test-runner:cypress-record-key - requires: - - contributor-pr - - driver-integration-tests-webkit: - context: test-runner:cypress-record-key - requires: - - contributor-pr - - 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: - - contributor-pr - - run-launchpad-integration-tests-chrome: - context: - [ - test-runner:cypress-record-key, - test-runner:launchpad-tests, - test-runner:percy - ] - percy: true - requires: - - contributor-pr - - run-launchpad-component-tests-chrome: - context: - [ - test-runner:cypress-record-key, - test-runner:launchpad-tests, - test-runner:percy - ] - percy: true - requires: - - contributor-pr - - run-app-integration-tests-chrome: - context: - [ - test-runner:cypress-record-key, - test-runner:launchpad-tests, - test-runner:percy - ] - percy: true - requires: - - contributor-pr - - 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: - - contributor-pr - - run-reporter-component-tests-chrome: - context: [ test-runner:cypress-record-key, test-runner:percy ] - percy: true - requires: - - contributor-pr - - reporter-integration-tests: - context: [ test-runner:cypress-record-key, test-runner:percy ] - requires: - - contributor-pr - - 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-puppeteer-unit-tests: - requires: - - build - - npm-puppeteer-cypress-tests: - requires: - - build - - npm-react: - requires: - - build - - npm-angular: - requires: - - build - - npm-mount-utils: - requires: - - build - - npm-grep: - requires: - - build - - npm-eslint-plugin-dev: - requires: - - build - - npm-cypress-schematic: - requires: - - build - - v8-integration-tests: - requires: - - system-tests-node-modules-install - - - ready-to-release: - requires: - - check-ts - - npm-angular - - npm-eslint-plugin-dev - - npm-puppeteer-unit-tests - - npm-puppeteer-cypress-tests - - npm-react - - npm-mount-utils - - npm-grep - - 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-tests-webkit - - driver-integration-memory-tests - - system-tests-non-root - - system-tests-firefox - - system-tests-electron - - system-tests-chrome - - system-tests-webkit - - 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 - - v8-integration-tests - - - npm-release: - context: test-runner:npm-release - requires: - - ready-to-release - - - create-and-trigger-packaging-artifacts: - context: [ test-runner:upload, test-runner:build-binary, publish-binary ] - requires: - - contributor-pr - - get-published-artifacts: - context: [ publish-binary, test-runner:commit-status-checks ] - requires: - - create-and-trigger-packaging-artifacts - # 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: - executor: kitchensink-executor - context: test-runner:record-tests - <<: *mainBuildFilters - requires: - - build - - test-npm-module-on-minimum-node-version: - context: publish-binary - requires: - - get-published-artifacts - - test-types-cypress-and-jest: - context: publish-binary - requires: - - get-published-artifacts - - test-full-typescript-project: - context: publish-binary - requires: - - get-published-artifacts - - test-binary-against-kitchensink: - context: publish-binary - 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 - context: publish-binary - requires: - - get-published-artifacts - - test-binary-as-specific-user: - name: "test binary as a root user" - context: publish-binary - requires: - - get-published-artifacts - - binary-system-tests: - context: publish-binary - requires: - - get-published-artifacts - - system-tests-node-modules-install - -linux-arm64-workflow: &linux-arm64-workflow - jobs: - - node_modules_install: - name: linux-arm64-node-modules-install - executor: linux-arm64 - resource_class: arm.medium - only-cache-for-root-user: true - - - build: - name: linux-arm64-build - context: test-runner:env-canary - executor: linux-arm64 - resource_class: arm.medium - requires: - - linux-arm64-node-modules-install - - - create-and-trigger-packaging-artifacts: - name: linux-arm64-create-and-trigger-packaging-artifacts - context: - [ - test-runner:upload, - test-runner:commit-status-checks, - test-runner:build-binary, - publish-binary - ] - executor: linux-arm64 - resource_class: arm.medium - requires: - - linux-arm64-node-modules-install - - - wait-for-binary-publish: - name: linux-arm64-wait-for-binary-publish - type: approval - requires: - - linux-arm64-create-and-trigger-packaging-artifacts - - - get-published-artifacts: - name: linux-arm64-get-published-artifacts - context: [ publish-binary, test-runner:commit-status-checks ] - executor: linux-arm64 - resource_class: arm.medium - requires: - - linux-arm64-wait-for-binary-publish - - - v8-integration-tests: - executor: linux-arm64 - resource_class: arm.medium - requires: - - linux-arm64-build - - driver-integration-memory-tests: - executor: linux-arm64 - resource_class: arm.medium - requires: - - linux-arm64-build - - server-unit-tests-cloud-environment: - executor: linux-arm64 - resource_class: arm.medium - requires: - - linux-arm64-build - -darwin-x64-workflow: &darwin-x64-workflow - jobs: - - node_modules_install: - name: darwin-x64-node-modules-install - executor: darwin-amd64 - resource_class: cypress-io/intel-macstadium - only-cache-for-root-user: true - - - build: - name: darwin-x64-build - context: test-runner:env-canary - executor: darwin-amd64 - resource_class: cypress-io/intel-macstadium - requires: - - darwin-x64-node-modules-install - - - create-build-artifacts: - name: darwin-x64-create-build-artifacts - context: - - test-runner:sign-mac-binary - - test-runner:upload - - test-runner:commit-status-checks - - test-runner:build-binary - executor: darwin-amd64 - resource_class: cypress-io/intel-macstadium - requires: - - darwin-x64-build - - - v8-integration-tests: - name: darwin-x64-v8-integration-tests - executor: darwin-amd64 - resource_class: cypress-io/intel-macstadium - requires: - - darwin-x64-build - - - driver-integration-memory-tests: - name: darwin-x64-driver-integration-memory-tests - executor: darwin-amd64 - resource_class: cypress-io/intel-macstadium - requires: - - darwin-x64-build - - - server-unit-tests-cloud-environment: - name: darwin-x64-driver-server-unit-tests-cloud-environment - executor: darwin-amd64 - resource_class: cypress-io/intel-macstadium - requires: - - darwin-x64-build - -darwin-arm64-workflow: &darwin-arm64-workflow - jobs: - - node_modules_install: - name: darwin-arm64-node-modules-install - executor: darwin-arm64 - resource_class: cypress-io/m1-macstadium - only-cache-for-root-user: true - - - build: - name: darwin-arm64-build - context: test-runner:env-canary - executor: darwin-arm64 - resource_class: cypress-io/m1-macstadium - requires: - - darwin-arm64-node-modules-install - - - create-build-artifacts: - name: darwin-arm64-create-build-artifacts - context: - - test-runner:sign-mac-binary - - test-runner:upload - - test-runner:commit-status-checks - - test-runner:build-binary - executor: darwin-arm64 - resource_class: cypress-io/m1-macstadium - requires: - - darwin-arm64-build - - - v8-integration-tests: - name: darwin-arm64-v8-integration-tests - executor: darwin-arm64 - resource_class: cypress-io/m1-macstadium - requires: - - darwin-arm64-build - - driver-integration-memory-tests: - name: darwin-arm64-driver-integration-memory-tests - executor: darwin-arm64 - resource_class: cypress-io/m1-macstadium - requires: - - darwin-arm64-build - - server-unit-tests-cloud-environment: - name: darwin-arm64-server-unit-tests-cloud-environment - executor: darwin-arm64 - resource_class: cypress-io/m1-macstadium - requires: - - darwin-arm64-build - -windows-workflow: &windows-workflow - jobs: - - node_modules_install: - name: windows-node-modules-install - executor: windows - resource_class: windows.medium - only-cache-for-root-user: true - - - build: - name: windows-build - context: test-runner:env-canary - executor: windows - resource_class: windows.large - requires: - - windows-node-modules-install - - - run-app-integration-tests-chrome: - name: windows-run-app-integration-tests-chrome - executor: windows - resource_class: windows.large - context: [ test-runner:cypress-record-key, test-runner:launchpad-tests ] - requires: - - windows-build - - - run-launchpad-integration-tests-chrome: - name: windows-run-launchpad-integration-tests-chrome - executor: windows - resource_class: windows.large - context: [ test-runner:cypress-record-key, test-runner:launchpad-tests ] - requires: - - windows-build - - - unit-tests: - name: windows-unit-tests - executor: windows - resource_class: windows.medium - requires: - - windows-build - - - server-unit-tests-cloud-environment: - name: windows-server-unit-tests-cloud-environment - executor: windows - resource_class: windows.medium - requires: - - windows-build - - - create-build-artifacts: - name: windows-create-build-artifacts - executor: windows - resource_class: windows.large - context: - - test-runner:sign-windows-binary - - test-runner:upload - - test-runner:commit-status-checks - - test-runner:build-binary - requires: - - windows-build - - - test-binary-against-kitchensink-chrome: - name: windows-test-binary-against-kitchensink-chrome - executor: windows - requires: - - windows-create-build-artifacts - - - v8-integration-tests: - name: windows-v8-integration-tests - executor: windows - resource_class: windows.medium - requires: - - windows-build - - driver-integration-memory-tests: - name: windows-driver-integration-memory-tests - executor: windows - resource_class: windows.medium - requires: - - windows-build - + # we need to bootstrap the binary into our project directory and run the tests + source ./system-tests/scripts/bootstrap-docker-container.sh 'yarn cypress run' + name: Bootstrap the Cypress binary and run binary system test + working_directory: ~/cypress +orbs: + browser-tools: circleci/browser-tools@2.1.1 +ubuntu-2004-current: ubuntu-2004:2024.11.1 +ubuntu-2004-older: ubuntu-2004:2024.05.1 +version: 2.1 workflows: + darwin-arm64: + jobs: + - node_modules_install: + executor: darwin-arm64 + name: darwin-arm64-node-modules-install + only-cache-for-root-user: true + resource_class: cypress-io/m1-macstadium + - build: + context: test-runner:env-canary + executor: darwin-arm64 + name: darwin-arm64-build + requires: + - darwin-arm64-node-modules-install + resource_class: cypress-io/m1-macstadium + - create-build-artifacts: + context: + - test-runner:sign-mac-binary + - test-runner:upload + - test-runner:commit-status-checks + - test-runner:build-binary + executor: darwin-arm64 + name: darwin-arm64-create-build-artifacts + requires: + - darwin-arm64-build + resource_class: cypress-io/m1-macstadium + - v8-integration-tests: + executor: darwin-arm64 + name: darwin-arm64-v8-integration-tests + requires: + - darwin-arm64-build + resource_class: cypress-io/m1-macstadium + - driver-integration-memory-tests: + executor: darwin-arm64 + name: darwin-arm64-driver-integration-memory-tests + requires: + - darwin-arm64-build + resource_class: cypress-io/m1-macstadium + - server-unit-tests-cloud-environment: + executor: darwin-arm64 + name: darwin-arm64-server-unit-tests-cloud-environment + requires: + - darwin-arm64-build + resource_class: cypress-io/m1-macstadium + when: + or: + - equal: + - develop + - << pipeline.git.branch >> + - equal: + - update-v8-snapshot-cache-on-develop + - << pipeline.git.branch >> + - matches: + pattern: /^release\/\d+\.\d+\.\d+$/ + value: << pipeline.git.branch >> + darwin-x64: + jobs: + - node_modules_install: + executor: darwin-amd64 + name: darwin-x64-node-modules-install + only-cache-for-root-user: true + resource_class: cypress-io/intel-macstadium + - build: + context: test-runner:env-canary + executor: darwin-amd64 + name: darwin-x64-build + requires: + - darwin-x64-node-modules-install + resource_class: cypress-io/intel-macstadium + - create-build-artifacts: + context: + - test-runner:sign-mac-binary + - test-runner:upload + - test-runner:commit-status-checks + - test-runner:build-binary + executor: darwin-amd64 + name: darwin-x64-create-build-artifacts + requires: + - darwin-x64-build + resource_class: cypress-io/intel-macstadium + - v8-integration-tests: + executor: darwin-amd64 + name: darwin-x64-v8-integration-tests + requires: + - darwin-x64-build + resource_class: cypress-io/intel-macstadium + - driver-integration-memory-tests: + executor: darwin-amd64 + name: darwin-x64-driver-integration-memory-tests + requires: + - darwin-x64-build + resource_class: cypress-io/intel-macstadium + - server-unit-tests-cloud-environment: + executor: darwin-amd64 + name: darwin-x64-driver-server-unit-tests-cloud-environment + requires: + - darwin-x64-build + resource_class: cypress-io/intel-macstadium + when: + or: + - equal: + - develop + - << pipeline.git.branch >> + - equal: + - update-v8-snapshot-cache-on-develop + - << pipeline.git.branch >> + - matches: + pattern: /^release\/\d+\.\d+\.\d+$/ + value: << pipeline.git.branch >> + linux-arm64: + jobs: + - node_modules_install: + executor: linux-arm64 + name: linux-arm64-node-modules-install + only-cache-for-root-user: true + resource_class: arm.medium + - build: + context: test-runner:env-canary + executor: linux-arm64 + name: linux-arm64-build + requires: + - linux-arm64-node-modules-install + resource_class: arm.medium + - create-and-trigger-packaging-artifacts: + context: + - test-runner:upload + - test-runner:commit-status-checks + - test-runner:build-binary + - publish-binary + executor: linux-arm64 + name: linux-arm64-create-and-trigger-packaging-artifacts + requires: + - linux-arm64-node-modules-install + resource_class: arm.medium + - wait-for-binary-publish: + name: linux-arm64-wait-for-binary-publish + requires: + - linux-arm64-create-and-trigger-packaging-artifacts + type: approval + - get-published-artifacts: + context: + - publish-binary + - test-runner:commit-status-checks + executor: linux-arm64 + name: linux-arm64-get-published-artifacts + requires: + - linux-arm64-wait-for-binary-publish + resource_class: arm.medium + - v8-integration-tests: + executor: linux-arm64 + requires: + - linux-arm64-build + resource_class: arm.medium + - driver-integration-memory-tests: + executor: linux-arm64 + requires: + - linux-arm64-build + resource_class: arm.medium + - server-unit-tests-cloud-environment: + executor: linux-arm64 + requires: + - linux-arm64-build + resource_class: arm.medium + when: + or: + - equal: + - develop + - << pipeline.git.branch >> + - equal: + - update-v8-snapshot-cache-on-develop + - << pipeline.git.branch >> + - matches: + pattern: /^release\/\d+\.\d+\.\d+$/ + value: << pipeline.git.branch >> linux-x64: - <<: [ *linux-x64-workflow, *linux-x64-workflow-exclude-filters ] + jobs: + - node_modules_install: + build-better-sqlite3: true + - 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:percy + required_env_var: PERCY_TOKEN + requires: + - 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 + - verify-accessibility-results: + context: test-runner:cypress-record-key + requires: + - 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 + - driver-integration-tests-firefox + - driver-integration-tests-chrome + - driver-integration-tests-chrome-inject-document-domain + - driver-integration-tests-chrome-beta-inject-document-domain + - driver-integration-tests-electron + - driver-integration-tests-webkit + - driver-integration-memory-tests + - lint-types: + requires: + - build + - 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-inject-document-domain: + context: test-runner:cypress-record-key + requires: + - build + - driver-integration-tests-chrome-beta: + context: test-runner:cypress-record-key + requires: + - build + - driver-integration-tests-chrome-beta-inject-document-domain: + 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-puppeteer-unit-tests: + requires: + - build + - npm-puppeteer-cypress-tests: + requires: + - build + - npm-react: + requires: + - build + - npm-angular: + requires: + - build + - npm-mount-utils: + requires: + - build + - npm-grep: + requires: + - build + - npm-eslint-plugin-dev: + requires: + - build + - npm-cypress-schematic: + requires: + - build + - v8-integration-tests: + requires: + - system-tests-node-modules-install + - ready-to-release: + requires: + - check-ts + - npm-angular + - npm-eslint-plugin-dev + - npm-puppeteer-unit-tests + - npm-puppeteer-cypress-tests + - npm-react + - npm-mount-utils + - npm-grep + - 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-chrome-inject-document-domain + - driver-integration-tests-chrome-beta-inject-document-domain + - driver-integration-tests-electron + - driver-integration-tests-webkit + - driver-integration-memory-tests + - system-tests-non-root + - system-tests-firefox + - system-tests-electron + - system-tests-chrome + - system-tests-webkit + - 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 + - yarn-pnp-preprocessor-system-test + - svelte-webpack-system-test + - test-kitchensink + - unit-tests + - verify-release-readiness + - v8-integration-tests + - npm-release: + context: test-runner:npm-release + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - ready-to-release + - create-and-trigger-packaging-artifacts: + context: + - test-runner:upload + - test-runner:build-binary + - publish-binary + requires: + - node_modules_install + - wait-for-binary-publish: + requires: + - create-and-trigger-packaging-artifacts + type: approval + - get-published-artifacts: + context: + - publish-binary + - test-runner:commit-status-checks + requires: + - wait-for-binary-publish + - test-against-staging: + context: test-runner:record-tests + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - build + - test-kitchensink: + requires: + - build + - test-kitchensink-against-staging: + context: test-runner:record-tests + executor: kitchensink-executor + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - build + - test-npm-module-on-minimum-node-version: + context: publish-binary + requires: + - get-published-artifacts + - test-types-cypress-and-jest: + context: publish-binary + requires: + - get-published-artifacts + - test-full-typescript-project: + context: publish-binary + requires: + - get-published-artifacts + - test-binary-against-kitchensink: + context: publish-binary + requires: + - get-published-artifacts + - test-npm-module-and-verify-binary: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-staging: + context: test-runner:record-tests + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-kitchensink-chrome: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-recipes-firefox: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-recipes-chrome: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-recipes: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-kitchensink-firefox: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-todomvc-firefox: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-cypress-realworld-app: + context: test-runner:cypress-record-key + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-as-specific-user: + context: publish-binary + executor: non-root-docker-user + name: test binary as a non-root user + requires: + - get-published-artifacts + - test-binary-as-specific-user: + context: publish-binary + name: test binary as a root user + requires: + - get-published-artifacts + - binary-system-tests: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install + - yarn-pnp-preprocessor-system-test: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install + - svelte-webpack-system-test: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install + when: + or: + - equal: + - develop + - << pipeline.git.branch >> + - equal: + - update-v8-snapshot-cache-on-develop + - << pipeline.git.branch >> + - matches: + pattern: /^release\/\d+\.\d+\.\d+$/ + value: << pipeline.git.branch >> linux-x64-contributor: - <<: *linux-x64-contributor-workflow + jobs: + - node_modules_install + - build: + is_contributor_pr: true + requires: + - node_modules_install + - contributor-pr: + requires: + - build + type: approval + - verify-accessibility-results + - check-ts: + requires: + - build + - lint: + name: linux-lint + requires: + - build + - percy-finalize: + context: test-runner:percy + required_env_var: PERCY_TOKEN + requires: + - 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 + - lint-types: + requires: + - build + - cli-visual-tests: + context: test-runner:percy + requires: + - contributor-pr + - unit-tests: + is_contributor_pr: true + requires: + - build + - verify-release-readiness: + context: test-runner:npm-release + requires: + - contributor-pr + - 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: + - contributor-pr + - 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: + - contributor-pr + - driver-integration-tests-chrome-inject-document-domain: + context: test-runner:cypress-record-key + requires: + - contributor-pr + - driver-integration-tests-chrome-beta: + context: test-runner:cypress-record-key + requires: + - contributor-pr + - driver-integration-tests-chrome-beta-inject-document-domain: + context: test-runner:cypress-record-key + requires: + - contributor-pr + - driver-integration-tests-firefox: + context: test-runner:cypress-record-key + requires: + - contributor-pr + - driver-integration-tests-electron: + context: test-runner:cypress-record-key + requires: + - contributor-pr + - driver-integration-tests-webkit: + context: test-runner:cypress-record-key + requires: + - contributor-pr + - 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: + - contributor-pr + - run-launchpad-integration-tests-chrome: + context: + - test-runner:cypress-record-key + - test-runner:launchpad-tests + - test-runner:percy + percy: true + requires: + - contributor-pr + - run-launchpad-component-tests-chrome: + context: + - test-runner:cypress-record-key + - test-runner:launchpad-tests + - test-runner:percy + percy: true + requires: + - contributor-pr + - run-app-integration-tests-chrome: + context: + - test-runner:cypress-record-key + - test-runner:launchpad-tests + - test-runner:percy + percy: true + requires: + - contributor-pr + - 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: + - contributor-pr + - run-reporter-component-tests-chrome: + context: + - test-runner:cypress-record-key + - test-runner:percy + percy: true + requires: + - contributor-pr + - reporter-integration-tests: + context: + - test-runner:cypress-record-key + - test-runner:percy + requires: + - contributor-pr + - 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-puppeteer-unit-tests: + requires: + - build + - npm-puppeteer-cypress-tests: + requires: + - build + - npm-react: + requires: + - build + - npm-angular: + requires: + - build + - npm-mount-utils: + requires: + - build + - npm-grep: + requires: + - build + - npm-eslint-plugin-dev: + requires: + - build + - npm-cypress-schematic: + requires: + - build + - v8-integration-tests: + requires: + - system-tests-node-modules-install + - ready-to-release: + requires: + - check-ts + - npm-angular + - npm-eslint-plugin-dev + - npm-puppeteer-unit-tests + - npm-puppeteer-cypress-tests + - npm-react + - npm-mount-utils + - npm-grep + - 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-tests-webkit + - driver-integration-memory-tests + - system-tests-non-root + - system-tests-firefox + - system-tests-electron + - system-tests-chrome + - system-tests-webkit + - 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 + - v8-integration-tests + - npm-release: + context: test-runner:npm-release + requires: + - ready-to-release + - create-and-trigger-packaging-artifacts: + context: + - test-runner:upload + - test-runner:build-binary + - publish-binary + requires: + - contributor-pr + - get-published-artifacts: + context: + - publish-binary + - test-runner:commit-status-checks + requires: + - create-and-trigger-packaging-artifacts + - test-against-staging: + context: test-runner:record-tests + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - build + - test-kitchensink: + requires: + - build + - test-kitchensink-against-staging: + context: test-runner:record-tests + executor: kitchensink-executor + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - build + - test-npm-module-on-minimum-node-version: + context: publish-binary + requires: + - get-published-artifacts + - test-types-cypress-and-jest: + context: publish-binary + requires: + - get-published-artifacts + - test-full-typescript-project: + context: publish-binary + requires: + - get-published-artifacts + - test-binary-against-kitchensink: + context: publish-binary + requires: + - get-published-artifacts + - test-npm-module-and-verify-binary: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-staging: + context: test-runner:record-tests + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-kitchensink-chrome: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-recipes-firefox: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-recipes-chrome: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-recipes: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-kitchensink-firefox: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-todomvc-firefox: + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-against-cypress-realworld-app: + context: test-runner:cypress-record-key + filters: + branches: + only: + - develop + - /^release\/\d+\.\d+\.\d+$/ + - update-v8-snapshot-cache-on-develop + - chore/refactor_cli_to_ts + requires: + - get-published-artifacts + - test-binary-as-specific-user: + context: publish-binary + executor: non-root-docker-user + name: test binary as a non-root user + requires: + - get-published-artifacts + - test-binary-as-specific-user: + context: publish-binary + name: test binary as a root user + requires: + - get-published-artifacts + - binary-system-tests: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install when: matches: pattern: /^pull\/[0-9]+/ value: << pipeline.git.branch >> - linux-arm64: - <<: [ *linux-arm64-workflow, *linux-arm64-workflow-filters ] - darwin-x64: - <<: [ *darwin-x64-workflow, *darwin-workflow-filters ] - darwin-arm64: - <<: [ *darwin-arm64-workflow, *darwin-workflow-filters ] + pull-request: + jobs: + - node_modules_install: + build-better-sqlite3: true + - 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:percy + required_env_var: PERCY_TOKEN + requires: + - 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 + - verify-accessibility-results: + context: test-runner:cypress-record-key + requires: + - 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 + - driver-integration-tests-firefox + - driver-integration-tests-chrome + - driver-integration-tests-chrome-inject-document-domain + - driver-integration-tests-chrome-beta-inject-document-domain + - driver-integration-tests-electron + - driver-integration-tests-webkit + - driver-integration-memory-tests + - lint-types: + requires: + - build + - 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-inject-document-domain: + context: test-runner:cypress-record-key + requires: + - build + - driver-integration-tests-chrome-beta: + context: test-runner:cypress-record-key + requires: + - build + - driver-integration-tests-chrome-beta-inject-document-domain: + 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-puppeteer-unit-tests: + requires: + - build + - npm-puppeteer-cypress-tests: + requires: + - build + - npm-react: + requires: + - build + - npm-angular: + requires: + - build + - npm-mount-utils: + requires: + - build + - npm-grep: + requires: + - build + - npm-eslint-plugin-dev: + requires: + - build + - npm-cypress-schematic: + requires: + - build + - v8-integration-tests: + requires: + - system-tests-node-modules-install + - create-and-trigger-packaging-artifacts: + context: + - test-runner:upload + - test-runner:build-binary + - publish-binary + requires: + - node_modules_install + - wait-for-binary-publish: + requires: + - create-and-trigger-packaging-artifacts + type: approval + - get-published-artifacts: + context: + - publish-binary + - test-runner:commit-status-checks + requires: + - wait-for-binary-publish + - test-kitchensink: + requires: + - build + - test-npm-module-on-minimum-node-version: + context: publish-binary + requires: + - get-published-artifacts + - test-types-cypress-and-jest: + context: publish-binary + requires: + - get-published-artifacts + - test-full-typescript-project: + context: publish-binary + requires: + - get-published-artifacts + - test-binary-against-kitchensink: + context: publish-binary + requires: + - get-published-artifacts + - test-binary-as-specific-user: + context: publish-binary + executor: non-root-docker-user + name: test binary as a non-root user + requires: + - get-published-artifacts + - test-binary-as-specific-user: + context: publish-binary + name: test binary as a root user + requires: + - get-published-artifacts + - binary-system-tests: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install + - yarn-pnp-preprocessor-system-test: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install + - svelte-webpack-system-test: + context: publish-binary + requires: + - get-published-artifacts + - system-tests-node-modules-install + when: + and: + - not: + matches: + pattern: /^release\// + value: << pipeline.git.branch >> + - not: + matches: + pattern: /^develop/ + value: << pipeline.git.branch >> + - not: + matches: + pattern: /^pull\/[0-9]+/ + value: << pipeline.git.branch >> windows: - <<: [ *windows-workflow, *windows-workflow-filters ] + jobs: + - node_modules_install: + executor: windows + name: windows-node-modules-install + only-cache-for-root-user: true + resource_class: windows.medium + - build: + context: test-runner:env-canary + executor: windows + name: windows-build + requires: + - windows-node-modules-install + resource_class: windows.large + - run-app-integration-tests-chrome: + context: + - test-runner:cypress-record-key + - test-runner:launchpad-tests + executor: windows + name: windows-run-app-integration-tests-chrome + requires: + - windows-build + resource_class: windows.large + - run-launchpad-integration-tests-chrome: + context: + - test-runner:cypress-record-key + - test-runner:launchpad-tests + executor: windows + name: windows-run-launchpad-integration-tests-chrome + requires: + - windows-build + resource_class: windows.large + - unit-tests: + executor: windows + name: windows-unit-tests + requires: + - windows-build + resource_class: windows.medium + - server-unit-tests-cloud-environment: + executor: windows + name: windows-server-unit-tests-cloud-environment + requires: + - windows-build + resource_class: windows.medium + - create-build-artifacts: + context: + - test-runner:sign-windows-binary + - test-runner:upload + - test-runner:commit-status-checks + - test-runner:build-binary + executor: windows + name: windows-create-build-artifacts + requires: + - windows-build + resource_class: windows.large + - test-binary-against-kitchensink-chrome: + executor: windows + name: windows-test-binary-against-kitchensink-chrome + requires: + - windows-create-build-artifacts + - v8-integration-tests: + executor: windows + name: windows-v8-integration-tests + requires: + - windows-build + resource_class: windows.medium + - driver-integration-memory-tests: + executor: windows + name: windows-driver-integration-memory-tests + requires: + - windows-build + resource_class: windows.medium + when: + or: + - equal: + - develop + - << pipeline.git.branch >> + - equal: + - update-v8-snapshot-cache-on-develop + - << pipeline.git.branch >> + - matches: + pattern: /^release\/\d+\.\d+\.\d+$/ + value: << pipeline.git.branch >> diff --git a/.husky/pre-commit b/.husky/pre-commit index 36af219892f..841ee0efb4d 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,41 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" +# Pack CircleCI config if any files in .circleci/src were changed +if git diff --cached --name-only | grep -q "^\.circleci/src/"; then + if ! which circleci > /dev/null; then + echo "❌ Warning: CircleCI CLI not found! Install the CircleCi CLI to edit the CircleCI configuration." + exit 1 + fi + + echo "Processing CircleCI configurations..." + + # Find all directories in .circleci/src + for dir in ./.circleci/src/*/; do + if [ -d "$dir" ]; then + dirname=$(basename "$dir") + output_file="./.circleci/${dirname}.yml" + + echo "📦 Packing ${dirname}.yml configuration..." + if ! circleci config pack "$dir" > "$output_file"; then + echo " ❌ Failed to pack ${output_file}" + exit 1 + fi + echo " ✅ Packed ${output_file}" + + echo " 🔍 Validating ${output_file}" + if ! circleci config validate "$output_file"; then + echo " ❌ Validating ${output_file} failed" + exit 1 + fi + echo " ✅ ${dirname}.yml configuration validated successfully" + + git add "$output_file" + echo " 📝 ${output_file} staged for commit" + fi + done + + echo "🎉 All CircleCI configurations processed successfully!" +fi + npx lint-staged diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7d520ed15a6..89641233eac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -237,6 +237,7 @@ You must have the following installed on your system to contribute locally: - [`Node.js`](https://nodejs.org/en/) (See the root [.node-version](.node-version) file for the required version. You can find a list of tools on [node-version-usage](https://github.com/shadowspawn/node-version-usage) to switch the version of [`Node.js`](https://nodejs.org/en/) based on [.node-version](.node-version).) - [`Yarn v1 Classic`](https://yarnpkg.com/en/docs/install) (See also [Corepack](#corepack) below.) - [`python`](https://www.python.org/downloads/) (since we use `node-gyp`. See their [repo](https://github.com/nodejs/node-gyp) for Python version requirements.) +- [`circleci CLI`](https://circleci.com/docs/guides/toolkit/local-cli/) if you intend on editing the CI configuration. #### Debian/Ubuntu diff --git a/scripts/github-actions/update-browser-versions.js b/scripts/github-actions/update-browser-versions.js index 660f0bb12d1..25c1e4aa7f9 100644 --- a/scripts/github-actions/update-browser-versions.js +++ b/scripts/github-actions/update-browser-versions.js @@ -1,10 +1,14 @@ const https = require('https') const fs = require('fs') const yaml = require('yaml') +const path = require('path') const CHROME_STABLE_KEY = 'chrome-stable-version' const CHROME_BETA_KEY = 'chrome-beta-version' +// This is the path to the CircleCI file that contains the browser version anchors +const CIRCLECI_WORKFLOWS_FILEPATH = path.join(__dirname, '../../.circleci/src/workflows/@workflows.yml') + // https://developer.chrome.com/docs/versionhistory/reference/#platform-identifiers const getLatestVersionData = ({ channel, currentVersion }) => { const options = { @@ -37,8 +41,7 @@ const getLatestVersionData = ({ channel, currentVersion }) => { const getVersions = async ({ core }) => { try { - // file path is relative to repo root - const doc = yaml.parseDocument(fs.readFileSync('./.circleci/workflows.yml', 'utf8')) + const doc = yaml.parseDocument(fs.readFileSync(CIRCLECI_WORKFLOWS_FILEPATH, 'utf8')) const currentChromeStable = doc.contents.items.find((item) => item.key.value === CHROME_STABLE_KEY).value.value const currentChromeBeta = doc.contents.items.find((item) => item.key.value === CHROME_BETA_KEY).value.value @@ -74,8 +77,7 @@ const getVersions = async ({ core }) => { } const checkNeedForBranchUpdate = ({ core, latestStableVersion, latestBetaVersion }) => { - // file path is relative to repo root - const doc = yaml.parseDocument(fs.readFileSync('./.circleci/workflows.yml', 'utf8')) + const doc = yaml.parseDocument(fs.readFileSync(CIRCLECI_WORKFLOWS_FILEPATH, 'utf8')) const currentChromeStable = doc.contents.items.find((item) => item.key.value === CHROME_STABLE_KEY).value.value const currentChromeBeta = doc.contents.items.find((item) => item.key.value === CHROME_BETA_KEY).value.value @@ -87,7 +89,7 @@ const checkNeedForBranchUpdate = ({ core, latestStableVersion, latestBetaVersion } const updateBrowserVersionsFile = ({ latestBetaVersion, latestStableVersion }) => { - const doc = yaml.parseDocument(fs.readFileSync('./.circleci/workflows.yml', 'utf8')) + const doc = yaml.parseDocument(fs.readFileSync(CIRCLECI_WORKFLOWS_FILEPATH, 'utf8')) const currentChromeStableYamlRef = doc.contents.items.find((item) => item.key.value === CHROME_STABLE_KEY) const currentChromeBetaYamlRef = doc.contents.items.find((item) => item.key.value === CHROME_BETA_KEY) @@ -95,8 +97,7 @@ const updateBrowserVersionsFile = ({ latestBetaVersion, latestStableVersion }) = currentChromeStableYamlRef.value.value = latestStableVersion currentChromeBetaYamlRef.value.value = latestBetaVersion - // file path is relative to repo root - fs.writeFileSync('./.circleci/workflows.yml', yaml.stringify(doc), 'utf8') + fs.writeFileSync(CIRCLECI_WORKFLOWS_FILEPATH, yaml.stringify(doc), 'utf8') } const updatePRTitle = async ({ context, github, baseBranch, branchName, description }) => { @@ -126,4 +127,5 @@ module.exports = { checkNeedForBranchUpdate, updateBrowserVersionsFile, updatePRTitle, + CIRCLECI_WORKFLOWS_FILEPATH, } diff --git a/scripts/unit/github-actions/update-browser-version-spec.js b/scripts/unit/github-actions/update-browser-version-spec.js index 8a9e7daaead..20fce2de935 100644 --- a/scripts/unit/github-actions/update-browser-version-spec.js +++ b/scripts/unit/github-actions/update-browser-version-spec.js @@ -13,6 +13,7 @@ const { checkNeedForBranchUpdate, updateBrowserVersionsFile, updatePRTitle, + CIRCLECI_WORKFLOWS_FILEPATH, } = require('../../github-actions/update-browser-versions') const coreStub = () => { @@ -29,7 +30,7 @@ const stubChromeVersionResult = (channel, result) => { const stubRepoVersions = ({ betaVersion, stableVersion }) => { mockfs({ - './.circleci/workflows.yml': `chrome-stable-version: &chrome-stable-version "${stableVersion}"\nchrome-beta-version: &chrome-beta-version "${betaVersion}"\n`, + [CIRCLECI_WORKFLOWS_FILEPATH]: `chrome-stable-version: &chrome-stable-version "${stableVersion}"\nchrome-beta-version: &chrome-beta-version "${betaVersion}"\n`, }) } @@ -254,7 +255,7 @@ describe('update browser version github action', () => { latestStableVersion: '2.0', }) - expect(fs.writeFileSync).to.be.calledWith('./.circleci/workflows.yml', `chrome-stable-version: &chrome-stable-version "2.0"\nchrome-beta-version: &chrome-beta-version "2.1"\n`, 'utf8') + expect(fs.writeFileSync).to.be.calledWith(CIRCLECI_WORKFLOWS_FILEPATH, `chrome-stable-version: &chrome-stable-version "2.0"\nchrome-beta-version: &chrome-beta-version "2.1"\n`, 'utf8') }) })