-
Notifications
You must be signed in to change notification settings - Fork 33
166 lines (161 loc) · 6.62 KB
/
build-size.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Build Size Analyzer
on:
pull_request:
types: [ opened, synchronize, ready_for_review ]
jobs:
build-base:
name: Build base
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
steps:
- name: Check out source files
uses: actions/checkout@v2
with:
ref: ${{ github.base_ref }}
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Configure Composer cache
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install composer deps
run: composer install --no-dev --prefer-dist --no-progress --no-suggest
- name: Install npm deps
run: npm ci
- name: Build files
run: npm run analyzer
- name: Upload base stats.json
uses: actions/upload-artifact@v2
with:
name: base
path: ./build/**/stats.json
retention-days: 1
build-pr:
name: Build PR
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
steps:
- name: Check out source files
uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Configure Composer cache
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install composer deps
run: composer install --no-dev --prefer-dist --no-progress --no-suggest
- name: Install npm deps
run: npm ci
- name: Build files
run: npm run analyzer
- name: Upload base stats.json
uses: actions/upload-artifact@v2
with:
name: pr
path: ./build/**/stats.json
retention-days: 1
report:
name: Generate report
runs-on: ubuntu-latest
needs: [ build-base, build-pr ]
steps:
- name: Checkout PR
uses: actions/checkout@v2
- name: Download base stats
uses: actions/download-artifact@v2
with:
name: base
path: base
- name: Download PR stats
uses: actions/download-artifact@v2
with:
name: pr
path: pr
- name: Get Animation diff
id: get-animation-diff
uses: NejcZdovc/bundle-size-diff@v1
with:
base_path: './base/animation/stats.json'
pr_path: './pr/animation/stats.json'
- name: Get Blocks diff
id: get-blocks-diff
uses: NejcZdovc/bundle-size-diff@v1
with:
base_path: './base/blocks/stats.json'
pr_path: './pr/blocks/stats.json'
- name: Get CSS diff
id: get-css-diff
uses: NejcZdovc/bundle-size-diff@v1
with:
base_path: './base/css/stats.json'
pr_path: './pr/css/stats.json'
- name: Get Dashboard diff
id: get-dashboard-diff
uses: NejcZdovc/bundle-size-diff@v1
with:
base_path: './base/dashboard/stats.json'
pr_path: './pr/dashboard/stats.json'
- name: Get Onboarding diff
id: get-onboarding-diff
uses: NejcZdovc/bundle-size-diff@v1
with:
base_path: './base/onboarding/stats.json'
pr_path: './pr/onboarding/stats.json'
- name: Get Export Import diff
id: get-export-import-diff
uses: NejcZdovc/bundle-size-diff@v1
with:
base_path: './base/export-import/stats.json'
pr_path: './pr/export-import/stats.json'
- name: Get Pro diff
id: get-pro-diff
uses: NejcZdovc/bundle-size-diff@v1
with:
base_path: './base/pro/stats.json'
pr_path: './pr/pro/stats.json'
- name: Comment
uses: NejcZdovc/comment-pr@v1
with:
file: 'comment.md'
identifier: "GITHUB_BUILD_SIZE"
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
OLD_ANIMATION: ${{ steps.get-animation-diff.outputs.base_file_string }}
NEW_ANIMATION: ${{ steps.get-animation-diff.outputs.pr_file_string }}
DIFF_ANIMATION: ${{ steps.get-animation-diff.outputs.diff_file_string }}
DIFF_PERCENT_ANIMATION: ${{ steps.get-animation-diff.outputs.percent }}
OLD_BLOCKS: ${{ steps.get-blocks-diff.outputs.base_file_string }}
NEW_BLOCKS: ${{ steps.get-blocks-diff.outputs.pr_file_string }}
DIFF_BLOCKS: ${{ steps.get-blocks-diff.outputs.diff_file_string }}
DIFF_PERCENT_BLOCKS: ${{ steps.get-blocks-diff.outputs.percent }}
OLD_CSS: ${{ steps.get-css-diff.outputs.base_file_string }}
NEW_CSS: ${{ steps.get-css-diff.outputs.pr_file_string }}
DIFF_CSS: ${{ steps.get-css-diff.outputs.diff_file_string }}
DIFF_PERCENT_CSS: ${{ steps.get-css-diff.outputs.percent }}
OLD_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.base_file_string }}
NEW_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.pr_file_string }}
DIFF_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.diff_file_string }}
DIFF_PERCENT_DASHBOARD: ${{ steps.get-dashboard-diff.outputs.percent }}
OLD_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.base_file_string }}
NEW_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.pr_file_string }}
DIFF_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.diff_file_string }}
DIFF_PERCENT_ONBOARDING: ${{ steps.get-onboarding-diff.outputs.percent }}
OLD_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.base_file_string }}
NEW_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.pr_file_string }}
DIFF_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.diff_file_string }}
DIFF_PERCENT_EXPORT_IMPORT: ${{ steps.get-export-import-diff.outputs.percent }}
OLD_PRO: ${{ steps.get-pro-diff.outputs.base_file_string }}
NEW_PRO: ${{ steps.get-pro-diff.outputs.pr_file_string }}
DIFF_PRO: ${{ steps.get-pro-diff.outputs.diff_file_string }}
DIFF_PERCENT_PRO: ${{ steps.get-pro-diff.outputs.percent }}