treosh / lighthouse-ci-action

Audit URLs using Lighthouse and test performance with Lighthouse CI.
MIT License
1.16k stars 82 forks source link

Netlify integration #30

Closed denar90 closed 4 years ago

denar90 commented 4 years ago

Add support for integration with Netlify Preview Site deploy

User changes stuff for the site and creates PR -> Netlify deploy Preview site -> Action do the check against Preview site and show send notification via github/slack

image

Example I tested stuff


Todo:


P.S. I'll squash commits after final round of feedback :)

denar90 commented 4 years ago

Yay! Ping works Test workflow - https://github.com/test-denar/one-click-hugo-cms-3/runs/463513341?check_suite_focus=true image

denar90 commented 4 years ago

@exterkamp can I ask you to take a look? 👀

denar90 commented 4 years ago

Can I provide urls that go to a single netlify site, or multiple sites? Can I mix netlify sites and regular sites?

What's the use case, using Netlify urls, and some other urls in scope of one repository? My intention was the next, if user has deployed netlify site from github, then in scope this repo he/she can use action for that urls.


Why do we need a netlifySite param?

Sorry that's my bad, I'll update doc. So, Netlify site can have custom domain, and in this case we can't compose preview url properly. Thank you for bringing it up, It's a really good point because I haven't tested this one yet 👍

image

However, then how do you mix preview-deploy URLs and normal netlify hosted URLs? Is this something we want to support.

I think it's good to have support of real site and preview. Preview is composed based on PR info - https://github.com/treosh/lighthouse-ci-action/blob/5935285d5a6fe3043aabac7a211d73e5db99fa11/src/input.js#L130-L136

If it's a master, aka action config for push event, url will be like https://master--practical-allen-be16f3.netlify.com/, but if it's PR, url will look like https://deploy-preview-1--practical-allen-be16f3.netlify.com, where number is a number of PR in repo.


I'm also curious if this integrates with the netlify github action? Is there a way to show how you would use both in the recipe?

Cool, need to play with it. Will get back with info :)

denar90 commented 4 years ago

@exterkamp thank you so much for the review and questions 😍 I hope to find time to during the week to add more comments to code and also to clarify all statements related to the confusion between different urls to run. Feel free to ask more :)

alekseykulikov commented 4 years ago

@denar90 and I agreed, instead of a custom integration, provide an official Netlify recipe, using one of the community actions: https://github.com/marketplace?type=actions&query=netlify