Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/receive-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
name: Receive PR
Comment thread
NullVoxPopuli marked this conversation as resolved.
Outdated

# read-only repo token
# no access to secrets
on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: pnpm build

- name: Save PR number
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR

- name: Save dist output
run: mv dist pr/dist

- uses: actions/upload-artifact@v4
with:
name: pr
Comment thread
NullVoxPopuli marked this conversation as resolved.
Outdated
path: pr/
104 changes: 104 additions & 0 deletions .github/workflows/size.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Size
Comment thread
NullVoxPopuli marked this conversation as resolved.
Outdated

# read-write repo token
# access to secrets
#
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
on:
workflow_run:
Comment thread
NullVoxPopuli marked this conversation as resolved.
workflows: ["Receive PR"]
types:
- completed

jobs:
compare_sizes:
name: 'Compare Sizes and Comment'
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v4
Comment thread
NullVoxPopuli marked this conversation as resolved.
Outdated
with:
ref: main
- uses: ./.github/actions/setup

- run: pnpm build
- run: sudo snap install dust

- uses: actions/download-artifact@v4
with:
name: pr
run-id: ${{ github.event.workflow_run.id }}

- name: "[PR] Get sizes for development outputs"
id: dev
run: |
cd pr/dist
dust --ignore_hidden \
--reverse --apparent-size \
--filter ".+.js$" \
--no-percent-bars \
--only-file \
--full-paths > 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 development outputs"
id: main-dev
run: |
cd dist
dust --ignore_hidden \
--reverse --apparent-size \
--filter ".+.js$" \
--no-percent-bars \
--only-file \
--full-paths > 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 |
#
# NOTE: we we don't have a prod build for this library
# because we currently expect non-compiler usage
# (so consumers should have terser or similar properly configured for DCE)
#
#########################
- uses: mshick/add-pr-comment@v2
with:
Comment thread
NullVoxPopuli marked this conversation as resolved.
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>
</tbody></table>



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