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

Add bundlesize #5810

Merged
merged 1 commit into from
Aug 6, 2018
Merged

Add bundlesize #5810

merged 1 commit into from
Aug 6, 2018

Conversation

willdurand
Copy link
Member

Fix mozilla/addons#10656
Fix mozilla/addons#10534


I was curious to see what bundlesize could do.

This PR updates the build commands and removes the undocumented
ADDONS_FRONTEND_BUILD_ALL environment variable.

Bundlesize checks both amo and disco apps. I also added FORCE_COLOR=0
to remove some colors in the logs (bundlesize and chalk calls), since
logs are big and we need the raw output every time.

Output on Travis-CI
> [email protected] bundlesize /home/travis/build/mozilla/addons-frontend
> bundlesize

 WARN  github token not found

    You are missing out on some cool features.
    Read more here: https://github.com/siddharthkp/bundlesize#2-build-status


 PASS  ./dist/amo-009847d7cf65fb8e5c9c.js: 390.8KB < maxSize 400KB (gzip)

 PASS  ./dist/disco-1bfe4c86108fb9d59150.js: 237.55KB < maxSize 400KB (gzip)

 PASS  ./dist/amo-i18n-af-2f7a9fcd720a713fccc4.js: 9.01KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-ar-dd2688a8e7055065363f.js: 17.94KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-ast-c3d1b031c00ac844f335.js: 7.84KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-az-ba1a5d7dd89f7c588065.js: 10.19KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-bg-eadc93a21a7fc48ec248.js: 15.48KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-bn_BD-627a1bb8de7bbcf79703.js: 11.8KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-bs-56e8664cd845ba280a0c.js: 15.92KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-ca-09c1b7736f19663aa1a0.js: 9.29KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-cak-3d0c5170b7f09cd54c0e.js: 14.31KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-cs-d0a39fce159658fb6180.js: 17.19KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-da-8b86e1f7b7fc252c1944.js: 16.19KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-dbl-98c0d0a4d3f5abe731ee.js: 18.73KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-dbr-e36917fc63b608a65b6c.js: 17.71KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-de-81219cc072f33cd5f02a.js: 17.83KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-dsb-506522bf9b540a52117d.js: 17.58KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-el-9c388da92d738e9db297.js: 16.56KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-en_GB-21d83fdb52fb6fb5f0f4.js: 9.86KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-en_US-174bad66409eb9b1fcc1.js: 7.64KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-es-a3b33cf40cbf0a02272f.js: 17.06KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-eu-df8d2c5468efe2cb956d.js: 8.98KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-fa-ff2e8c82975c8c7e4f2c.js: 13.03KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-fi-6e594f50ed42f57dae82.js: 16.95KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-fr-b27f34a7d45d720bb6a7.js: 16.96KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-fy_NL-3ad5ced4fc53ce83fb22.js: 16.36KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-ga_IE-36727cec6ebd0b580686.js: 9.15KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-he-c506cdbfbd654962c802.js: 17.97KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-hsb-a19a57e5d47e585e30eb.js: 17.5KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-hu-9cee42ab4f2c9fcb7910.js: 18.38KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-id-aa7b404303a2cc74d212.js: 15.63KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-it-b4041c856cb40a18bd33.js: 16.79KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-ja-5b8706455e60c897e63f.js: 18.59KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-ka-c69011d5c013070a2d14.js: 20.55KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-kab-56fd115d596eaa26736b.js: 16.6KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-ko-95c77fd32fc28fa8eeac.js: 11.38KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-mk-0a4b49349ae5de4990b5.js: 10.31KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-mn-ed339dd286fd83b1775e.js: 9.45KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-ms-64124b280ecbef9f1c3e.js: 16.46KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-nb_NO-0fb69669a545d90c5185.js: 10.13KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-nl-dc493b601c5eb274ee20.js: 17.17KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-nn_NO-edf10eff618d057d4fd4.js: 13.54KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-pl-a04c50fab47db3e2acdf.js: 17.96KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-pt_BR-302a53de07e2069c83f1.js: 17.2KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-pt_PT-9fe2d55deab1c0f2782c.js: 16.41KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-ro-8b9f8c5e7b285272b428.js: 11.7KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-ru-96ec9ed3b6e432622d74.js: 21.29KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-sk-1f8291e3dd8c56cec34a.js: 14.05KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-sl-0efbb29f96d19e9f23bd.js: 17.7KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-sq-47775a8c13475f222a5e.js: 15.56KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-sv_SE-27fa35c8d6d086a5cacc.js: 16.2KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-te-4a6c1519ef3eb5301bd0.js: 13.71KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-th-ac6fb52fcd3df876d35d.js: 13.67KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-tr-966c41d25d336090d15f.js: 16.8KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-uk-8dcbec1d69f15bd98d8b.js: 20.68KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-ur-36c54460b7d0d24ae54b.js: 11.02KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-vi-2342ed3cfd7684a59ac2.js: 9.67KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-zh_CN-1556c3643542d63d985f.js: 17.78KB < maxSize 25KB (gzip)

 PASS  ./dist/amo-i18n-zh_TW-575f5e0f8fb522599ed0.js: 17.87KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-af-570285dd801612de7adf.js: 964B < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-ar-34859c621a59c7b4a939.js: 1.73KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-ast-c62a6ed3c6248dfa53c8.js: 1.44KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-az-ff710506fc6793d42294.js: 1.02KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-bg-77a32ecbc79e18ae5c33.js: 1.93KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-bn_BD-d85a1ebf9fc703ae4bc6.js: 2.02KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-bs-fbe6d8eb9d67c1a8aaf0.js: 1.74KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-ca-edb7ede1e4c11bcb1a44.js: 961B < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-cak-efdcfa4abb7e8a6bdbf2.js: 1.7KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-cs-eb8ff29af3e5d8ab4fab.js: 1.87KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-da-fb38b8cf8138621b4d79.js: 1.6KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-dbl-39980f3b8288ac6d3c9f.js: 2.02KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-dbr-a0ecec08783dde1e2ad8.js: 1.93KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-de-a57ddb80df462c45ac10.js: 1.73KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-dsb-76f6fc1b8d9320b2f7ca.js: 1.86KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-el-8d1e3fbf733158bd5e50.js: 2.17KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-en_GB-a54d826ae2e55a629099.js: 1.11KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-en_US-51e57ccb6cf954ce9854.js: 1.09KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-es-a7ba49fda769c9cb9ae2.js: 1.65KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-eu-322644ad1a14ec75d449.js: 964B < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-fa-7423d38234ab73d3d26b.js: 1.99KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-fi-7e52e0961ab702f2989e.js: 1.72KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-fr-7112a0dc656b5bdb3cf4.js: 1.7KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-fy_NL-4bef9837c13d9ee367f8.js: 1.71KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-ga_IE-319500bafbecf9aaae50.js: 1.69KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-he-245d25dd71ccd6b4e1d4.js: 1.85KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-hsb-95289e1a8907eec923df.js: 1.86KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-hu-66a66d5993cca8cde5bf.js: 1.84KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-id-79acc60bd1fb9a79fe58.js: 1.63KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-it-1bc2e858bb09b44aee43.js: 1.76KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-ja-7c6e8ab69516f7ae9065.js: 2.01KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-ka-e2568e2f0a6eefeca96e.js: 2.16KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-kab-95121a388daa43479391.js: 1.68KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-ko-57e913f74654741bd1dd.js: 1.86KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-mk-31acc3288a31c150a497.js: 964B < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-mn-32a696fe5947066a0061.js: 965B < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-ms-bf5b08b349ae625b076f.js: 1.61KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-nb_NO-c37798d73491c04acbcd.js: 1.64KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-nl-ba051fc514777e34ebb7.js: 1.68KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-nn_NO-4bd92f3a063dd56126cd.js: 1.59KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-pl-acf5bb6c05999d8958be.js: 1.81KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-pt_BR-d7d357b3514658e3d7ca.js: 1.68KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-pt_PT-24c0675dbcafe8e9654a.js: 1.68KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-ro-891355ce9a9db6a00939.js: 1.53KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-ru-99fffd1b9d9e97456841.js: 2.16KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-sk-0dcba5912c2715a05b68.js: 1.8KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-sl-ce439c87788affa4dab9.js: 1.76KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-sq-7aee9e8a0c415268787d.js: 1.71KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-sv_SE-2dcc556d0eb8ed7c66d1.js: 1.67KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-te-e79e5b0794ee7a47fd1a.js: 1.53KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-th-ab2c2f6664f107aecc3a.js: 1.91KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-tr-300850294d951ff20084.js: 1.73KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-uk-c04ba53205740106ea5e.js: 2.12KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-ur-2058f8921676832e1209.js: 1.43KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-vi-4c4f5ad47de3e07e88e4.js: 1.53KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-zh_CN-d4e55a512907cd4502b0.js: 1.87KB < maxSize 25KB (gzip)

 PASS  ./dist/disco-i18n-zh_TW-d191c6e0b08a7ba7fce9.js: 1.83KB < maxSize 25KB (gzip)

