Skip to content

Commit e2bd3eb

Browse files
authoredJan 10, 2025
Measure sizes and post as a comment (#1641)
* Measure sizes * Measure sizes * Measure sizes * Measure sizes * Measure sizes * use EOF * use EOF * use EOF * use EOF * use EOF * use EOF * use EOF * use EOF * use EOF * oops, dev and prod were backwards
1 parent e02e42b commit e2bd3eb

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed
 

‎.github/workflows/size.yml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Size
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request: {}
8+
9+
env:
10+
TURBO_API: http://127.0.0.1:9080
11+
TURBO_TOKEN: this-is-not-a-secret
12+
TURBO_TEAM: myself
13+
14+
jobs:
15+
install_dependencies:
16+
name: 'Setup'
17+
runs-on: 'ubuntu-latest'
18+
19+
steps:
20+
- uses: wyvox/action@v1
21+
with:
22+
pnpm-args: '--ignore-scripts'
23+
node-version: 20.1.0
24+
repo-token: ${{ secrets.GITHUB_TOKEN }}
25+
- run: pnpm turbo build
26+
- run: sudo snap install dust
27+
- name: "Get sizes for development outputs"
28+
id: dev
29+
run: |
30+
cd packages/\@glimmer
31+
dust --ignore_hidden \
32+
--reverse --apparent-size \
33+
--filter ".+\/dist\/dev\/index.js$" \
34+
--no-percent-bars --only-dir --depth 1 > out.txt
35+
36+
echo 'sizes<<EOF' >> $GITHUB_OUTPUT
37+
while IFS= read -r line; do
38+
echo "$line" >> $GITHUB_OUTPUT
39+
done <<< $(cat out.txt)
40+
echo 'EOF' >> $GITHUB_OUTPUT
41+
cat out.txt
42+
43+
- name: "Get sizes for production outputs"
44+
id: prod
45+
run: |
46+
cd packages/\@glimmer
47+
dust --ignore_hidden \
48+
--reverse --apparent-size \
49+
--filter ".+\/dist\/prod\/index.js$" \
50+
--no-percent-bars --only-dir --depth 1 > out.txt
51+
52+
echo 'sizes<<EOF' >> $GITHUB_OUTPUT
53+
while IFS= read -r line; do
54+
echo "$line" >> $GITHUB_OUTPUT
55+
done <<< $(cat out.txt)
56+
echo 'EOF' >> $GITHUB_OUTPUT
57+
cat out.txt
58+
59+
- uses: mshick/add-pr-comment@v2
60+
with:
61+
message: |
62+
<table><thead><tr><th></th><th>Dev</th><th>Prod</th></tr></thead>
63+
<tbody>
64+
<tr><td>This PR</td><td>
65+
66+
```
67+
${{ steps.dev.outputs.sizes }}
68+
```
69+
70+
</td><td>
71+
72+
```
73+
${{ steps.prod.outputs.sizes }}
74+
```
75+
76+
</td></tr>
77+
</tbody></table>
78+
79+
80+
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+

0 commit comments

Comments
 (0)