-
Notifications
You must be signed in to change notification settings - Fork 83
refactor(ci): Bypass Lerna and repurpose the 'test-travis' run-script #129
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
Conversation
npm run test-travis
npm run test-travis
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.
Like the refactor! I would argue that this commit ought to have a "refactor" type since it's not intended to change functionality and it doesn't add a test.
I'm not totally sure we need to bypass lerna
(build issues seem orthogonal and in fact unreproducible now).
@@ -15,12 +15,9 @@ env: | |||
- secure: WnyM4gMsi2n69O/YZUD/pYwHJXdKDcBv3Hwft2cCw52yYc+z75uuRgdaLKs4BPisckBtnR17dH7hKlPX3HWwjCoqQm1q5qNpbJrArWaEcbotWGF2YFy21ZZ4rKNQmJqdgRj6XFZhLHbncA8v2gQPK7F6GUJ0vsJF/kiTfxAUjefR23oorcKSQrh9BfOxNAYu2Ma92qlaaMmHYbBdlNDM45/EQE+LnPCfboCiJD/5zTYq4Q+XhKLPV01vUDU60pj9ckDNXyLj9X2BwMbAzGAPGE4qTAB/IrMndVsUXblsahtwKQ6yrsUrsdTASz8/3oNkImtY7fqU874jSeG3d7PNBfZs47zkXEVy73ZWNBgM9rzVS5cPaIU3wqpuBoXFntDJcdHQhNTWEYdxmtcTUmxKt5TdUzDhrrkcti2WVLabU3N52aOBeOM0XBpfLkbV+HT6oWi3bNUb+EDMHvCxOxsP4IoEDfFs9HMzNIO3mmC3+2DFbI7s2Mb2oacAut38MbJDYSDTOLL4smG8scA3E0RQO4r8+TNk4aRIMQc7vCKqz7PpbO7Aj9dXSpeHrDmIszSmEoQqmaaGsRBwbXRom2P8fB9FcTbd/wbsfgoFNEPz5DlbtCtCmt0pQMa+3myWveKH52WC5KlFijBSDjYOMUnXbLnj5fK5eKaWp+z6/qcNwU8= | |||
# BROWSER_STACK_ACCESS_KEY | |||
- secure: U0GGZw46rJowBtH9gVluIrerB40u2b3uZpH0HsOdLlsXCCaTVk4JXX/JPVPashWAFLC7Enk3UOE4ofeEpVd0wbG6CxtG9/gklc2U2tvkqsdPpFZKaRrXoUzCyyPOmHEC2mXDXctbrncmttM4APaceRfbdTBEZIIfyLJadomjWylA61szFE9IZjvJpiwJO2xa5HI9GVRu3yXJci+riJux+JsDmfJ1hNwv3waMeeg/scddUH0hfgq69ftGs8cpMlYiO20eh32S7uPF7/IJTH1fDJjVKYQZwpypkF6AeI+od5CFTY1ajb25eaBNXThLS0Bo9ZJE/8Sogvon21dEJkt/ClY6R341InbAFXZvz7jyQAisvh0I4zxcu0VUCfh7bEUl6GXMO8VJnyxHEfqB+AIT2RoMXckkhulwiNUsJYH1yJ8mjnLvZq85mWBCp4n4jg0K6Wf46lHpjnHOVpLyLyoFGfiPf90AQVL02AJ3/ia8RkMuj0Ax+AGtiTC/+wy7dsDQOif/VpBNJcx/RciQ24mYOGzAMh4GsUWnXaZ9vXSxliogVNrmIefK5invJ0omv9pIx8NZHTHYGaulh4w6JsliiEq2kH78SlyvSrcsFGTwCY97LLaxiLm/75/Zf+F7LajKC23Fbtnj/LQizitFZqGMJ09DnR52krBAeultqRq8QLM= | |||
before_script: | |||
- npm install grunt-cli -g |
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 necessary anymore?
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.
Never necessary, I think. Added an explanation to the PR summary.
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.
👍 I wonder how much instability this added. I definitely saw on at least one build that the "hang" occurred while installing grunt-cli
.
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.
I have a mild preference to keep using lerna
if we aren't sure it is actually the cause of the problem, just to avoid having so much unused stuff in this repo (alternatively, we could refactor the code to bring packages/optimizely-sdk to the top level). But as I mentioned before, the renamed scripts and removed unnecessary commands are a good thing.
@@ -15,12 +15,9 @@ env: | |||
- secure: WnyM4gMsi2n69O/YZUD/pYwHJXdKDcBv3Hwft2cCw52yYc+z75uuRgdaLKs4BPisckBtnR17dH7hKlPX3HWwjCoqQm1q5qNpbJrArWaEcbotWGF2YFy21ZZ4rKNQmJqdgRj6XFZhLHbncA8v2gQPK7F6GUJ0vsJF/kiTfxAUjefR23oorcKSQrh9BfOxNAYu2Ma92qlaaMmHYbBdlNDM45/EQE+LnPCfboCiJD/5zTYq4Q+XhKLPV01vUDU60pj9ckDNXyLj9X2BwMbAzGAPGE4qTAB/IrMndVsUXblsahtwKQ6yrsUrsdTASz8/3oNkImtY7fqU874jSeG3d7PNBfZs47zkXEVy73ZWNBgM9rzVS5cPaIU3wqpuBoXFntDJcdHQhNTWEYdxmtcTUmxKt5TdUzDhrrkcti2WVLabU3N52aOBeOM0XBpfLkbV+HT6oWi3bNUb+EDMHvCxOxsP4IoEDfFs9HMzNIO3mmC3+2DFbI7s2Mb2oacAut38MbJDYSDTOLL4smG8scA3E0RQO4r8+TNk4aRIMQc7vCKqz7PpbO7Aj9dXSpeHrDmIszSmEoQqmaaGsRBwbXRom2P8fB9FcTbd/wbsfgoFNEPz5DlbtCtCmt0pQMa+3myWveKH52WC5KlFijBSDjYOMUnXbLnj5fK5eKaWp+z6/qcNwU8= | |||
# BROWSER_STACK_ACCESS_KEY | |||
- secure: U0GGZw46rJowBtH9gVluIrerB40u2b3uZpH0HsOdLlsXCCaTVk4JXX/JPVPashWAFLC7Enk3UOE4ofeEpVd0wbG6CxtG9/gklc2U2tvkqsdPpFZKaRrXoUzCyyPOmHEC2mXDXctbrncmttM4APaceRfbdTBEZIIfyLJadomjWylA61szFE9IZjvJpiwJO2xa5HI9GVRu3yXJci+riJux+JsDmfJ1hNwv3waMeeg/scddUH0hfgq69ftGs8cpMlYiO20eh32S7uPF7/IJTH1fDJjVKYQZwpypkF6AeI+od5CFTY1ajb25eaBNXThLS0Bo9ZJE/8Sogvon21dEJkt/ClY6R341InbAFXZvz7jyQAisvh0I4zxcu0VUCfh7bEUl6GXMO8VJnyxHEfqB+AIT2RoMXckkhulwiNUsJYH1yJ8mjnLvZq85mWBCp4n4jg0K6Wf46lHpjnHOVpLyLyoFGfiPf90AQVL02AJ3/ia8RkMuj0Ax+AGtiTC/+wy7dsDQOif/VpBNJcx/RciQ24mYOGzAMh4GsUWnXaZ9vXSxliogVNrmIefK5invJ0omv9pIx8NZHTHYGaulh4w6JsliiEq2kH78SlyvSrcsFGTwCY97LLaxiLm/75/Zf+F7LajKC23Fbtnj/LQizitFZqGMJ09DnR52krBAeultqRq8QLM= | |||
before_script: | |||
- npm install grunt-cli -g |
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.
👍 I wonder how much instability this added. I definitely saw on at least one build that the "hang" occurred while installing grunt-cli
.
packages/optimizely-sdk/package.json
Outdated
@@ -6,7 +6,7 @@ | |||
"browser": "lib/index.browser.js", | |||
"scripts": { | |||
"test": "mocha ./lib/*.tests.js ./lib/**/*.tests.js ./lib/**/**/*tests.js --recursive", | |||
"test-travis": "npm run test && grunt", | |||
"test-xbrowser": "grunt", |
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.
nit: It's a little weird that the "default" grunt command is one that runs xbrowser tests specifically; I might use the specific named grunt task here, if there is one.
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.
I found it surprising too. It's defined as the default task in Gruntfile.js.
3e9bf5c
to
8d5aa5b
Compare
I hear you. I'm still kind of swayed by how bypassing lerna seems to reduce build times. That's valuable to the extent that (at least as of 2015) open source build concurrency is limited to 5. 🤷♂️ Though that argument is weakened, I think, by the fact that when this repo moves to travis-ci.com, concurrency can be boosted because it'll be linked with our paid Travis CI account:
(source) |
## Summary - Convert `prepare` hook to a (not-equivalent) `prepublishOnly`, reducing the number of times unit tests are run in `prepare`-literate builds by 1. #129 introduced a regression where unit tests stopped being run for Node.js v4 and v6. Prior to that PR, unit tests were run - v4 and v6: once - v8, v9, v10, ... (versions whose npm understands the `prepare` hook): twice After that PR was merged, the number of times unit tests were run in each build went down by 1, _for every build_. That means v4 and v6 stopped running unit tests altogether. 2faa9c4 fixed the regression by unconditionally running unit tests on all matrix-based builds (and explicitly adding a build to run xbrowser tests). With this, Node.js 8+ builds resumed running unit tests twice ([example](https://travis-ci.org/optimizely/javascript-sdk/jobs/399704185)). Regarding the `prepare` hook: npm@4 added the [`prepare`](https://docs.npmjs.com/misc/scripts#prepublish-and-prepare) hook with that fires on prepublish and postinstall. This is strange. Why run tests when someone installs the package? They see the mocha output in their shell, which is likely to surprise. This PR stops the unconventional test runs on postinstall. ## Test plan CI.
## Summary - Re-enable CI against latest Node.js 10.x release It was disabled in #101, but from the [example failure](https://travis-ci.org/optimizely/javascript-sdk/jobs/380942404) given in that PR, I suspect the bug lies in lerna. No matter now, since lerna has been bypassed since #129. ## Test plan CI
Summary
grunt
. I presume it was installed becausetest-travis
refers to it, but locally-installed executable modules are on the $PATH in run-scripts so global installation is unnecessary.test-travis
totest-xbrowser
and modify it such that it only runs cross-browser tests in BrowserStack (viagrunt
), rather than re-running unit tests headlessly+locally again withnpm test
(which is done as part of theprepare
lifecycle hook that's invoked duringnpm install
). The rename makes it clearer that the run-script could plausibly, usefully be run locally as well (say, if one was debugging a consistent failure in some browser).Lerna seems to be correlated with some recent sporadic timeout failures:
This PR
cd
's the Travis CI pipeline directly into the optimizely-sdk package's dir, and does things there. Doing so seems to reduce the mean CI time (compute time on Travis machines, not wall-clock time) from about 21 mins to 15 mins.Test plan
This PR's CI run: #288.