Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: optimize task execution #27848

Merged
merged 37 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
29cd85c
Revert "chore: simplify build script (#27547)"
astone123 Aug 17, 2023
54285be
Revert "chore: upgrade lerna to 6, cache build step (#26913)"
astone123 Aug 17, 2023
bff487d
[run ci]
astone123 Aug 17, 2023
56d5b74
chore: upgrade lerna to 6, cache build step (#26913)
jordanpowell88 Aug 10, 2023
e8fee7e
chore: simplify build script (#27547)
astone123 Aug 15, 2023
ec1c09f
chore: add driver, reporter, config as implicit dependencies for runn…
astone123 Aug 16, 2023
f76b3de
run all workflows on branch
astone123 Aug 17, 2023
143b23f
chore: parallelize test-binary-against-recipes CI step (#27570)
astone123 Aug 18, 2023
23559cc
chore: fix some easy circular dependencies in dep graph (#27612)
astone123 Aug 22, 2023
1de6d84
chore: remove gulp tasks from postinstall (#27616)
astone123 Aug 22, 2023
0263696
empty commit
astone123 Aug 22, 2023
53c9c90
chore: minor improvements to node_modules_install (#27647)
astone123 Aug 24, 2023
6caa15b
chore: fix cypress:open and dev scripts
astone123 Aug 24, 2023
efec954
run with cache [run ci]
astone123 Aug 24, 2023
7af9f61
exclude mochaawesome assets from .yarnclean [run ci]
astone123 Aug 24, 2023
c6aefd6
bump cache again [run ci]
astone123 Aug 24, 2023
54046a9
Merge branch 'develop' into lerna-optimize-tasks
astone123 Sep 12, 2023
9bc5344
run cached [run ci]
astone123 Sep 13, 2023
414d3ba
chore: do not cache cli build step [run ci]
astone123 Sep 13, 2023
c2ee0dc
update workflow command and docs for build-cli [run ci]
astone123 Sep 13, 2023
94d36f1
fix commands that use scope [run ci]
astone123 Sep 13, 2023
724f407
use different branch for publish repo [run ci]
astone123 Sep 13, 2023
8cb63cf
percy weirdness? [run ci]
astone123 Sep 14, 2023
8f47466
fix postbuild cli script [run ci]
astone123 Sep 14, 2023
9be1b89
Merge branch 'develop' into lerna-optimize-tasks
astone123 Sep 19, 2023
f3ea19f
try to remove typescript from production binary [run ci]
astone123 Sep 19, 2023
918dcc2
fix circular dependency [run ci]
astone123 Sep 19, 2023
40d92d4
try removing ts from node_modules [run ci]
astone123 Sep 19, 2023
29fea42
remove typescript resolution [run ci]
astone123 Sep 19, 2023
8b5e904
Merge branch 'develop' into lerna-optimize-tasks
astone123 Sep 19, 2023
28e904d
Merge branch 'develop' into lerna-optimize-tasks
astone123 Sep 26, 2023
6dd0045
Merge branch 'develop' into lerna-optimize-tasks
astone123 Oct 2, 2023
dfec4ad
Merge branch 'develop' into lerna-optimize-tasks
dkasper-was-taken Oct 3, 2023
ea62272
remove redundant target scripts
dkasper-was-taken Oct 3, 2023
39981ce
update to lerna scoped commands
dkasper-was-taken Oct 3, 2023
1e066de
remove unneeded yarn in lerna command
dkasper-was-taken Oct 3, 2023
0caf3fd
try to fix Electron install in Windows workflow
astone123 Oct 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1194,11 +1197,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 @@ -1533,6 +1532,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 @@ -1916,7 +1916,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 @@ -1974,7 +1974,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 @@ -1983,7 +1983,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 @@ -2000,7 +2000,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 @@ -2017,7 +2017,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 @@ -2039,7 +2039,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 @@ -2056,8 +2056,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 @@ -2400,10 +2399,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
13 changes: 12 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,18 @@
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"inputs": [
"{workspaceRoot}/scripts"
],
"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"
]
}
}
14 changes: 13 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,18 @@
"bugs": "https://github.com/cypress-io/cypress/issues/new?template=1-bug-report.md",
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"inputs": [
"{workspaceRoot}/scripts"
],
"outputs": [
"{workspaceRoot}/cli/mount-utils",
"{projectRoot}/dist"
]
}
}
}
}
16 changes: 16 additions & 0 deletions npm/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"dependsOn": [
"!@cypress/react18:build"
],
"inputs": [
"{workspaceRoot}/scripts"
dkasper-was-taken marked this conversation as resolved.
Show resolved Hide resolved
],
"outputs": [
"{workspaceRoot}/cli/react",
"{projectRoot}/dist"
]
}
}
},
"standard": {
"globals": [
"Cypress",
Expand Down
Loading
Loading