GoogleChrome / lighthouse-ci

Automate running Lighthouse for every commit, viewing the changes, and preventing regressions
Apache License 2.0
6.35k stars 635 forks source link

Add badges for readme #187

Open mauriciabad opened 4 years ago

mauriciabad commented 4 years ago

It would be cool to show the scores in a badge in top of the readme.

I don't know how this could be done or if it's possible, I just want to give you the idea. 😊

By badges I mean this: https://shields.io/

I love this project, your're doing a great job!

patrickhulce commented 4 years ago

Thanks very much @mauriciabad! Great idea!

There are a few things to think through here.

How does one configure the value that's used? Do we pick from just 1 URL by default? Do we average all of them? Only support performance category? Could you use metrics instead? etc

Does this work for both temporary-public-storage and the LHCI server? Just the LHCI server?


I think my answers to this are we average all the performance scores of the tested URLs, and you can't really configure anything to start. We'd support the temporary-public-storage use case.

mauriciabad commented 4 years ago

To select the badge there could be a doc page showing all the possible ones with examples. The user would have to copy the badge text, replace some fields in the URL and paste it into his/her readme.

The URL may be something like this: https://storage.googleapis.com/lighthouse-infrastructure.appspot.com/badges/{project_name}/{page}/{category} If you skip the category field you get the average of all of them. If you skip page and category you get the average of all the pages average. Maybe start without all the granulation and just support the average of everything. Each page would be a redirect to the original image, so there are no duplicates images.

It would be awesome to have it working for both temporary-public-storage and LHCI server. But I would start with temporary storage also.

What do you think?

patrickhulce commented 4 years ago

Yeah something along those lines! Though I think we'll end up saving JSON and let shields create the images. Temporary public storage is going to have to generate static files, so to avoid combinatorial mess, we'll probably simplify to start.

mauriciabad commented 4 years ago

I found this GitHub App that already does a similar thing. Maybe It can be used as a reference.

https://github.com/marketplace/actions/lighthouse-check#screenshot-pr-comments

badges

doc-sultan commented 2 years ago

Any progress on this idea?