-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Port the sizes workflow from glimmer-vm #20883
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
Merged
kategengler
merged 15 commits into
emberjs:main
from
NullVoxPopuli:port-sizes-workflow-from-the-vm
Mar 25, 2025
+178
−0
Merged
Changes from 6 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
fa4929c
Port the sizes workflow from glimmer-vm
NullVoxPopuli 846059b
Explicity set permission
NullVoxPopuli 181c45e
Adjust permissions
NullVoxPopuli b069450
Use pull_request_target for safety
NullVoxPopuli 8debebf
pull_requset_target => pull_request
NullVoxPopuli b925967
Try to not be vulnerable to basic attacks in GH Actions
NullVoxPopuli 1d78ffb
Don't upload the whole dist as an artifact
NullVoxPopuli edd6808
Cache main on main
NullVoxPopuli 386ecea
Build on #main
NullVoxPopuli 68c0a01
Rename
NullVoxPopuli 1e3b169
Updates
NullVoxPopuli 9af2b5c
Concat the run id
NullVoxPopuli e691be9
Fix path
NullVoxPopuli 9aec96c
Fix paths
NullVoxPopuli c128395
paths
NullVoxPopuli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
| # 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 | ||
|
NullVoxPopuli marked this conversation as resolved.
Outdated
|
||
| path: pr/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| name: Size | ||
|
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: | ||
|
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 | ||
|
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: | ||
|
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 }} | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.