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 Bundle details as a comment in PRs #667

Closed
kuisathaverat opened this issue Mar 2, 2020 · 6 comments · Fixed by #826
Closed

Add Bundle details as a comment in PRs #667

kuisathaverat opened this issue Mar 2, 2020 · 6 comments · Fixed by #826

Comments

@kuisathaverat
Copy link
Contributor

It is interesting to have the bundle detail on a comment in PRs, something like the https://github.com/preactjs/compressed-size-action do, we have implemented a GitHub check that reports the bundle test result, so it is a matter of grab the details and put it in a GitHub comment that we should reutilize.

https://github.com/elastic/apm-agent-rum-js/blob/master/Jenkinsfile#L328-L346

@v1v
Copy link
Member

v1v commented Jun 24, 2020

We got this particular PR comment feature in place:

githubPrComment(commentFile: 'bundle.id', message: '<markdown format with the bundle details>')

I'll raise an issue in our library to support this case among some others.

@vigneshshanmugam
Copy link
Member

@v1v Awesome stuff, looking forward to seeing this in action.

@v1v
Copy link
Member

v1v commented Jun 25, 2020

What do you think with something like the below comment?

#826 (comment)

@vigneshshanmugam
Copy link
Member

@v1v Would be interested in the gzipped size of the individual asset and also a diff of the current vs master branch.

@v1v
Copy link
Member

v1v commented Jun 26, 2020

@vigneshshanmugam , what do you think the below comment?

In order to generate those details I created a specific implementation in our shared library, the one we use for adding more features in the Jenkinsfile.

How does it work?

The html bundlesize reports are transformed in json -> here

What data is populated in the comment?

  • statSize
  • gzipSize

How to compare with the master branch or another branch?

If there is a similar bundlesize.json in the master branch or the branch where the PR will be merged into then it will be compared and will add some details to the above-mentioned JSON files, for instance, the below markdown was created when comparing with the master branch and the diff column was filled with the diff:

image

NOTE: red when the size increased and green when the opposite.

The above image was generated with some mock data.

Please let me know what you think

@vigneshshanmugam
Copy link
Member

vigneshshanmugam commented Jun 26, 2020

@v1v Beautiful 🎉 , Thanks a ton for doing it. Just an small change, Lets add the diff based on gzipSize and not raw bundle size as sometimes bundle might increase but would give reduced gzip size and our bundle size reports are already based on gzipped size so its good to keep it in sync. I gave the same comments on original PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants