Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 9d5d8ef

Browse files
refactor(ci): Bypass Lerna and repurpose the 'test-travis' run-script (optimizely#129)
## Summary - Bypass Lerna things in CI - Don't install `grunt`. I presume it was installed because `test-travis` refers to it, but locally-installed executable modules are on the $PATH in run-scripts so global installation is unnecessary. - Rename `test-travis` to `test-xbrowser` and modify it such that it only runs cross-browser tests in BrowserStack (via `grunt`), rather than re-running unit tests headlessly+locally _again_ with `npm test` (which is done as part of the `prepare` lifecycle hook that's invoked during `npm 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: - https://travis-ci.org/optimizely/javascript-sdk/jobs/397898591 - https://travis-ci.org/optimizely/javascript-sdk/jobs/397898592 - https://travis-ci.org/optimizely/javascript-sdk/jobs/397568472 - https://travis-ci.org/optimizely/javascript-sdk/jobs/397568474 - https://travis-ci.org/optimizely/javascript-sdk/jobs/396745267 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: [optimizely#288](https://travis-ci.org/optimizely/javascript-sdk/builds/397977186).
1 parent 2389345 commit 9d5d8ef

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

.travis.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ env:
1515
- secure: WnyM4gMsi2n69O/YZUD/pYwHJXdKDcBv3Hwft2cCw52yYc+z75uuRgdaLKs4BPisckBtnR17dH7hKlPX3HWwjCoqQm1q5qNpbJrArWaEcbotWGF2YFy21ZZ4rKNQmJqdgRj6XFZhLHbncA8v2gQPK7F6GUJ0vsJF/kiTfxAUjefR23oorcKSQrh9BfOxNAYu2Ma92qlaaMmHYbBdlNDM45/EQE+LnPCfboCiJD/5zTYq4Q+XhKLPV01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axiLm/75/Zf+F7LajKC23Fbtnj/LQizitFZqGMJ09DnR52krBAeultqRq8QLM=
18-
before_script:
19-
- npm install grunt-cli -g
18+
before_install: cd packages/optimizely-sdk
2019
install: npm install
2120
addons:
2221
srcclr: true
23-
script:
24-
- npm run test-travis
25-
after_success:
26-
- npm run coveralls
22+
script: npm run test-xbrowser
23+
after_success: npm run coveralls

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"clean": "lerna run clean",
88
"publish": "lerna publish",
99
"test": "lerna run test --stream",
10-
"test-travis": "lerna run test-travis --stream"
10+
"test-xbrowser": "lerna run test-xbrowser --stream"
1111
},
1212
"devDependencies": {
1313
"lerna": "^2.9.0"

packages/optimizely-sdk/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ The browser bundles also come with a minified / production-ready version.
6565

6666
The .yml of this project contains environment vairables for ```BROWSER_STACK_USERNAME``` and ```BROWSER_STACK_ACCESS_KEY```.
6767

68-
These variables, created in BrowserStack, are encrypted by the TravisCI public key. This is done directly with the TravisCI command line tools; for additional information see travis encrypt-file.
68+
These variables, created in BrowserStack, are encrypted by the Travis CI public key. This is done directly with the Travis CI command line tools; for additional information see travis encrypt-file.

packages/optimizely-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"browser": "lib/index.browser.js",
77
"scripts": {
88
"test": "mocha ./lib/*.tests.js ./lib/**/*.tests.js ./lib/**/**/*tests.js --recursive",
9-
"test-travis": "npm run test && grunt",
9+
"test-xbrowser": "grunt karma",
1010
"lint": "eslint lib/**",
1111
"cover": "istanbul cover _mocha ./lib/*.tests.js ./lib/**/*.tests.js ./lib/**/**/*tests.js",
1212
"coveralls": "npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls",

0 commit comments

Comments
 (0)