-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
fix: windows build #20854
fix: windows build #20854
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ Flakiness
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
I believe bash was already required for |
I like TypeScript as it is easier to debug than bash. |
|
||
await exec('yarn tsc -p ./tsconfig.build.json') | ||
|
||
if (os.platform() === 'darwin') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR, but does this platform specific build have any effect on what the binary expects? When we build the Cypress binary for windows, will it have dist/icons/cypress.icns
available and is it needed? Maybe @elevatebart has an idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ZachJW34, the answer is no and it does not need it. the only moment where we "need" the icns file is when we package the electron app for mac. icns
is the mac specific icon format that contains multiple definitions. Since this electron app can only be built and signed on Mac, I am not afraid of this happening.
@@ -40,7 +40,7 @@ | |||
"effective:circle:config": "circleci config process circle.yml | sed /^#/d", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'clean-deps' command here at root is still using rm
Line 21 in 9f921a0
"clean-deps": "find . -depth -name node_modules -type d -exec rm -rf {} \\;", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/config/package.json
Outdated
"clean-deps": "rm -rf node_modules", | ||
"clean": "rm -f ./src/*.js ./src/**/*.js ./src/**/**/*.js ./test/**/*.js || echo 'cleaned'", | ||
"clean-deps": "rimraf node_modules", | ||
"clean": "rimraf ./src/*.js ./src/**/*.js ./src/**/**/*.js ./test/**/*.js || echo 'cleaned'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These clean commands that delete implementation files are wild; are they actively used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we don't use dist folders at cypress to avoid navigating to type files when changing packages. source maps would be a solution, but it does not seem to be one we considered for dev. we prefer using ts-node.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we run build-prod, on local, it will create a bunch of files that need to be cleaned up.
…io/cypress into alejandro/fix/fix-windows-build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code seems fine but how did you test this on windows? Are you using windows? Should we enable windows for this PR using circle.yml
to see if it actually all works?
I tested it on windows. |
Ok - so once this merges, and windows runs on the 10.0-release it should be green? Are there any outstanding windows problems? I'll leave merging this to @estrada9166 🙏 |
I'm going to make a branch off of this now that runs the windows tests, so we can see them run in CI before merging to 10.0-release without modifying this branch's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we need a little more logic in scripts/run-postInstall.js
- or just to remove the CI check, I haven't looked in detail yet, just wanted to make sure we don't merge yet. I'll look into it a bit more and try some changes on the win-fix-windows-build-ci
branch. If that starts passing I'll make a PR into this with the changes.
scripts/run-postInstall.js
Outdated
const os = require('os') | ||
const { execSync } = require('child_process') | ||
|
||
if (os.platform() === 'win32' && !process.env.CI) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excluding CI for this caused the postinstall
step in the windows-node-modules-install
job to fail on Windows in CI due to the non-windows version of this code running. Can we remove the CI check safely, or do we need another condition for windows on CI?
Here is a copy run based on a copy of this branch with windows tests enabled in CI. We see this error:
Error: Command failed: patch-package && ./scripts/run-if-not-ci.sh yarn-deduplicate --strategy=highest && yarn clean && gulp postinstall && ./scripts/run-if-not-ci.sh yarn build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed this can be fixed with an extra conditional, but with that in mind the whole file can be simplified, since we are only splitting things up due to the pattern of using ./scripts/run-if-not-ci.sh
.
I'd like to propose removing run-if-not-ci.sh
completely and just having a CI version and local version of what we want, that works on all platforms:
const { execSync } = require('child_process')
const executionEnv = process.env.CI ? 'ci' : 'local'
const postInstallCommands = {
local: 'patch-package && yarn-deduplicate --strategy=highest && yarn clean && gulp postinstall && yarn build',
ci: 'patch-package && yarn clean && gulp postinstall',
}
execSync(postInstallCommands[executionEnv], {
stdio: 'inherit',
})
9e121d8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving this now as the windows build succeeds, I expect a few windows tests may continue to fail in CI after this PR based on letting CI run already in a different branch, but that's fine, this PR is not intended to fix all outstanding windows test issues.
* fix: update icons build to work on windows * Add rimraf * Update scripts * Update script * Update scripts * Fix windows migration * Update postinstall script * Remove script (cherry picked from commit e6cbc5a)
* fix: update icons build to work on windows * Add rimraf * Update scripts * Update script * Update scripts * Fix windows migration * Update postinstall script * Remove script (cherry picked from commit e6cbc5a)
* 10.0-release: (92 commits) chore: remove dependency-tree dep (#20905) chore(launchpad): work on infra for scaffold tests (#20818) fix: build mjs in the cli (#20889) fix(unify): Cypress version link should point to Cypress doc's changelog (#20869) fix: windows build (#20854) fix: add index.mjs to the published files of cli (#20884) refactor: lift indexHtmlFile up to component, add validation (#20870) fix: allow migration of pluginsFile using `env` properties (#20770) fix: viewport from CLI on CT (#20849) Don't communicate if process isn't connected Remove config.get Update packages/data-context/src/data/ProjectLifecycleManager.ts fix: git data source unit test failure (#20875) add comment for autoBindDebug fix: Ensuring current browser is synchronized between app and launchpad (#20830) Fix missed await on merge conflict resolution test(unification): move record keys to contexts (#20860) test: move record keys to contexts (#20859) PR comments Fix tests that visit app without a configured testing type ...
User facing changelog
Additional details
Currently, the build on windows machines is not working as expected because there's a bash script that is not supported unless extra packages are installed on the machine.
Also,
rm
is not supported at all, so there's the need to update the usage of it forrimraf
which is fully supported!Update failing migration test where the file path is not matching on windows machines
How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?