Experiment to run Lighthousebot after Netlify deploys by waiting for the deploy in Travis CI.
While this experiment works, a cleaner solution is triggering Lighthouse CI from a Netlify function on successful deploy.
See example PR.
- Netlify builds and deploys site preview
- Meanwhile Travis CI starts and waits for Netlify deploy
- Then Travis CI run lighthousebot which runs Lighthouse CI and comments on PR
To ensure Travis waits for the new deploy, Netlify creates a unique file with the name of the commit SHA and Travis in turn waits for that file to be present:
NETLIFY_PREVIEW_SLUG="deploy-preview-$TRAVIS_PULL_REQUEST"
NETLIFY_PREVIEW_URL="https://$NETLIFY_PREVIEW_SLUG--lighthousebot-tests.netlify.com/"
npm run ci:wait -- "$NETLIFY_PREVIEW_URL$TRAVIS_PULL_REQUEST_SHA.txt"
npm run ci:lighthouse -- "$NETLIFY_PREVIEW_URL"see .travis.yml.