-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
65 lines (63 loc) · 1.95 KB
/
build_stats.yml
File metadata and controls
65 lines (63 loc) · 1.95 KB
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
name: '📈📊'
on:
pull_request_target:
branches: [master]
paths-ignore: [CHANGELOG.md]
jobs:
stats_target:
name: Build stats
runs-on: ubuntu-latest
env:
minified: dist/index.min.js
bundled: dist/index.mjs
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npm ci
- name: build upstram stats ( this run from the base branch )
run: npm run build
- name: persist
id: a
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const fs = require('fs');
return JSON.stringify({
size: { fabric: { minified: fs.statSync('${{ env.minified }}').size, bundled: fs.statSync('${{ env.bundled }}').size } }
});
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: reinstall deps after checkout
run: npm ci
- name: pr head build stats
run: npm run build -- -s
- name: persist
id: b
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const fs = require('fs');
return JSON.stringify({
size: { fabric: { minified: fs.statSync('${{ env.minified }}').size, bundled: fs.statSync('${{ env.bundled }}').size } }
});
- name: process
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const { run_simple } = await import('${{ github.workspace }}/scripts/buildStats.mjs');
const res = await run_simple({
github,
context,
core,
a: JSON.parse('${{ steps.a.outputs.result }}'),
b: JSON.parse('${{ steps.b.outputs.result }}'),
});