Skip to content

Commit 7eb7253

Browse files
authored
ci(repo): enforce bundlewatch bundle-size budgets (#8752)
1 parent 81ce9d3 commit 7eb7253

3 files changed

Lines changed: 46 additions & 11 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.github/workflows/ci.yml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,21 +138,17 @@ jobs:
138138
path: .turbo/runs
139139
retention-days: 5
140140

141-
static-analysis:
141+
bundle-size:
142142
needs: [check-permissions, build-packages]
143-
name: Static analysis
143+
name: Bundle size
144144
permissions:
145145
contents: read
146-
actions: write # needed for actions/upload-artifact
147146
runs-on: "blacksmith-8vcpu-ubuntu-2204"
148147
defaults:
149148
run:
150149
shell: bash
151150
timeout-minutes: ${{ vars.TIMEOUT_MINUTES_NORMAL && fromJSON(vars.TIMEOUT_MINUTES_NORMAL) || 10 }}
152151

153-
env:
154-
TURBO_SUMMARIZE: false
155-
156152
steps:
157153
- name: Checkout Repo
158154
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
@@ -169,21 +165,57 @@ jobs:
169165
with:
170166
cache-enabled: true
171167
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
172-
turbo-summarize: ${{ env.TURBO_SUMMARIZE }}
173168
turbo-team: ${{ vars.TURBO_TEAM }}
174169
turbo-token: ${{ secrets.TURBO_TOKEN }}
175170

171+
# No continue-on-error: an over-budget chunk fails this job, which is the gate.
172+
# Enforcement rides on this job's exit code, not the `bundlewatch` commit status
173+
# (which collides across packages and can be masked by a sibling's pass).
176174
- name: Check size using bundlewatch
177-
continue-on-error: true
178175
env:
179176
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
180-
CI_BRANCH: ${{ github.ref }}
177+
CI_BRANCH: ${{ github.ref }}
181178
CI_BRANCH_BASE: refs/heads/main
182-
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
179+
CI_COMMIT_SHA: ${{ github.event_name == 'merge_group' && github.event.merge_group.head_sha || github.event.pull_request.head.sha }}
183180
CI_REPO_NAME: ${{ vars.REPO_NAME }}
184181
CI_REPO_OWNER: ${{ vars.REPO_OWNER }}
185182
run: pnpm turbo bundlewatch $TURBO_ARGS
186183

184+
static-analysis:
185+
needs: [check-permissions, build-packages]
186+
name: Static analysis
187+
permissions:
188+
contents: read
189+
actions: write # needed for actions/upload-artifact
190+
runs-on: "blacksmith-8vcpu-ubuntu-2204"
191+
defaults:
192+
run:
193+
shell: bash
194+
timeout-minutes: ${{ vars.TIMEOUT_MINUTES_NORMAL && fromJSON(vars.TIMEOUT_MINUTES_NORMAL) || 10 }}
195+
196+
env:
197+
TURBO_SUMMARIZE: false
198+
199+
steps:
200+
- name: Checkout Repo
201+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
202+
with:
203+
persist-credentials: false
204+
fetch-depth: 1
205+
fetch-tags: false
206+
filter: "blob:none"
207+
show-progress: false
208+
209+
- name: Setup
210+
id: config
211+
uses: ./.github/actions/init-blacksmith
212+
with:
213+
cache-enabled: true
214+
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
215+
turbo-summarize: ${{ env.TURBO_SUMMARIZE }}
216+
turbo-team: ${{ vars.TURBO_TEAM }}
217+
turbo-token: ${{ secrets.TURBO_TOKEN }}
218+
187219
- name: Lint packages using publint
188220
run: pnpm turbo lint:publint $TURBO_ARGS
189221

packages/ui/bundlewatch.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"files": [
33
{ "path": "./dist/ui.browser.js", "maxSize": "42KB" },
44
{ "path": "./dist/ui.legacy.browser.js", "maxSize": "84KB" },
5+
{ "path": "./dist/ui.shared.browser.js", "maxSize": "40KB" },
56
{ "path": "./dist/framework*.js", "maxSize": "44KB" },
67
{ "path": "./dist/vendors*.js", "maxSize": "73KB" },
78
{ "path": "./dist/ui-common*.js", "maxSize": "130KB" },
@@ -32,6 +33,6 @@
3233
{ "path": "./dist/op-plans-page*.js", "maxSize": "3KB" },
3334
{ "path": "./dist/statement-page*.js", "maxSize": "5KB" },
3435
{ "path": "./dist/payment-attempt-page*.js", "maxSize": "4KB" },
35-
{ "path": "./dist/web3-solana-wallet-buttons*.js", "maxSize": "79KB" }
36+
{ "path": "./dist/web3-solana-wallet-buttons*.js", "maxSize": "85KB" }
3637
]
3738
}

0 commit comments

Comments
 (0)