-
-
Notifications
You must be signed in to change notification settings - Fork 2
Run Google Lighthouse in GitLab Pipeline
Carlos Kidman edited this page Mar 21, 2022
·
3 revisions
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/cli@0.8.2
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