Skip to content

ci: Re-add size limit action #11096

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
merged 4 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,34 @@ jobs:
# `job_build` can't see `job_install_deps` and what it returned)
dependency_cache_key: ${{ needs.job_install_deps.outputs.dependency_cache_key }}

job_size_check:
name: Size Check
needs: [job_get_metadata, job_build]
timeout-minutes: 15
runs-on: ubuntu-20.04
if:
github.event_name == 'pull_request' || needs.job_get_metadata.outputs.is_develop == 'true' ||
needs.job_get_metadata.outputs.is_release == 'true'
steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v4
with:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check bundle sizes
uses: ./dev-packages/size-limit-gh-action
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Only run comparison against develop if this is a PR
comparison_branch: ${{ (github.event_name == 'pull_request' && github.base_ref) || ''}}

job_lint:
name: Lint
# Even though the linter only checks source code, not built code, it needs the built code in order check that all
Expand Down
84 changes: 39 additions & 45 deletions .size-limit.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
module.exports = [
// Main browser webpack builds
{
name: '@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped)',
name: '@sentry/browser (incl. Tracing, Replay, Feedback)',
path: 'packages/browser/build/npm/esm/index.js',
import: '{ init, replayIntegration, browserTracingIntegration, feedbackIntegration }',
gzip: true,
limit: '90 KB',
},
{
name: '@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped)',
name: '@sentry/browser (incl. Tracing, Replay)',
path: 'packages/browser/build/npm/esm/index.js',
import: '{ init, replayIntegration, browserTracingIntegration }',
gzip: true,
limit: '75 KB',
limit: '90 KB',
},
{
name: '@sentry/browser (incl. Tracing, Replay with Canvas) - Webpack (gzipped)',
name: '@sentry/browser (incl. Tracing, Replay with Canvas)',
path: 'packages/browser/build/npm/esm/index.js',
import: '{ init, replayIntegration, browserTracingIntegration, replayCanvasIntegration }',
gzip: true,
limit: '90 KB',
},
{
name: '@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped)',
name: '@sentry/browser (incl. Tracing, Replay) - with treeshaking flags',
path: 'packages/browser/build/npm/esm/index.js',
import: '{ init, replayIntegration, browserTracingIntegration }',
gzip: true,
Expand All @@ -41,98 +41,98 @@ module.exports = [
},
},
{
name: '@sentry/browser (incl. Tracing) - Webpack (gzipped)',
name: '@sentry/browser (incl. Tracing)',
path: 'packages/browser/build/npm/esm/index.js',
import: '{ init, browserTracingIntegration }',
gzip: true,
limit: '35 KB',
limit: '90 KB',
},
{
name: '@sentry/browser (incl. browserTracingIntegration) - Webpack (gzipped)',
name: '@sentry/browser (incl. browserTracingIntegration)',
path: 'packages/browser/build/npm/esm/index.js',
import: '{ init, browserTracingIntegration }',
gzip: true,
limit: '35 KB',
limit: '90 KB',
},
{
name: '@sentry/browser (incl. feedbackIntegration) - Webpack (gzipped)',
name: '@sentry/browser (incl. feedbackIntegration)',
path: 'packages/browser/build/npm/esm/index.js',
import: '{ init, feedbackIntegration }',
gzip: true,
limit: '50 KB',
limit: '90 KB',
},
{
name: '@sentry/browser (incl. feedbackModalIntegration) - Webpack (gzipped)',
name: '@sentry/browser (incl. feedbackModalIntegration)',
path: 'packages/browser/build/npm/esm/index.js',
import: '{ init, feedbackIntegration, feedbackModalIntegration }',
gzip: true,
limit: '50 KB',
limit: '90 KB',
},
{
name: '@sentry/browser (incl. feedbackScreenshotIntegration) - Webpack (gzipped)',
name: '@sentry/browser (incl. feedbackScreenshotIntegration)',
path: 'packages/browser/build/npm/esm/index.js',
import: '{ init, feedbackIntegration, feedbackModalIntegration, feedbackScreenshotIntegration }',
gzip: true,
limit: '50 KB',
limit: '90 KB',
},
{
name: '@sentry/browser (incl. sendFeedback) - Webpack (gzipped)',
name: '@sentry/browser (incl. sendFeedback)',
path: 'packages/browser/build/npm/esm/index.js',
import: '{ init, sendFeedback }',
gzip: true,
limit: '50 KB',
limit: '90 KB',
},
{
name: '@sentry/browser - Webpack (gzipped)',
name: '@sentry/browser',
path: 'packages/browser/build/npm/esm/index.js',
import: '{ init }',
gzip: true,
limit: '28 KB',
limit: '90 KB',
},

// Browser CDN bundles
{
name: '@sentry/browser (incl. Tracing, Replay, Feedback) - CDN Bundle (gzipped)',
name: 'CDN Bundle (incl. Tracing, Replay, Feedback)',
path: 'packages/browser/build/bundles/bundle.tracing.replay.feedback.min.js',
gzip: true,
limit: '90 KB',
},
{
name: '@sentry/browser (incl. Tracing, Replay) - CDN Bundle (gzipped)',
name: 'CDN Bundle (incl. Tracing, Replay)',
path: 'packages/browser/build/bundles/bundle.tracing.replay.min.js',
gzip: true,
limit: '75 KB',
limit: '90 KB',
},
{
name: '@sentry/browser (incl. Tracing) - CDN Bundle (gzipped)',
name: 'CDN Bundle (incl. Tracing)',
path: 'packages/browser/build/bundles/bundle.tracing.min.js',
gzip: true,
limit: '37 KB',
limit: '40 KB',
},
{
name: '@sentry/browser - CDN Bundle (gzipped)',
name: 'CDN Bundle',
path: 'packages/browser/build/bundles/bundle.min.js',
gzip: true,
limit: '28 KB',
limit: '30 KB',
},

// browser CDN bundles (non-gzipped)
{
name: '@sentry/browser (incl. Tracing, Replay) - CDN Bundle (minified & uncompressed)',
name: 'CDN Bundle (incl. Tracing, Replay) - uncompressed',
path: 'packages/browser/build/bundles/bundle.tracing.replay.min.js',
gzip: false,
brotli: false,
limit: '260 KB',
},
{
name: '@sentry/browser (incl. Tracing) - CDN Bundle (minified & uncompressed)',
name: 'CDN Bundle (incl. Tracing) - uncompressed',
path: 'packages/browser/build/bundles/bundle.tracing.min.js',
gzip: false,
brotli: false,
limit: '105 KB',
limit: '120 KB',
},
{
name: '@sentry/browser - CDN Bundle (minified & uncompressed)',
name: 'CDN Bundle - uncompressed',
path: 'packages/browser/build/bundles/bundle.min.js',
gzip: false,
brotli: false,
Expand All @@ -141,40 +141,34 @@ module.exports = [

// React
{
name: '@sentry/react (incl. Tracing, Replay) - Webpack (gzipped)',
name: '@sentry/react (incl. Tracing, Replay)',
path: 'packages/react/build/esm/index.js',
import: '{ init, browserTracingIntegration, replayIntegration }',
gzip: true,
limit: '75 KB',
limit: '90 KB',
},
{
name: '@sentry/react - Webpack (gzipped)',
name: '@sentry/react',
path: 'packages/react/build/esm/index.js',
import: '{ init }',
gzip: true,
limit: '30 KB',
limit: '90 KB',
},

// Next.js
{
name: '@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped)',
// TODO: Re-enable these, when we figure out why they break...
/* {
name: '@sentry/nextjs Client (incl. Tracing, Replay)',
path: 'packages/nextjs/build/esm/client/index.js',
import: '{ init, browserTracingIntegration, replayIntegration }',
gzip: true,
limit: '110 KB',
},
{
name: '@sentry/nextjs Client - Webpack (gzipped)',
name: '@sentry/nextjs Client',
path: 'packages/nextjs/build/esm/client/index.js',
import: '{ init }',
gzip: true,
limit: '57 KB',
},
{
name: '@sentry-internal/feedback - Webpack (gzipped)',
path: 'packages/feedback/build/npm/esm/index.js',
import: '{ feedbackIntegration }',
gzip: true,
limit: '25 KB',
},
}, */
];
14 changes: 14 additions & 0 deletions dev-packages/size-limit-gh-action/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
extends: ['../../.eslintrc.js'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
},

overrides: [
{
files: ['*.mjs'],
extends: ['@sentry-internal/sdk/src/base'],
},
],
};
17 changes: 17 additions & 0 deletions dev-packages/size-limit-gh-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'size-limit-gh-action'
description: 'Run size-limit comparison'
inputs:
github_token:
required: true
description: 'a github access token'
comparison_branch:
required: false
default: ""
description: "If set, compare the current branch with this branch"
threshold:
required: false
default: "0.0125"
description: "The percentage threshold for size changes before posting a comment"
runs:
using: 'node20'
main: 'index.mjs'
Loading