You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not urgent but something to keep in mind when there's time. Feel free to skip this for now.
There's a few ways we could improve performance for running builds in Travis CI.
Currently, npm's prepublish script is being used to build before publishing. However, this causes CI to build dist/ twice for each node version: once on npm install and again on npm test.
If we change it to prepublishOnly, then CI will only build once (before running tests) and the behavior of building before npm publish will be unchanged. (Note: the maintainer who publishes will need at least [email protected] for prepublishOnly to work.)
You can see the behavior by checking out this commit:
git fetch https://github.com/ScottRudiger/taxjar-node.git 02d0051c00d7323cd81907e33ab05f3eef539e4b:ci/improve-perf
git checkout ci/improve-perf
rm -r node_modules
npm install # no longer builds 'dist/'
npm test# still builds 'dist/'
npm publish --dry-run # still builds 'dist/'
Or, we could go even further and make it so CI still performs tests on dist/ but for a slightly better DX make it so dist/ is never built locally for common development tasks such as testing.
should cause Travis to still build and test against dist/. (If we go ahead with this change, we can make this cleaner by instead defining that behavior in .travis.yml.)
Instead of 4 through 10 we could skip the non-LTS Node versions for testing, except the latest. I think it’d be 6, 8, 10, 11 and maybe 12 since it was released a few days ago. Of course, we could keep 4 even though it’s out of LTS. The main idea is to skip 5, 7, and 9 to speed up the build.
Also, look into having Travis cache node_modules or use npm cit on versions where it’s available.
Other than that, I thought it might be useful to run eslint in the latest Node version and exit early if there are any linting errors. That should speed up CI significantly in those cases.
The text was updated successfully, but these errors were encountered:
This is not urgent but something to keep in mind when there's time. Feel free to skip this for now.
There's a few ways we could improve performance for running builds in Travis CI.
prepublish
script is being used to build before publishing. However, this causes CI to builddist/
twice for each node version: once onnpm install
and again onnpm test
.(Note that
tsc
runs twice.)This is because of the behavior of
prepublish
. It triggers whenevernpm install
is run within the project and onnpm publish
.prepublishOnly
, then CI will only build once (before running tests) and the behavior of building beforenpm publish
will be unchanged. (Note: the maintainer who publishes will need at least[email protected]
forprepublishOnly
to work.)You can see the behavior by checking out this commit:
dist/
but for a slightly better DX make it sodist/
is never built locally for common development tasks such as testing.Here's a proof of concept. Mocha uses
ts-node/register
to compile for tests without buildingdist/
locally. But Travis CI sets the env varCI=true
so the script"test": "if [ $CI ]; then tsc && mocha; else mocha -r ts-node/register; fi"
should cause Travis to still build and test against
dist/
. (If we go ahead with this change, we can make this cleaner by instead defining that behavior in.travis.yml
.)Check it out locally with:
Instead of 4 through 10 we could skip the non-LTS Node versions for testing, except the latest. I think it’d be 6, 8, 10, 11 and maybe 12 since it was released a few days ago. Of course, we could keep 4 even though it’s out of LTS. The main idea is to skip 5, 7, and 9 to speed up the build.
Also, look into having Travis cache
node_modules
or usenpm cit
on versions where it’s available.Other than that, I thought it might be useful to run eslint in the latest Node version and exit early if there are any linting errors. That should speed up CI significantly in those cases.
The text was updated successfully, but these errors were encountered: