Git Product home page Git Product logo

gradle-lighthouse-plugin's Introduction

WTT logo

Gradle Status Travis Build License

Gradle Lighthouse Plugin

Runs Lighthouse tests on multiple sites / web pages with checking thresholds (useful on continuous integration, constant performance checking).

Lighthouse Logo

Installation

plugins {
    id("com.cognifide.lighthouse") version "1.0.0"
}

Configuration

Plugin organizes multiple sites to be tested into suites. Any web page could be checked with different threshold and Lighthouse configuration (e.g using performance budgets). Suites need to be defined in file with following format:

lighthouse/suites.json (plugin specific format)

{
  "suites": [
    {
      "name": "site.demo",
      "default": true,
      "baseUrl": "http://demo.example.com",
      "paths": [
        "/en-us.html",
        "/en-gb.html"
      ],
      "args": [
        "--config-path=lighthouse/config.json",
        "--performance=90",
        "--accessibility=90",
        "--best-practices=80",
        "--seo=60",
        "--pwa=30"
      ]
    },
    {
      "name": "site.live",
      "baseUrl": "http://example.com",
      "paths": [
        "/en-us.html"
      ],
      "args": [
        "--config-path=lighthouse/config.json",
        "--performance=90",
        "--accessibility=90",
        "--best-practices=80",
        "--seo=60",
        "--pwa=30"
      ]
    }
  ]
}

When using argument --config-path then it is also needed to have at least file:

lighthouse/config.json (documentation)

{
  "extends": "lighthouse:default"
}

Running

Underneath, Gradle Lighthouse Plugin is running Lighthouse CI multiple times in case of test suites defined (support for multiple paths under same base URL).

Available options:

  • run default suite(s): sh gradlew lighthouseRun,
  • run only desired suite(s) by name pattern(s): sh gradlew lighthouseRun -Plighthouse.suite=site.demo (if suites by name not found, default suites will be used),
  • run only desired suite(s) by base URL: sh gradlew lighthouseRun -Plighthouse.baseUrl=http://example.com (if suites by base URL not found, default suites will be used),
  • run only desired suite(s) with customized base URL: sh gradlew lighthouseRun -Plighthouse.baseUrl=http://any-host.com -Plighthouse.suite=site.live.

Note that after running one of above commands first time, new files might be generated:

  • package.json
  • yarn.lock

This is indented behavior - remember to save these files in VCS. If Lighthouse CI tool version need to be upgraded, just correct package.json file.

As a build result, reports under directory build/lighthouse will be generated:

Lighthouse Build Files

Screenshot of sample report below:

Lighthouse Report

Building

  1. Clone this project using command git clone https://github.com/wttech/gradle-lighthouse-plugin.git
  2. To build plugin, simply enter cloned directory run command: gradlew
  3. To debug built plugin:
    • Append to build command parameters --no-daemon -Dorg.gradle.debug=true
    • Run build, it will suspend, then connect remote at port 5005 by using IDE
    • Build will proceed and stop at previously set up breakpoint.

Contributing

Issues reported or pull requests created will be very appreciated.

  1. Fork plugin source code using a dedicated GitHub button.
  2. Do code changes on a feature branch created from develop branch.
  3. Create a pull request with a base of develop branch.

License

Gradle Lighthouse Plugin is licensed under the Apache License, Version 2.0 (the "License")

gradle-lighthouse-plugin's People

Contributors

devzbysiu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

cybernhl

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.