Skip to main content

Lighthouse

Lighthouse example "Error loading lighthouse-example.png"

To use this action, make sure a .env.test file is in the project root. In case not needed, simply make the .env.test an empty file. Import it in the following way:

name: CI/CD

"on":
pull_request:
push:
branches:
- master

lighthouse:
if: github.ref != 'refs/heads/master'
uses: paion-data/hashistack/.github/workflows/lighthouse.yaml@master
with:
node-version: 22

In the example above, the node 22 and the most recent stable yarn version is assumed in the CI/CD project.

Configurations

  • node-version: Node.js version used to run the lighthoused React App. Default to 22. The version can be customized using the node-version parameter. For example, the configuration below sets the node version to 20:

    lighthouse:
    if: github.ref != 'refs/heads/master'
    uses: paion-data/hashistack/.github/workflows/lighthouse.yaml@master
    with:
    node-version: 20
  • env-path: The path to the .env file of the lighthoused React App if provided. For example, .env.test. If no .env is needed, simply ignore this option; otherwise env-path:

    lighthouse:
    if: github.ref != 'refs/heads/master'
    uses: paion-data/hashistack/.github/workflows/lighthouse.yaml@master
    with:
    env-path: .env.test
  • budget-path: The path, relative to project root, of the budget.json file which describe the performance budget. Default to ./.github/lighthouse/lighthouse-budget.json. The file location can be customized using the budget-path parameter. For example, the configuration below assumes the budget.json to be located in the project root:

    lighthouse:
    if: github.ref != 'refs/heads/master'
    uses: paion-data/hashistack/.github/workflows/lighthouse.yaml@master
    with:
    budget-path: ./lighthouse-budget.json
  • config-path: The path, relative to project root, of the lighthouserc.json filefor full control of the Lighthouse environment and assertions. Default to ./.github/lighthouse/lighthouserc.json. The file location can be customized using config-path parameter. For example, the configuration below assumes the lighthouserc.json to be located in the project root:

    lighthouse:
    if: github.ref != 'refs/heads/master'
    uses: paion-data/hashistack/.github/workflows/lighthouse.yaml@master
    with:
    config-path: ./lighthouserc.json