Skip to content

ci(audience): add pixel bundle size tracking GitHub Action#2835

Merged
bkbooth merged 3 commits into
mainfrom
SDK-68-pixel-github-bundle-size-action
Apr 9, 2026
Merged

ci(audience): add pixel bundle size tracking GitHub Action#2835
bkbooth merged 3 commits into
mainfrom
SDK-68-pixel-github-bundle-size-action

Conversation

@bkbooth
Copy link
Copy Markdown
Contributor

@bkbooth bkbooth commented Apr 8, 2026

Summary

  • Adds a GitHub Action PR check that builds @imtbl/pixel and gates on a 10KB gzipped bundle budget (SDK-68)
  • Posts a sticky PR comment with current gzipped + raw sizes and delta vs main
  • Warning threshold at 8KB, hard failure at 10KB — both configurable via packages/audience/pixel/bundlebudget.json
  • Triggers only on PRs touching packages/audience/pixel/** or packages/audience/core/**

Test plan

  • Open a test PR touching packages/audience/pixel/ — verify workflow triggers, comment appears, check passes (~4KB is well under budget)
  • Temporarily lower maxSizeGzip to below current size — verify check fails with "Over budget" message
  • Lower warnSizeGzip to below current size — verify warning appears but check still passes
  • Open a PR touching only unrelated files — verify workflow does NOT trigger

🤖 Generated with Claude Code

Adds a PR check that builds the pixel package and verifies the gzipped
bundle stays under the 10KB budget. Posts a sticky PR comment with the
current size and delta vs main, with warning at 8KB and failure at 10KB.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bkbooth bkbooth requested review from a team as code owners April 8, 2026 06:49
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 8, 2026

View your CI Pipeline Execution ↗ for commit 656ad41

Command Status Duration Result
nx run-many -p @imtbl/sdk,@imtbl/checkout-widge... ✅ Succeeded 2s View ↗
nx affected -t build,lint,test ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-09 00:15:34 UTC

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

✅ Pixel Bundle Size — @imtbl/pixel

Metric Size Delta vs main
Gzipped 4165 bytes (4.06 KB) 0 bytes
Raw (minified) 11223 bytes 0 bytes

Budget: 10.00 KB gzipped (warn at 8.00 KB)

@bkbooth bkbooth marked this pull request as draft April 8, 2026 06:57
@bkbooth bkbooth force-pushed the SDK-68-pixel-github-bundle-size-action branch from fde9235 to 3f78122 Compare April 8, 2026 07:04
@bkbooth bkbooth marked this pull request as ready for review April 8, 2026 07:05
Copy link
Copy Markdown
Contributor

@nattb8 nattb8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to block the PR from merging too if it fails? But only affect PRs that touch audience/pixel or audience/core

Comment thread .github/workflows/pixel-bundle-size.yaml Outdated
Checking out by branch name rather than SHA means if someone pushes to
the branch between the event firing and the checkout step, the workflow
could build the wrong code. Pin to the exact commit SHA instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread .github/workflows/pr.yaml
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we want to keep this? @nattb8 flagged an issue with my new action using .ref, so I fixed this action too.

@bkbooth bkbooth force-pushed the SDK-68-pixel-github-bundle-size-action branch from 3f23709 to 656ad41 Compare April 8, 2026 23:38
@bkbooth
Copy link
Copy Markdown
Contributor Author

bkbooth commented Apr 8, 2026

Is it possible to block the PR from merging too if it fails? But only affect PRs that touch audience/pixel or audience/core

@nattb8 yep, it already does this. It updates the comment so that it doesn't spam the PR on every commit so I took some screenshots.

Over warning budget (check passes, warning message):
Screenshot 2026-04-09 at 9 36 01 am

Over threshold (fails check + error message):
Screenshot 2026-04-09 at 9 32 54 am
Screenshot 2026-04-09 at 9 33 11 am

(I just noticed the deltas are 0 now and I'm taking a look, I wonder if that broke when changing to use .sha instead of .ref - nevermind, 0 bytes delta is expected because we're not changing the pixel code here 🤦‍♂️)

@bkbooth bkbooth force-pushed the SDK-68-pixel-github-bundle-size-action branch 2 times, most recently from ceddf5d to e0704da Compare April 8, 2026 23:56
@bkbooth
Copy link
Copy Markdown
Contributor Author

bkbooth commented Apr 9, 2026

Test change with +delta to the pixel bundle:
Screenshot 2026-04-09 at 10 00 10 am

@bkbooth bkbooth force-pushed the SDK-68-pixel-github-bundle-size-action branch from e0704da to 656ad41 Compare April 9, 2026 00:02
@bkbooth bkbooth added this pull request to the merge queue Apr 9, 2026
Merged via the queue into main with commit 0253e7f Apr 9, 2026
20 checks passed
@bkbooth bkbooth deleted the SDK-68-pixel-github-bundle-size-action branch April 9, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants