forked from highcharts/highcharts
-
Notifications
You must be signed in to change notification settings - Fork 2
92 lines (73 loc) · 2.57 KB
/
dashboards-benchmark.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Dashboards benchmark
on:
pull_request:
branches:
- 'master'
paths:
- 'ts/Dashboards/**'
- 'ts/Data/**'
- 'test/ts-node-unit-tests/benchmark/Dashboards/*'
- '.github/workflows/dashboards-benchmark.yml'
workflow_dispatch:
permissions:
contents: read # to fetch code (actions/checkout)
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
dashboard_benchmark:
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'
- run: npm i
- name: Build Highcharts
run: npx gulp scripts
- name: Build Dashboards
run: npx gulp dashboards/scripts
- name: Benchmark
continue-on-error: true
run: cd test/ts-node-unit-tests && node -r ts-node/register bench.ts --context base --pattern Dashboards/
- name: Checkout current branch
uses: actions/checkout@v3
with:
clean: false # do not remove files from previous run
- run: npm i
- name: Build Highcharts
run: npx gulp scripts
- name: Build Dashboards
run: npx gulp dashboards/scripts
- name: Benchmark
run: cd test/ts-node-unit-tests && node -r ts-node/register bench.ts --context actual --pattern Dashboards/
- name: Benchmark comparison
run: cd test/ts-node-unit-tests && node -r ts-node/register benchmark-compare.ts
- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: benchmark-files
path: |
tmp/benchmarks
- name: Comment on PR
uses: actions/github-script@v6
with:
github-token: ${{secrets.PR_COMMENT_TOKEN}}
script: |
const { createOrUpdateComment } = require('./.github/scripts/commentOnPR');
const { readFileSync } = require('node:fs')
const benchmarkMD = readFileSync('./tmp/benchmarks/table.md');
await createOrUpdateComment(github, context, 'Benchmark report - Dashboards', benchmarkMD || 'No table to show');
- name: Add to summary
if: ${{ always() }}
run: |
echo "## Benchmark metrics" >> $GITHUB_STEP_SUMMARY
cat ./tmp/benchmarks/table.md >> $GITHUB_STEP_SUMMARY