-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
88 lines (86 loc) · 2.47 KB
/
build.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
name: '🩺'
on:
pull_request:
branches: [master]
paths-ignore: [CHANGELOG.md]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Uglified build
uses: actions/checkout@v4
- uses: ./.github/actions/cached-install
with:
node-version: 20.x
- run: npm run build
stats:
name: Build stats
runs-on: ubuntu-latest
env:
minified: dist/index.min.js
bundled: dist/index.mjs
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20.x
- run: npm ci
- name: build stats
run: npm run build
- name: persist
id: b
uses: actions/github-script@v6
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: checkout src files
run: git checkout ${{ github.event.pull_request.base.sha }}
- name: upstream build stats
run: npm run build -- -s
- name: persist
id: a
uses: actions/github-script@v6
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@v6
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 }}'),
});
lint:
runs-on: ubuntu-latest
steps:
- name: Linting
uses: actions/checkout@v4
- uses: ./.github/actions/cached-install
with:
node-version: 20.x
- run: npm run lint
prettier:
runs-on: ubuntu-latest
steps:
- name: Prettier check
uses: actions/checkout@v4
- uses: ./.github/actions/cached-install
with:
node-version: 20.x
- run: npm run prettier:check