Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Measure sizes and post as a comment #1641

Merged
merged 15 commits into from
Jan 10, 2025
83 changes: 83 additions & 0 deletions .github/workflows/size.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Size

on:
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:
install_dependencies:
name: 'Setup'
runs-on: 'ubuntu-latest'

steps:
- uses: wyvox/action@v1
with:
pnpm-args: '--ignore-scripts'
node-version: 20.1.0
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: pnpm turbo build
- 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

- uses: mshick/add-pr-comment@v2
with:
message: |
<table><thead><tr><th></th><th>Dev</th><th>Prod</th></tr></thead>
<tbody>
<tr><td>This PR</td><td>

```
${{ steps.dev.outputs.sizes }}
```

</td><td>

```
${{ steps.prod.outputs.sizes }}
```

</td></tr>
</tbody></table>



env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Loading