-
Notifications
You must be signed in to change notification settings - Fork 192
159 lines (131 loc) · 4.02 KB
/
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
name: Size
on:
workflow_dispatch:
inputs:
BRANCH:
description: Branch to checkout
required: false
default: 'main'
type: string
push:
branches:
- main
pull_request: {}
env:
TURBO_API: http://127.0.0.1:9080
TURBO_TOKEN: this-is-not-a-secret
TURBO_TEAM: myself
jobs:
compare_sizes:
name: 'Compare Sizes and Comment'
runs-on: 'ubuntu-latest'
steps:
- name: '[DEBUG] Dump GitHub context'
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: wyvox/action@v1
with:
pnpm-args: '--ignore-scripts'
repo-token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ inputs.BRANCH }}
- run: pnpm turbo prepack
- run: sudo snap install dust
- name: "Get sizes for development outputs"
id: dev
run: |
cd packages/\@glimmer
dust --ignore_hidden \
--reverse --apparent-size \
--filter ".+\/dist\/dev\/index.js$" \
--no-percent-bars --only-dir --depth 1 > out.txt
echo 'sizes<<EOF' >> $GITHUB_OUTPUT
while IFS= read -r line; do
echo "$line" >> $GITHUB_OUTPUT
done <<< $(cat out.txt)
echo 'EOF' >> $GITHUB_OUTPUT
cat out.txt
- name: "Get sizes for production outputs"
id: prod
run: |
cd packages/\@glimmer
dust --ignore_hidden \
--reverse --apparent-size \
--filter ".+\/dist\/prod\/index.js$" \
--no-percent-bars --only-dir --depth 1 > out.txt
echo 'sizes<<EOF' >> $GITHUB_OUTPUT
while IFS= read -r line; do
echo "$line" >> $GITHUB_OUTPUT
done <<< $(cat out.txt)
echo 'EOF' >> $GITHUB_OUTPUT
cat out.txt
- name: "Get sizes from the main branch"
run: |
git remote -v
git fetch origin
git checkout main
git clean -Xfd
pnpm install
pnpm turbo prepack
- name: "[Main] Get sizes for development outputs"
id: main-dev
run: |
cd packages/\@glimmer
dust --ignore_hidden \
--reverse --apparent-size \
--filter ".+\/dist\/dev\/index.js$" \
--no-percent-bars --only-dir --depth 1 > out.txt
echo 'sizes<<EOF' >> $GITHUB_OUTPUT
while IFS= read -r line; do
echo "$line" >> $GITHUB_OUTPUT
done <<< $(cat out.txt)
echo 'EOF' >> $GITHUB_OUTPUT
cat out.txt
- name: "[Main] Get sizes for production outputs"
id: main-prod
run: |
cd packages/\@glimmer
dust --ignore_hidden \
--reverse --apparent-size \
--filter ".+\/dist\/prod\/index.js$" \
--no-percent-bars --only-dir --depth 1 > out.txt
echo 'sizes<<EOF' >> $GITHUB_OUTPUT
while IFS= read -r line; do
echo "$line" >> $GITHUB_OUTPUT
done <<< $(cat out.txt)
echo 'EOF' >> $GITHUB_OUTPUT
cat out.txt
#########################
# Intended Layout:
#
# | | This PR | Main |
# | Dev | x1 | y1 |
# | Prod | x2 | y2 |
#
#########################
- uses: mshick/add-pr-comment@v2
with:
message: |
<table><thead><tr><th></th><th>This PR</th><th>main</th></tr></thead>
<tbody>
<tr><td>Dev</td><td>
```
${{ steps.dev.outputs.sizes }}
```
</td><td>
```
${{ steps.main-dev.outputs.sizes }}
```
</td></tr>
<tr><td>Prod</td><td>
```
${{ steps.prod.outputs.sizes }}
```
</td><td>
```
${{ steps.main-prod.outputs.sizes }}
```
</td></tr>
</tbody></table>
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}