Skip to content

Commit 13139d0

Browse files
authored
ci: Re-add size limit action (#11096)
Size seems to be much increased, let's figure this out in follow ups. Also there is some issue with it reading next.js sizes, also something we can look at in follow ups... I disabled these size checks for now. The action is now inlined as a package in the monorepo, as our fork has been archived and the upstream package is not really maintained and works pretty different from what we need. Now we at least have full control over this.
1 parent 7466a52 commit 13139d0

File tree

8 files changed

+799
-119
lines changed

8 files changed

+799
-119
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,34 @@ jobs:
277277
# `job_build` can't see `job_install_deps` and what it returned)
278278
dependency_cache_key: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
279279

280+
job_size_check:
281+
name: Size Check
282+
needs: [job_get_metadata, job_build]
283+
timeout-minutes: 15
284+
runs-on: ubuntu-20.04
285+
if:
286+
github.event_name == 'pull_request' || needs.job_get_metadata.outputs.is_develop == 'true' ||
287+
needs.job_get_metadata.outputs.is_release == 'true'
288+
steps:
289+
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
290+
uses: actions/checkout@v4
291+
with:
292+
ref: ${{ env.HEAD_COMMIT }}
293+
- name: Set up Node
294+
uses: actions/setup-node@v4
295+
with:
296+
node-version-file: 'package.json'
297+
- name: Restore caches
298+
uses: ./.github/actions/restore-cache
299+
env:
300+
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
301+
- name: Check bundle sizes
302+
uses: ./dev-packages/size-limit-gh-action
303+
with:
304+
github_token: ${{ secrets.GITHUB_TOKEN }}
305+
# Only run comparison against develop if this is a PR
306+
comparison_branch: ${{ (github.event_name == 'pull_request' && github.base_ref) || ''}}
307+
280308
job_lint:
281309
name: Lint
282310
# Even though the linter only checks source code, not built code, it needs the built code in order check that all

.size-limit.js

Lines changed: 39 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
module.exports = [
22
// Main browser webpack builds
33
{
4-
name: '@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped)',
4+
name: '@sentry/browser (incl. Tracing, Replay, Feedback)',
55
path: 'packages/browser/build/npm/esm/index.js',
66
import: '{ init, replayIntegration, browserTracingIntegration, feedbackIntegration }',
77
gzip: true,
88
limit: '90 KB',
99
},
1010
{
11-
name: '@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped)',
11+
name: '@sentry/browser (incl. Tracing, Replay)',
1212
path: 'packages/browser/build/npm/esm/index.js',
1313
import: '{ init, replayIntegration, browserTracingIntegration }',
1414
gzip: true,
15-
limit: '75 KB',
15+
limit: '90 KB',
1616
},
1717
{
18-
name: '@sentry/browser (incl. Tracing, Replay with Canvas) - Webpack (gzipped)',
18+
name: '@sentry/browser (incl. Tracing, Replay with Canvas)',
1919
path: 'packages/browser/build/npm/esm/index.js',
2020
import: '{ init, replayIntegration, browserTracingIntegration, replayCanvasIntegration }',
2121
gzip: true,
2222
limit: '90 KB',
2323
},
2424
{
25-
name: '@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped)',
25+
name: '@sentry/browser (incl. Tracing, Replay) - with treeshaking flags',
2626
path: 'packages/browser/build/npm/esm/index.js',
2727
import: '{ init, replayIntegration, browserTracingIntegration }',
2828
gzip: true,
@@ -41,98 +41,98 @@ module.exports = [
4141
},
4242
},
4343
{
44-
name: '@sentry/browser (incl. Tracing) - Webpack (gzipped)',
44+
name: '@sentry/browser (incl. Tracing)',
4545
path: 'packages/browser/build/npm/esm/index.js',
4646
import: '{ init, browserTracingIntegration }',
4747
gzip: true,
48-
limit: '35 KB',
48+
limit: '90 KB',
4949
},
5050
{
51-
name: '@sentry/browser (incl. browserTracingIntegration) - Webpack (gzipped)',
51+
name: '@sentry/browser (incl. browserTracingIntegration)',
5252
path: 'packages/browser/build/npm/esm/index.js',
5353
import: '{ init, browserTracingIntegration }',
5454
gzip: true,
55-
limit: '35 KB',
55+
limit: '90 KB',
5656
},
5757
{
58-
name: '@sentry/browser (incl. feedbackIntegration) - Webpack (gzipped)',
58+
name: '@sentry/browser (incl. feedbackIntegration)',
5959
path: 'packages/browser/build/npm/esm/index.js',
6060
import: '{ init, feedbackIntegration }',
6161
gzip: true,
62-
limit: '50 KB',
62+
limit: '90 KB',
6363
},
6464
{
65-
name: '@sentry/browser (incl. feedbackModalIntegration) - Webpack (gzipped)',
65+
name: '@sentry/browser (incl. feedbackModalIntegration)',
6666
path: 'packages/browser/build/npm/esm/index.js',
6767
import: '{ init, feedbackIntegration, feedbackModalIntegration }',
6868
gzip: true,
69-
limit: '50 KB',
69+
limit: '90 KB',
7070
},
7171
{
72-
name: '@sentry/browser (incl. feedbackScreenshotIntegration) - Webpack (gzipped)',
72+
name: '@sentry/browser (incl. feedbackScreenshotIntegration)',
7373
path: 'packages/browser/build/npm/esm/index.js',
7474
import: '{ init, feedbackIntegration, feedbackModalIntegration, feedbackScreenshotIntegration }',
7575
gzip: true,
76-
limit: '50 KB',
76+
limit: '90 KB',
7777
},
7878
{
79-
name: '@sentry/browser (incl. sendFeedback) - Webpack (gzipped)',
79+
name: '@sentry/browser (incl. sendFeedback)',
8080
path: 'packages/browser/build/npm/esm/index.js',
8181
import: '{ init, sendFeedback }',
8282
gzip: true,
83-
limit: '50 KB',
83+
limit: '90 KB',
8484
},
8585
{
86-
name: '@sentry/browser - Webpack (gzipped)',
86+
name: '@sentry/browser',
8787
path: 'packages/browser/build/npm/esm/index.js',
8888
import: '{ init }',
8989
gzip: true,
90-
limit: '28 KB',
90+
limit: '90 KB',
9191
},
9292

9393
// Browser CDN bundles
9494
{
95-
name: '@sentry/browser (incl. Tracing, Replay, Feedback) - CDN Bundle (gzipped)',
95+
name: 'CDN Bundle (incl. Tracing, Replay, Feedback)',
9696
path: 'packages/browser/build/bundles/bundle.tracing.replay.feedback.min.js',
9797
gzip: true,
9898
limit: '90 KB',
9999
},
100100
{
101-
name: '@sentry/browser (incl. Tracing, Replay) - CDN Bundle (gzipped)',
101+
name: 'CDN Bundle (incl. Tracing, Replay)',
102102
path: 'packages/browser/build/bundles/bundle.tracing.replay.min.js',
103103
gzip: true,
104-
limit: '75 KB',
104+
limit: '90 KB',
105105
},
106106
{
107-
name: '@sentry/browser (incl. Tracing) - CDN Bundle (gzipped)',
107+
name: 'CDN Bundle (incl. Tracing)',
108108
path: 'packages/browser/build/bundles/bundle.tracing.min.js',
109109
gzip: true,
110-
limit: '37 KB',
110+
limit: '40 KB',
111111
},
112112
{
113-
name: '@sentry/browser - CDN Bundle (gzipped)',
113+
name: 'CDN Bundle',
114114
path: 'packages/browser/build/bundles/bundle.min.js',
115115
gzip: true,
116-
limit: '28 KB',
116+
limit: '30 KB',
117117
},
118118

119119
// browser CDN bundles (non-gzipped)
120120
{
121-
name: '@sentry/browser (incl. Tracing, Replay) - CDN Bundle (minified & uncompressed)',
121+
name: 'CDN Bundle (incl. Tracing, Replay) - uncompressed',
122122
path: 'packages/browser/build/bundles/bundle.tracing.replay.min.js',
123123
gzip: false,
124124
brotli: false,
125125
limit: '260 KB',
126126
},
127127
{
128-
name: '@sentry/browser (incl. Tracing) - CDN Bundle (minified & uncompressed)',
128+
name: 'CDN Bundle (incl. Tracing) - uncompressed',
129129
path: 'packages/browser/build/bundles/bundle.tracing.min.js',
130130
gzip: false,
131131
brotli: false,
132-
limit: '105 KB',
132+
limit: '120 KB',
133133
},
134134
{
135-
name: '@sentry/browser - CDN Bundle (minified & uncompressed)',
135+
name: 'CDN Bundle - uncompressed',
136136
path: 'packages/browser/build/bundles/bundle.min.js',
137137
gzip: false,
138138
brotli: false,
@@ -141,40 +141,34 @@ module.exports = [
141141

142142
// React
143143
{
144-
name: '@sentry/react (incl. Tracing, Replay) - Webpack (gzipped)',
144+
name: '@sentry/react (incl. Tracing, Replay)',
145145
path: 'packages/react/build/esm/index.js',
146146
import: '{ init, browserTracingIntegration, replayIntegration }',
147147
gzip: true,
148-
limit: '75 KB',
148+
limit: '90 KB',
149149
},
150150
{
151-
name: '@sentry/react - Webpack (gzipped)',
151+
name: '@sentry/react',
152152
path: 'packages/react/build/esm/index.js',
153153
import: '{ init }',
154154
gzip: true,
155-
limit: '30 KB',
155+
limit: '90 KB',
156156
},
157157

158158
// Next.js
159-
{
160-
name: '@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped)',
159+
// TODO: Re-enable these, when we figure out why they break...
160+
/* {
161+
name: '@sentry/nextjs Client (incl. Tracing, Replay)',
161162
path: 'packages/nextjs/build/esm/client/index.js',
162163
import: '{ init, browserTracingIntegration, replayIntegration }',
163164
gzip: true,
164165
limit: '110 KB',
165166
},
166167
{
167-
name: '@sentry/nextjs Client - Webpack (gzipped)',
168+
name: '@sentry/nextjs Client',
168169
path: 'packages/nextjs/build/esm/client/index.js',
169170
import: '{ init }',
170171
gzip: true,
171172
limit: '57 KB',
172-
},
173-
{
174-
name: '@sentry-internal/feedback - Webpack (gzipped)',
175-
path: 'packages/feedback/build/npm/esm/index.js',
176-
import: '{ feedbackIntegration }',
177-
gzip: true,
178-
limit: '25 KB',
179-
},
173+
}, */
180174
];
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
extends: ['../../.eslintrc.js'],
3+
parserOptions: {
4+
sourceType: 'module',
5+
ecmaVersion: 'latest',
6+
},
7+
8+
overrides: [
9+
{
10+
files: ['*.mjs'],
11+
extends: ['@sentry-internal/sdk/src/base'],
12+
},
13+
],
14+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'size-limit-gh-action'
2+
description: 'Run size-limit comparison'
3+
inputs:
4+
github_token:
5+
required: true
6+
description: 'a github access token'
7+
comparison_branch:
8+
required: false
9+
default: ""
10+
description: "If set, compare the current branch with this branch"
11+
threshold:
12+
required: false
13+
default: "0.0125"
14+
description: "The percentage threshold for size changes before posting a comment"
15+
runs:
16+
using: 'node20'
17+
main: 'index.mjs'

0 commit comments

Comments
 (0)