Skip to content

Commit

Permalink
chore: optimize task execution (#27848)
Browse files Browse the repository at this point in the history
* Revert "chore: simplify build script (#27547)"

This reverts commit 0a86ec6.

* Revert "chore: upgrade lerna to 6, cache build step (#26913)"

This reverts commit 9e60aeb.

* [run ci]

* chore: upgrade lerna to 6, cache build step (#26913)

* chore: update build-npm-modules script

* chore: update build-npm-modules script

* chore: update build-npm-modules script

* chore: update build-npm-modules script

* chore: update lerna to 6

* [run ci]

* try caching build step

* we can't clean without building after

* add dependencies on scripts for npm packages

* update commands

* add config for data-context build step

* fix output configurations for npm packages, add gitignores

* revert changes to config and data-context build steps

* fix outputs

* run with cache

* fix outputs for cli

* actually fix outputs

* test with cache

---------

Co-authored-by: astone123 <[email protected]>

* chore: simplify build script (#27547)

* chore: simplify build script

* update CI workflows

* fix workflows

* empty commit because Percy weirdness

* chore: add driver, reporter, config as implicit dependencies for runner package (#27559)

* run all workflows on branch

* chore: parallelize test-binary-against-recipes CI step (#27570)

* chore: fix some easy circular dependencies in dep graph (#27612)

* chore: remove gulp tasks from postinstall (#27616)

* empty commit

* chore: minor improvements to node_modules_install (#27647)

* chore: fix cypress:open and dev scripts

* run with cache [run ci]

* exclude mochaawesome assets from .yarnclean [run ci]

* bump cache again [run ci]

* run cached [run ci]

* chore: do not cache cli build step [run ci]

* update workflow command and docs for build-cli [run ci]

* fix commands that use scope [run ci]

* use different branch for publish repo [run ci]

* percy weirdness? [run ci]

* fix postbuild cli script [run ci]

* try to remove typescript from production binary [run ci]

* fix circular dependency [run ci]

* try removing ts from node_modules [run ci]

* remove typescript resolution [run ci]

* remove redundant target scripts

* update to lerna scoped commands

* remove unneeded yarn in lerna command

* try to fix Electron install in Windows workflow

---------

Co-authored-by: Jordan <[email protected]>
Co-authored-by: Dave Kasper <[email protected]>
  • Loading branch information
3 people authored Oct 4, 2023
1 parent 784f0cf commit 4c11731
Show file tree
Hide file tree
Showing 58 changed files with 1,865 additions and 1,217 deletions.
45 changes: 23 additions & 22 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ mainBuildFilters: &mainBuildFilters
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- 'publish-binary'
- 'chore/update_electron25_and_node18'
- 'lerna-optimize-tasks'

# 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
Expand All @@ -41,7 +42,8 @@ macWorkflowFilters: &darwin-workflow-filters
- 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: [ 'chore/update_electron25_and_node18', << pipeline.git.branch >> ]
- equal: [ 'chore/update_webpack_deps_to_latest_webpack4_compat', << pipeline.git.branch >> ]
- equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand All @@ -51,9 +53,10 @@ linuxArm64WorkflowFilters: &linux-arm64-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: [ 'jordanpowell88/update-angular-tsconfig-path', << pipeline.git.branch >> ]
- equal: [ 'publish-binary', << pipeline.git.branch >> ]
- equal: [ 'chore/update_electron25_and_node18', << pipeline.git.branch >> ]
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'chore/update_webpack_deps_to_latest_webpack4_compat', << pipeline.git.branch >> ]
- equal: [ 'chore/bump_loaders_and_optimize_webpack', << pipeline.git.branch >> ]
- equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand All @@ -76,7 +79,8 @@ windowsWorkflowFilters: &windows-workflow-filters
- 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: [ 'chore/update_electron25_and_node18', << pipeline.git.branch >> ]
- equal: [ 'chore/update_webpack_deps_to_latest_webpack4_compat', << pipeline.git.branch >> ]
- equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand Down Expand Up @@ -146,7 +150,7 @@ commands:
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" != "publish-binary" && "$CIRCLE_BRANCH" != "update-v8-snapshot-cache-on-develop" && "$CIRCLE_BRANCH" != "chore/update_electron25_and_node18" ]]; then
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "lerna-optimize-tasks" ]]; 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
Expand Down Expand Up @@ -223,10 +227,9 @@ commands:
description: Save entire folder as artifact for other jobs to run without reinstalling
steps:
- run:
name: Build all codegen
name: Sync Cloud Validations
command: |
source ./scripts/ensure-node.sh
yarn gulp buildProd
yarn gulp syncCloudValidations
- run:
name: Build packages
Expand Down Expand Up @@ -1175,11 +1178,7 @@ commands:
name: Build NPM package
command: |
source ./scripts/ensure-node.sh
yarn build --scope cypress
- run:
name: Copy Re-exported NPM Packages
command: node ./scripts/post-build.js
working_directory: cli
yarn lerna run build-cli
- run:
command: ls -la types
working_directory: cli/build
Expand Down Expand Up @@ -1514,6 +1513,7 @@ jobs:
- run: yarn test-scripts
# make sure packages with TypeScript can be transpiled to JS
- run: yarn lerna run build-prod --stream --concurrency 4
- run: yarn build --concurrency 4
# run unit tests from each individual package
- run: yarn test
# run type checking for each individual package
Expand Down Expand Up @@ -1897,7 +1897,7 @@ jobs:
- restore_cached_workspace
- run:
name: Build
command: yarn workspace @cypress/webpack-preprocessor build
command: yarn lerna run build --scope @cypress/webpack-preprocessor
- run:
name: Run tests
command: yarn workspace @cypress/webpack-preprocessor test
Expand Down Expand Up @@ -1955,7 +1955,7 @@ jobs:
- restore_cached_workspace
- run:
name: Build
command: yarn workspace @cypress/angular build
command: yarn lerna run build --scope @cypress/angular
- store-npm-logs

npm-react:
Expand All @@ -1964,7 +1964,7 @@ jobs:
- restore_cached_workspace
- run:
name: Build
command: yarn workspace @cypress/react build
command: yarn lerna run build --scope @cypress/react
- run:
name: Run tests
command: yarn test
Expand All @@ -1981,7 +1981,7 @@ jobs:
- restore_cached_workspace
- run:
name: Build
command: yarn workspace @cypress/vite-plugin-cypress-esm build
command: yarn lerna run build --scope @cypress/vite-plugin-cypress-esm
- run:
name: Run tests
command: yarn test
Expand All @@ -1998,7 +1998,7 @@ jobs:
- restore_cached_workspace
- run:
name: Build
command: yarn workspace @cypress/mount-utils build
command: yarn lerna run build --scope @cypress/mount-utils
- store-npm-logs

npm-grep:
Expand All @@ -2020,7 +2020,7 @@ jobs:
resource_class: small
steps:
- restore_cached_workspace
- run: yarn workspace create-cypress-tests build
- run: yarn lerna run build --scope create-cypress-tests

npm-eslint-plugin-dev:
<<: *defaults
Expand All @@ -2037,8 +2037,7 @@ jobs:
- run:
name: Build + Install
command: |
yarn workspace @cypress/schematic build
working_directory: npm/cypress-schematic
yarn lerna run build --scope @cypress/schematic
- run:
name: Run unit tests
command: |
Expand Down Expand Up @@ -2380,10 +2379,12 @@ jobs:

test-binary-against-recipes:
<<: *defaults
parallelism: 4
steps:
- test-binary-against-repo:
repo: cypress-example-recipes
command: npm run test:ci
# 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
Expand Down
49 changes: 49 additions & 0 deletions .yarnclean
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# test directories
__tests__
test
tests
powered-test

# asset directories
docs
doc
# yaml package has a `doc` folder that we need
!yaml/**/doc/*
website
images
assets
!mochawesome-report-generator/dist/assets

# examples
example
!@packages/example
examples

# code coverage directories
coverage
.nyc_output

# build scripts
Makefile
Gulpfile.js
Gruntfile.js

# configs
appveyor.yml
circle.yml
codeship-services.yml
codeship-steps.yml
wercker.yml
.tern-project
.gitattributes
.editorconfig
.*ignore
.eslintrc
.jshintrc
.flowconfig
.documentup.json
.yarn-metadata.json
.travis.yml

# misc
*.md
18 changes: 17 additions & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"clean": "node ./scripts/clean.js",
"prebuild": "yarn postinstall && node ./scripts/start-build.js",
"build": "node ./scripts/build.js",
"build-cli": "node ./scripts/build.js && node ./scripts/post-build.js",
"dtslint": "dtslint types",
"postinstall": "patch-package && node ./scripts/post-install.js",
"size": "t=\"cypress-v0.0.0.tgz\"; yarn pack --filename \"${t}\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";",
Expand Down Expand Up @@ -176,5 +176,21 @@
"nohoist": [
"@types/*"
]
},
"nx": {
"targets": {
"build-cli": {
"dependsOn": [
"prebuild"
],
"outputs": [
"{projectRoot}/types",
"{projectRoot}/build"
]
}
},
"implicitDependencies": [
"@cypress/*"
]
}
}
2 changes: 1 addition & 1 deletion guides/building-release-artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This guide has instructions for building both.
Building a new npm package is two commands:

1. Increment the version in the root `package.json`
2. `yarn build --scope cypress`
2. `yarn lerna run build-cli`

The steps above:

Expand Down
10 changes: 9 additions & 1 deletion npm/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"prebuild": "rimraf dist",
"build": "rollup -c rollup.config.mjs",
"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
"build-prod": "yarn build",
"check-ts": "tsc --noEmit",
"lint": "eslint --ext .js,.ts,.json, ."
},
Expand Down Expand Up @@ -59,6 +58,15 @@
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{workspaceRoot}/cli/angular"
]
}
}
},
"standard": {
"globals": [
"Cypress",
Expand Down
6 changes: 3 additions & 3 deletions npm/create-cypress-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "dist/src/main.js",
"scripts": {
"build": "yarn prepare-example && tsc -p ./tsconfig.json && node scripts/example copy-to ./dist/initial-template && yarn prepare-copy-templates",
"build-prod": "yarn build",
"prepare-example": "node scripts/example copy-to ./initial-template",
"prepare-copy-templates": "node scripts/copy-templates copy-to ./dist/src",
"test": "cross-env TS_NODE_PROJECT=./tsconfig.test.json mocha --config .mocharc.json './src/**/*.test.ts'",
Expand All @@ -23,14 +22,15 @@
"commander": "6.2.1",
"find-up": "5.0.0",
"fs-extra": "^9.1.0",
"inquirer": "7.3.3",
"glob": "^7.1.6",
"inquirer": "8.2.4",
"ora": "^5.1.0",
"recast": "0.20.4",
"semver": "7.3.7"
},
"devDependencies": {
"@types/babel__core": "^7.1.2",
"@types/inquirer": "7.3.1",
"@types/inquirer": "8.2.4",
"@types/mock-fs": "4.10.0",
"@types/node": "18.17.5",
"@types/ora": "^3.2.0",
Expand Down
11 changes: 11 additions & 0 deletions npm/cypress-schematic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,16 @@
"ng-add": {
"save": "devDependencies"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/src/**/*.js",
"{projectRoot}/src/**/*.d.ts",
"{projectRoot}/src/**/*.js.map"
]
}
}
},
"schematics": "./src/schematics/collection.json"
}
5 changes: 5 additions & 0 deletions npm/grep/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,10 @@
],
"publishConfig": {
"access": "public"
},
"nx": {
"implicitDependencies": [
"!cypress"
]
}
}
11 changes: 10 additions & 1 deletion npm/mount-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts": {
"build": "tsc || echo 'built, with type errors'",
"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
"build-prod": "yarn build",
"check-ts": "tsc --noEmit",
"watch": "tsc -w",
"lint": "eslint --ext .js,.ts,.json, ."
Expand All @@ -33,5 +32,15 @@
"bugs": "https://github.com/cypress-io/cypress/issues/new?template=1-bug-report.md",
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{workspaceRoot}/cli/mount-utils",
"{projectRoot}/dist"
]
}
}
}
}
13 changes: 13 additions & 0 deletions npm/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"dependsOn": [
"!@cypress/react18:build"
],
"outputs": [
"{workspaceRoot}/cli/react",
"{projectRoot}/dist"
]
}
}
},
"standard": {
"globals": [
"Cypress",
Expand Down
10 changes: 10 additions & 0 deletions npm/react18/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,15 @@
},
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{workspaceRoot}/cli/react18",
"{projectRoot}/dist"
]
}
}
}
}
Loading

5 comments on commit 4c11731

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 4c11731 Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/linux-arm64/develop-4c11731ee193b23c2667739704d261f400e5172b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 4c11731 Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/linux-x64/develop-4c11731ee193b23c2667739704d261f400e5172b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 4c11731 Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/darwin-x64/develop-4c11731ee193b23c2667739704d261f400e5172b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 4c11731 Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/win32-x64/develop-4c11731ee193b23c2667739704d261f400e5172b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 4c11731 Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/darwin-arm64/develop-4c11731ee193b23c2667739704d261f400e5172b/cypress.tgz

Please sign in to comment.