Skip to content

dashboards/cypress-lighthouse #96

dashboards/cypress-lighthouse

dashboards/cypress-lighthouse #96

name: Dashboards lighthouse tests
on:
pull_request:
branches:
- 'master'
paths:
- 'test/cypress/performance/**'
- 'samples/cypress/dashboards/**'
- 'samples/dashboards/**'
- 'ts/Dashboards/**'
- 'ts/Data/**'
- 'css/**'
- '.github/workflows/**'
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
cypress_lighthouse:
timeout-minutes: 10
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
node-version: [lts/*]
steps:
- uses: actions/checkout@v3
with:
ref: master
- name: Check out the test files from current branch
run: git pull && git checkout origin/${{ github.head_ref }} -- test/cypress/performance/minimal.cy.js
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
uses: cypress-io/github-action@v5
with:
browser: chrome
runTests: false
- name: Build Highcharts
run: npx gulp scripts
- name: Build Dashboards
run: npx gulp dashboards/scripts
- name: Install utils
run: npm i github:highcharts/highcharts-utils
- name: Run cypress via action
uses: cypress-io/github-action@v5
with:
browser: chrome
start: npx cross-env NODE_PATH=${GITHUB_WORKSPACE}/node_modules node node_modules/@highcharts/highcharts-utils/server --localOnly
wait-on: 'http://localhost:3031/dashboards.js'
env: type=base
config: specPattern=**/performance/*.cy.js
install: false
- name: Stop server
run: kill $(lsof -t -i:3030)
- name: Rename report
run: mv tmp/lighthouse.json tmp/lighthouse-master.json
- name: Checkout current branch
uses: actions/checkout@v3
with:
clean: false # do not remove files from previous run
- name: Install dependencies
uses: cypress-io/github-action@v5
with:
browser: chrome
runTests: false
- name: Build Highcharts
run: npx gulp scripts
- name: Build Dashboards
run: npx gulp dashboards/scripts
- name: Install utils
run: npm i github:highcharts/highcharts-utils
- name: Run cypress via action
uses: cypress-io/github-action@v5
with:
browser: chrome
start: npx cross-env NODE_PATH=${GITHUB_WORKSPACE}/node_modules node node_modules/@highcharts/highcharts-utils/server --localOnly
wait-on: 'http://localhost:3031/dashboards.js'
env: type=actual
config: specPattern=**/performance/*.cy.js
install: false
- name: Add to summary
if: ${{ always() }}
run: |
echo "## Lighthouse metrics" >> $GITHUB_STEP_SUMMARY
node test/cypress/lighthouseCompare.mjs --reportsDir ./tmp/lighthouseReports >> $GITHUB_STEP_SUMMARY