Code Monkey home page Code Monkey logo

es-lighthouse-ci's Introduction

Learning Lighthouse CI from scratch (quickstart)

version

Just one of the things I'm learning. https://github.com/hchiam/learning

Have Lighthouse CI tool run with Travis for every commit or PR to a web app project hosted on GitHub.

Results upon commit

Build Status

Automated test run info here: https://travis-ci.org/hchiam/learning-lighthouse-ci/builds (or click on the badge above). Update: Since June 15th, 2021, building on travis-ci.org "ceased", so you should use travis-ci.com from now on. Some of the old .org links have stopped working, so here's the .com builds page: https://app.travis-ci.com/github/hchiam/learning-lighthouse-ci/builds Also, you may want to use free GitHub Actions instead.

Example PR here (click "View details"): hchiam/learning-lighthouse-ci#1 (comment)

Setup steps (if you git clone this repo)

  1. To test the web app locally:

    npm install
    npm start

    and in a separate CLI tab:

    npm run build
    npm install -g @lhci/[email protected]
    lhci autorun
  2. To test the web app upon commit/PR:

Setup steps (if you're starting from an empty folder)

  1. For lhci autorun to work, you need a web app set up that has things like a dist or public folder, etc. To do that, you can run a one-liner command to set up a React app:

    # cd to desktop or containing folder
    create-react-app my-app
  2. To make sure it's working locally:

    cd my-app
    npm start

    and in another CLI tab:

    cd my-app
    npm install -g @lhci/[email protected]
    lhci autorun
  3. The key is setting up the Travis file .travis.yml:

    language: node_js
    node_js:
      - 10
    before_install:
      - npm install -g @lhci/[email protected]
    script:
      - npm run build
      - lhci autorun
    addons:
      chrome: stable

Aside

If you want to see a report with more details (e.g. vulnerable libraries -> which specific ones), use a different CLI tool: run lighthouse locally:

npm install -g lighthouse
lighthouse https://airhorner.com/
# lighthouse <url>

Then open the generated html file.

es-lighthouse-ci's People

Contributors

simonapiz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.