[pull] master from highcharts:master #1258
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dashboards lighthouse tests | |
on: | |
pull_request: | |
branches: | |
- 'master' | |
paths: | |
- '.github/workflows/dashboards-lighthouse-test.yml' | |
- 'css/dashboards*' | |
- 'css/datagrid*' | |
- 'samples/dashboards/**' | |
- 'test/cypress/dashboards/performance/**' | |
- 'ts/Dashboards/**' | |
- 'ts/Data/**' | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
cypress_lighthouse: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
strategy: | |
matrix: | |
node-version: [lts/iron] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: master | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
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: Checkout utils | |
uses: actions/checkout@v4 | |
with: | |
repository: highcharts/highcharts-utils | |
path: utils | |
fetch-depth: 1 | |
- name: Install Highcharts Utils | |
run: | | |
cd utils | |
npm i | |
- name: Run cypress via action | |
uses: cypress-io/github-action@v5 | |
continue-on-error: true | |
with: | |
browser: chrome | |
start: node utils/server --localOnly | |
wait-on: 'http://localhost:3031/dashboards.js' | |
env: type=base | |
config-file: test/cypress/dashboards/lighthouse.config.mjs | |
install: false | |
- name: Stop server | |
run: kill $(lsof -t -i:3030) | |
- 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: Run cypress via action | |
uses: cypress-io/github-action@v5 | |
with: | |
browser: chrome | |
start: node utils/server --localOnly | |
wait-on: 'http://localhost:3031/dashboards.js' | |
env: type=actual | |
config-file: test/cypress/dashboards/lighthouse.config.mjs | |
install: false | |
- name: Store artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tmp-files | |
path: | | |
tmp | |
- name: Write markdown to file | |
if: ${{ always() }} | |
run: | | |
node test/cypress/lighthouseCompare.mjs --reportsDir ./tmp/lighthouseReports > ./tmp/lighthousetable.md | |
- name: Add to summary | |
if: ${{ always() }} | |
run: | | |
echo "## Lighthouse metrics" >> $GITHUB_STEP_SUMMARY | |
cat ./tmp/lighthousetable.md >> $GITHUB_STEP_SUMMARY | |
- name: Comment on PR | |
uses: actions/github-script@v6 | |
if: ${{ always() }} | |
with: | |
github-token: ${{secrets.PR_COMMENT_TOKEN}} | |
script: | | |
const { createOrUpdateComment } = require('./.github/scripts/commentOnPR'); | |
const { readFileSync } = require('node:fs') | |
const markdown = readFileSync('./tmp/lighthousetable.md'); | |
await createOrUpdateComment(github, context, 'Lighthouse report', markdown || 'No table to show'); |