Run Google Lighthouse in GitLab Pipeline - qa-at-the-point/base GitHub Wiki
This YML file for GitLab Pipelines is used to run Google Lighthouse in your Continuous Integration (CI) pipelines.
Credit: James Sheasby Thomas
.lighthouse:
image: cypress/browsers:node14.17.0-chrome91-ff89
extends:
- .node
stage: test
before_script:
- export PATH="$(yarn global bin):$PATH"
- cp $envLocal ${CI_PROJECT_DIR}/.env.local
- yarn build
- npm install -g @lhci/[email protected]
script:
- lhci autorun --upload.token="${LHCI_BUILD_TOKEN_EKS_SHARED}" --collect.settings.chromeFlags="--no-sandbox --disable-dev-shm-usage" --max-wait-for-load=120000 || echo "LHCI failed."
lighthouse:ci:
extends:
- .lighthouse
rules:
- if: $CI_COMMIT_BRANCH =~ /^(develop$|master$|expedite\/)/
when: never
- when: manual
allow_failure: true
lighthouse:dev-deploy:
extends:
- .lighthouse
rules:
- if: $CI_COMMIT_BRANCH == "develop"
when: always
allow_failure: true
- when: never
lighthouse:prod-deploy:
extends:
- .lighthouse
rules:
- if: $CI_COMMIT_BRANCH == "main"
when: always
allow_failure: true
- when: never