Done in 137.85s.

@codecov-io
Copy link

codecov-io commented Aug 1, 2018

Codecov Report

Merging #5810 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    mozilla/addons-frontend#5810   +/-   ##
=======================================
  Coverage   97.72%   97.72%           
=======================================
  Files         228      228           
  Lines        5722     5722           
  Branches     1101     1101           
=======================================
  Hits         5592     5592           
  Misses        115      115           
  Partials       15       15

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 30e7a0a...c6265e8. Read the comment docs.

@willdurand willdurand requested a review from kumar303 August 1, 2018 15:56
Copy link
Contributor

@kumar303 kumar303 left a comment

Choose a reason for hiding this comment

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

I like the approach -- seems simple.

Did you read this issue? siddharthkp/bundlesize#93 Looks like it's still open. I guess we need to set up a github token as a workaround.

@@ -25,16 +25,16 @@ cache:

# Allow to display job names on Travis-CI, see:
# https://github.com/travis-ci/travis-ci/issues/5898#issuecomment-362490313
script: yarn $COMMAND
script: FORCE_COLOR=0 yarn $COMMAND
Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea

@@ -8,8 +8,12 @@
"node": ">=6 <=8"
},
"scripts": {
"build": "bin/build-checks.js && better-npm-run build",
"build": "npm run clean && better-npm-run build",
"build-all": "npm run clean && NODE_APP_INSTANCE=amo better-npm-run build && NODE_APP_INSTANCE=disco better-npm-run build",
Copy link
Contributor

Choose a reason for hiding this comment

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

But what if we add a new app??! I'm only kidding. I hope we never do that.

@willdurand
Copy link
Member Author

Did you read this issue? siddharthkp/bundlesize#93 Looks like it's still open. I guess we need to set up a github token as a workaround.

I did but is it still needed? Is it for the PR integration? The build will fail if it goes above the limit, so we are good I think.

We need a token with a lot of permissions and I cannot setup one myself, not enough rights.

@kumar303
Copy link
Contributor

kumar303 commented Aug 2, 2018

When you merge this PR to master, it will fail because of that issue. We need to think of a workaround before merging this. I think I looked into setting up a token but a Mozilla admin I talked to was reluctant because it gives a lot of access rights to their repo. I don't recall the details and maybe it has changed since.

@willdurand
Copy link
Member Author

When you merge this PR to master, it will fail because of that issue. We need to think of a workaround before merging this. I think I looked into setting up a token but a Mozilla admin I talked to was reluctant because it gives a lot of access rights to their repo. I don't recall the details and maybe it has changed since.

I am not sure to follow because the "pr" build is green too. When there is no github token in the env (which is the case), there is no issue like the one you reported.

@kumar303
Copy link
Contributor

kumar303 commented Aug 2, 2018

I am not sure to follow because the "pr" build is green too.

It's only green because it's on a branch. They have a bug in there code that only affects builds running on the master branch.

When there is no github token in the env (which is the case), there is no issue...

Not having a github token is what triggers the issue.

Here was my original patch that passed in a branch but failed when it landed on master: https://github.com/mozilla/addons-frontend/pull/2920/files

@willdurand
Copy link
Member Author

Not having a github token is what triggers the issue.

Here was my original patch that passed in a branch but failed when it landed on master: /pull/2920/files

@kumar303 Are you sure there was not a token set? I removed a github token in our Travis CI settings yesterday. I think your branch passed because you submitted it from a fork (no secret vars available) and did not pass on master because of the github token set. See this line: https://travis-ci.org/mozilla/addons-frontend/jobs/262798346#L1448

I am still investigating but I don't see where in the code the master branch is handled differently.

@willdurand
Copy link
Member Author

I am still investigating but I don't see where in the code the master branch is handled differently.

So I believe it works because the previous PR had a polluted travis-ci environment.

@willdurand willdurand requested a review from kumar303 August 3, 2018 19:56
Copy link
Contributor

@kumar303 kumar303 left a comment

Choose a reason for hiding this comment

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

So I believe it works because the previous PR had a polluted travis-ci environment.

🤷‍♀️ OK, let's try it and see if it breaks.

@willdurand willdurand merged commit f8d1f2c into master Aug 6, 2018
@willdurand willdurand deleted the bundlesize branch August 6, 2018 19:27
@kumar303
Copy link
Contributor

kumar303 commented Aug 6, 2018

Cool! It didn't fail on master 😅

@willdurand
Copy link
Member Author

Cool! It didn't fail on master 😅

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.

Cannot build locale bundles for all apps Try out bundlesize to track the size of our assets
3 participants