Skip to content

A Github action allowing you to launch a GTMetrix test and evaluate performance regression right from your pipeline.

License

Notifications You must be signed in to change notification settings

ingeno/gtmetrix-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Run GTMetrix test action

This action uses GTMetrix API 2.0 and provides the following features :

Example of job

  launch-gtmetrix-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: ingeno/gtmetrix-action@v1.0.0
        with:
          api_key: ${{ secrets.GTMETRIX_API_KEY }}
          configuration_file: ./config.yml

api_key and configuration_file are both required. In this example, the file config.yml would be at the root of the repository.

Launch a GTMetrix test

You can configure the test launch parameters by using the exact same key as in the API.

Example of configuration file

  poll_interval: 6
  test_configuration:
    report: lighthouse
    simulate_device: nexus_5
    url: https://www.google.com
    video: false

Only test_configuration.url is required. poll_interval defaults to 3.

Evaluate a GTMetrix report

You can configure the requirement parameters by using the exact same key as in the API.

Example of configuration file

  test_configuration:
    report: legacy
    url: https://www.google.com
    video: true
  requirements:
    structure_score: 95
    onload_duration: 4
    gtmetrix_grade: A

Outputs

Outputs contains the every links in the report response and every attributes except these ones : browser, location and source. Some outputs might not be present depending of your test parameters. For example, the gtmetrix_grade is only available when the test parameter report is lighthouse.

Contributing

# Make sure to use the correct version of node
nvm use

# Install dependencies
npm install

# Build
npm run build

# Test
npm test

# Package (see https://github.com/actions/typescript-action#publish-to-a-distribution-branch)
npm run package

Roadmap

About

A Github action allowing you to launch a GTMetrix test and evaluate performance regression right from your pipeline.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •