Skip to content

[pull] master from highcharts:master #1291

[pull] master from highcharts:master

[pull] master from highcharts:master #1291

name: Highcharts Visual Comparison
on:
pull_request:
branches:
- 'master'
paths:
- 'samples/**'
- 'ts/**'
- 'css/**'
- '.github/workflows/visual-compare.yml'
permissions:
contents: read # to fetch code (actions/checkout)
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
file_size_comparison:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: master
- name: Use Node.js lts/iron
uses: actions/setup-node@v4
with:
node-version: 'lts/iron'
cache: 'npm'
- name: Install dependencies
run: npm i
- name: Check TypeScript version
run: npx tsc -v
- name: Build Highcharts
run: npx gulp scripts
- name: Build Dashboards
run: npx gulp dashboards/scripts
- name: Write file sizes at master
run: npx gulp write-file-sizes --filename master.json
- name: Checkout current branch
uses: actions/checkout@v4
with:
clean: false
fetch-depth: 0
- name: Use Node.js lts/iron
uses: actions/setup-node@v4
with:
node-version: 'lts/iron'
cache: 'npm'
- name: Install dependencies
run: npm i
- name: Check TypeScript version
run: npx tsc -v
- name: Build Highcharts
run: npx gulp scripts
- name: Build Dashboards
run: npx gulp dashboards/scripts
- name: File size comparison
run: |
npx gulp write-file-sizes --filename ${{github.event.pull_request.number}}.json
npx gulp compare-size-and-comment \
--master ./tmp/filesizes/master.json \
--proposed ./tmp/filesizes/${{github.event.pull_request.number}}.json \
--pr ${{github.event.pull_request.number}} \
--user highsoft-bot
env:
GITHUB_TOKEN: ${{secrets.PR_COMMENT_TOKEN}}
visual_compare:
timeout-minutes: 20
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [lts/iron]
steps:
- uses: actions/checkout@v4
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
run: npm i
- name: Build Highcharts
run: npx gulp scripts
- run: npx karma start test/karma-conf.js --tests highcharts/*/* --reference --browsercount 2 --no-fail-on-empty-test-suite
- run: npx karma start test/karma-conf.js --tests maps/*/* --reference --browsercount 2 --no-fail-on-empty-test-suite
- run: npx karma start test/karma-conf.js --tests stock/*/* --reference --browsercount 2 --no-fail-on-empty-test-suite
- run: npx karma start test/karma-conf.js --tests gantt/*/* --reference --browsercount 2 --no-fail-on-empty-test-suite
- name: Checkout current branch
uses: actions/checkout@v4
with:
clean: false
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm i
- name: Build Highcharts
run: npx gulp scripts
- run: npx karma start test/karma-conf.js --tests highcharts/*/* --single-run --browsercount 2 --visualcompare || true
- run: npx karma start test/karma-conf.js --tests stock/*/* --single-run --browsercount 2 --visualcompare || true
- run: npx karma start test/karma-conf.js --tests maps/*/* --single-run --browsercount 2 --visualcompare || true
- run: npx karma start test/karma-conf.js --tests gantt/*/* --single-run --browsercount 2 --visualcompare || true
- name: Comment on PR and upload visual test result
run: |
npx gulp update-pr-testresults \
--fail-silently \
--pr ${{github.event.pull_request.number}}
if: ${{ always() }}
env:
GITHUB_TOKEN: ${{secrets.PR_COMMENT_TOKEN}}
HIGHCHARTS_VISUAL_TESTS_BUCKET: ${{secrets.VISUAL_TESTS_S3_BUCKET}}
AWS_ACCESS_KEY_ID: ${{secrets.VISUAL_TESTS_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.VISUAL_TESTS_AWS_SECRET_ACCESS_KEY}}
AWS_REGION: ${{secrets.VISUAL_TESTS_AWS_REGION}}
- name: Purge references with no candidate
if: ${{ always() }}
run: |
find ./samples -type f -name "reference.svg" \
-exec sh -c '
for f do
dir="$(dirname "$f")"
candidate_path="$dir/candidate.svg"
if [ ! -f "$candidate_path" ]; then
echo "Deleting unpaired reference: $f"
rm "$f"
fi
done
' sh {} +
- name: Upload visual test images
if: ${{ always() }}
run: |
aws s3 sync ./samples \
"s3://$HIGHCHARTS_VISUAL_TESTS_BUCKET/visualtests/diffs/pullrequests/$PR_NUMBER/" \
--exclude "*" \
--include "*/reference.svg" \
--include "*/candidate.svg" \
--include "*/diff.gif"
env:
HIGHCHARTS_VISUAL_TESTS_BUCKET: ${{secrets.VISUAL_TESTS_S3_BUCKET}}
AWS_ACCESS_KEY_ID: ${{secrets.VISUAL_TESTS_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.VISUAL_TESTS_AWS_SECRET_ACCESS_KEY}}
AWS_REGION: ${{secrets.VISUAL_TESTS_AWS_REGION}}
PR_NUMBER: ${{github.event.pull_request.number}}
- name: Comment on PR
uses: actions/github-script@v7
if: ${{ always() }}
with:
github-token: ${{secrets.PR_COMMENT_TOKEN}}
script: |
const { createOrUpdateComment } = require('./.github/scripts/commentOnPR');
const { readFileSync } = require('node:fs')
const { title, body } = require('./tmp/pr-visual-test-comment.json');
await createOrUpdateComment(github, context, title, body);
- name: Store artifacts
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: visual-test-results
path: |
test/visual-test-results.json
test/review-pr-*.json
tmp/pr-visual-test-comment.json