-
Notifications
You must be signed in to change notification settings - Fork 145
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
[Circle CI] Add test generated project job on Windows #412
Conversation
GENERATOR_PRESET: 'hello-world-test-project' | ||
command: | | ||
set GENERATOR_PRESET=hello-world-test-project | ||
node packages/pwa-kit-create-app/scripts/create-mobify-app-dev.js --outputDir generated-project-hello-world |
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.
@adamraya this looks mostly good to me.
I see that we're generating both test-project and hello-world on windows but we only build and start test-project. Should we be building hello-world after it's generated as well?
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.
@vcua-mobify The test we run here is to verify if we can successfully generate a hello-world
project.
i.e. Running the create-mobify-app-dev.js
script with the GENERATOR_PRESET=hello-world-test-project
environment variable exits with a zero exit.
This is the same test that we currently do on the develop
branch:
https://github.com/SalesforceCommerceCloud/pwa-kit/blob/develop/.circleci/config.yml#L283-L288
The change in this PR is that we now run the same test on a Linux machine and on a Windows machine.
The hello-world
project is empty, so we don't have anything to test.
If you're saying that we need to test if the hello-world project starts after testing that builds successfully, I think that could be a useful test to have, but that would be out of the scope of this PR, and we'll need to address that in a new ticket.
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.
Thanks for the answer Adam Yeah, I was wondering if we should be testing the hello-world project starts after it builds but let's save that for another ticket.
* Fix SDK's peer dependencies versioning (#432) Previously the range was matching all possible versions. Now matching React 16 and 17 only. * Node warnings with better version formatting (#410) The node version range is now taken from the engines field of the package.json, which is more readable than seeing semver's representation (>=12.0.0 <13.0.0-0||>=14.0.0 <15.0.0-0). * [Circle CI] Add test generated project job on Windows (#412) * Update config.yml * Add `generatedSFCCProjectTestWindows` test job * Test not using gtime.js script * Increase log verbosity * Run first the CI job generated project on Windows * Use outputDir generated-project * Use execSync * Update npx pwa-kit-create-app command * Use process.argv as outputDir * Test execFileSync * Add try/catch to execSync * Show npm i logging * Show npm install logs as we do in the BFH branch * Show verdaccio logs * More logs npm install verbose * Use Node child_process & Update verdaccio config & bump version * Use verdaccio npmjs cache true * Set GENERATOR_PRESET env variable * Update create-mobify-app.js * Test using a xlarge Windows machine * Increase Verdaccio max_fails config * Remove server keepAliveTimeout * Dump all Verdaccio logs to a file for debugging * Fix smoketestscripts on Windows * Add Circle CI unit to the scripts path * Really fix smoketestscripts Circle CI job on Windows * Update config.yml * More testing smoke test script on Windows * And more testing smoke test script on Windows * smoketestscripts job working on Windows * fix typo * Clean up * More clean up * Update latest v4 verdaccio * Remove file from bad merge Co-authored-by: Vincent Marta <vmarta@salesforce.com>
GUS: https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07EE00000mBHOTYA4/view
Description
The PR adds a new Circle CI job to generate a project from the monorepo on a Windows Circle CI machine.
Problem
Previously the Verdaccio configuration was set to output the Verdaccio logs to the terminal.
The
create-mobify-app-dev.js
script read the logs outputted to the terminal, waiting for Verdaccio to be up and running before proceeding with the rest of the promise chain. The script also created averdaccio.log
file with some of the logs printed in the terminal.The script first publishes the existing versions
pwa-kit-create-app
andpwa-kit-react-sdk
monorepo packages to the local npm repository Verdaccio. Then generates a project from the packages that we just published to the local npm repository using the commandnpx pwa-kit-create-app
and finally runs tests on the generated project.A more detailed description of the
create-mobify-app-dev.js
script can be found here.That approach was not working on a Windows Circle CI machine. The process hung without any output for more than 10 min.
(Optional see failed test on previous commits of this branch).
Potentially the problem was related to the terminal output piping between the different processes run in the promise chain. The Verdaccio logs were overwritten and lost by the following processes output in the promises, ending in a situation where the script didn't output any output and nor the expected non-zero exit by Circle CI.
Solution
The Verdaccio configuration has been updated to output all the Verdaccio's logs to a
verdaccio.log
file using the native Verdaccio functionality.The
create-mobify-app-dev.js
script now monitors theverdaccio.log
file content and waits until Verdaccio is ready before continuing with the rest of the promise chain.The generated project
npm install
progress is now visible like we did on V2 (BFH branch).Types of Changes
Changes
generate_and_test_project
step in the Circle CI config to be used by the test jobs (generatedSFCCProjectTestWindows
andgeneratedSFCCProjectTestWindows
) running on Linux and Windows machines.verdaccio.log
file.create-mobify-app-dev.js
script now monitors theverdaccio.log
file instead of the terminal.shelljs
with Nodechild_process
for some processed that were stuck on Windows.npm install
progress is now visible.How to Test-Drive This PR
generatedSFCCProjectTestWindows
and verify that works as expected. https://circleci.com/gh/SalesforceCommerceCloud/pwa-kit/9978?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link(Optional) Manually run the
create-mobify-app-dev.js
script.Mac:
Windows:
Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization