Commit 7fb29fb9 authored by Protocole's avatar Protocole Committed by Thomas Boni
Browse files

Feat: lighthouse.yml job to 0.3.0

* Change docker image used
* Fix version of lighthouse
parent 73f2e979
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@ This job analyzes a remote website (or a local web service) and gives you a repo
| `OUTPUT_LOCALE` | Language of report file | `en` |
| `ADDITIONAL_OPTIONS` | Variable to add custom options (see [options](https://github.com/GoogleChrome/lighthouse#cli-options){:target="_blank"}) | ` ` |
| `PAGES_PATH` | Path of your static website (not used if `LIGHTHOUSE_TARGET` is filled) | `website_build/` |
| `SERVE_VERSION` | `serve` npm module's version | `11.3.2` |
| `LIGHTHOUSE_VERSION` | `Lighthouse` tool's version | `7.2.0`


### Audit configuration

+3 −2
Original line number Diff line number Diff line
@@ -5,9 +5,10 @@ icon: 🗽
maintainer: Protocole
license: MIT
images:
  "justinribeiro/lighthouse": "@sha256:4a9673d77d8480f2d641b8e4e5845897ea1f9b368eb92862321cafcc7f897c82"
  "zenika/alpine-chrome": "89-with-node"
tools:
  "lighthouse": ""
  "lighthouse": "7.2.0"
  "serve": "11.3.2"
labels:
  - GitLab
  - Testing
+16 −11
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ stages:
  - dynamic_tests

lighthouse:
  image: justinribeiro/lighthouse@sha256:4a9673d77d8480f2d641b8e4e5845897ea1f9b368eb92862321cafcc7f897c82
  image: zenika/alpine-chrome:89-with-node
  stage: dynamic_tests
  variables:
    LIGHTHOUSE_TARGET: ""
@@ -12,11 +12,15 @@ lighthouse:
    ADDITIONAL_OPTIONS: ""
    PAGES_PATH: "website_build/"
    SERVE_VERSION: "11.3.2"
    LIGHTHOUSE_VERSION: "7.2.0"
  script:
    # Put in full lowercase OUTPUT_FORMAT to avoid problems
    - export OUTPUT_FORMAT=$(echo ${OUTPUT_FORMAT} | tr '[:upper:]' '[:lower:]')
    - export ADDITIONAL_OPTIONS="--output ${OUTPUT_FORMAT} --output-path ${OUTPUT_NAME}.${OUTPUT_FORMAT} ${ADDITIONAL_OPTIONS}"
    - export ADDITIONAL_OPTIONS="--locale ${OUTPUT_LOCALE} ${ADDITIONAL_OPTIONS}"
    - npm install lighthouse@${LIGHTHOUSE_VERSION}
    # Chrome isn't defined properly in this image, so we redefine the path for lighthouse
    - export CHROME_PATH="/usr/bin/chromium-browser"
    -  if [ -z ${LIGHTHOUSE_TARGET} ]; then
    -    if [ ! -d ${PAGES_PATH} ]; then
    -      echo "[ERROR] Variable LIGHTHOUSE_TARGET must be filled, see https://r2devops.io/jobs/dynamic_tests/lighthouse/"
@@ -26,7 +30,8 @@ lighthouse:
    -    npx serve ${PAGES_PATH} &
    -    export LIGHTHOUSE_TARGET="http://localhost:5000"
    -  fi
    - lighthouse ${ADDITIONAL_OPTIONS} --chrome-flags="--headless --disable-gpu" ${LIGHTHOUSE_TARGET}
    # Lighthouse isn't installed globally (non-root), so we go for the exec file
    - ./node_modules/.bin/lighthouse ${ADDITIONAL_OPTIONS} --chrome-flags="--headless --disable-gpu" ${LIGHTHOUSE_TARGET}
  artifacts:
    expose_as: "Lighthouse report"
    paths:
+2 −0
Original line number Diff line number Diff line
* Update the docker image used 
* Fix version of lighthouse
 No newline at end of file