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

fix: windows build #20854

Merged
merged 15 commits into from
Apr 4, 2022
Merged

fix: windows build #20854

merged 15 commits into from
Apr 4, 2022

Conversation

estrada9166
Copy link
Member

@estrada9166 estrada9166 commented Mar 30, 2022

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 for rimraf 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

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 30, 2022

Thanks for taking the time to open a PR!

@estrada9166 estrada9166 marked this pull request as ready for review March 31, 2022 15:24
@cypress
Copy link

cypress bot commented Mar 31, 2022



Test summary

17792 0 217 0Flakiness 2


Run details

Project cypress
Status Passed
Commit 95dfb13
Started Apr 4, 2022 3:29 PM
Ended Apr 4, 2022 3:41 PM
Duration 11:49 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/e2e/commands/xhr.cy.js Flakiness
1 ... > no status when request isnt forced 404
2 src/cy/commands/xhr > abort > aborts xhrs currently in flight

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

@elevatebart
Copy link
Contributor

I believe bash was already required for run-if-not-ci.sh

elevatebart
elevatebart previously approved these changes Mar 31, 2022
@elevatebart
Copy link
Contributor

I like TypeScript as it is easier to debug than bash.

@estrada9166 estrada9166 marked this pull request as draft March 31, 2022 16:15
@estrada9166 estrada9166 changed the title fix: update icons build to work on windows fix: windows build Mar 31, 2022

await exec('yarn tsc -p ./tsconfig.build.json')

if (os.platform() === 'darwin') {
Copy link
Contributor

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

Copy link
Contributor

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.

@estrada9166 estrada9166 marked this pull request as ready for review March 31, 2022 22:11
@estrada9166 estrada9166 requested review from a team as code owners March 31, 2022 22:11
elevatebart
elevatebart previously approved these changes Mar 31, 2022
@@ -40,7 +40,7 @@
"effective:circle:config": "circleci config process circle.yml | sed /^#/d",
Copy link
Contributor

@tbiethman tbiethman Mar 31, 2022

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

"clean-deps": "find . -depth -name node_modules -type d -exec rm -rf {} \\;",

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah! I didn't changed bc it was changed 2 years ago and seems not to be an issue - but may worth it changing to be consistent across all the packages

image

"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'",
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems those are actively used - the screenshot is running yarn in 10.0-release branch

image

Copy link
Contributor

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.

Copy link
Contributor

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.

elevatebart
elevatebart previously approved these changes Apr 1, 2022
elevatebart
elevatebart previously approved these changes Apr 1, 2022
@lmiller1990 lmiller1990 self-requested a review April 3, 2022 20:57
lmiller1990
lmiller1990 previously approved these changes Apr 3, 2022
Copy link
Contributor

@lmiller1990 lmiller1990 left a 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?

@elevatebart
Copy link
Contributor

I tested it on windows.

@lmiller1990
Copy link
Contributor

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 🙏

@marktnoonan
Copy link
Contributor

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 circle.yml, I will update with results when they have completed.

Copy link
Contributor

@marktnoonan marktnoonan left a 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.

const os = require('os')
const { execSync } = require('child_process')

if (os.platform() === 'win32' && !process.env.CI) {
Copy link
Contributor

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

Copy link
Contributor

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',
})

@estrada9166 estrada9166 dismissed stale reviews from lmiller1990 and elevatebart via 9e121d8 April 4, 2022 14:58
tbiethman
tbiethman previously approved these changes Apr 4, 2022
Copy link
Contributor

@marktnoonan marktnoonan left a 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.

@estrada9166 estrada9166 merged commit e6cbc5a into 10.0-release Apr 4, 2022
@estrada9166 estrada9166 deleted the alejandro/fix/fix-windows-build branch April 4, 2022 16:12
ryanthemanuel pushed a commit that referenced this pull request Apr 4, 2022
* 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)
ryanthemanuel pushed a commit that referenced this pull request Apr 4, 2022
* 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)
tgriesser added a commit that referenced this pull request Apr 5, 2022
* 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
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants