|
| 1 | +on: |
| 2 | + pull_request: |
| 3 | + paths: |
| 4 | + - 'packages/toolbar/**' |
| 5 | + - '**/package.json' |
| 6 | + - 'pnpm-lock.yaml' |
| 7 | +name: Toolbar bundle size diff |
| 8 | + |
| 9 | +jobs: |
| 10 | + build-head-stats: |
| 11 | + name: 'Build head (bundle stats)' |
| 12 | + runs-on: ubuntu-latest |
| 13 | + timeout-minutes: 15 |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + - name: Setup pnpm |
| 17 | + uses: pnpm/action-setup@v4 |
| 18 | + - name: Setup Node.js |
| 19 | + uses: actions/setup-node@v4 |
| 20 | + with: |
| 21 | + node-version: '23' |
| 22 | + cache: 'pnpm' |
| 23 | + - name: Install dependencies |
| 24 | + run: pnpm install --frozen-lockfile |
| 25 | + - name: Build toolbar and generate bundle analysis |
| 26 | + working-directory: packages/toolbar |
| 27 | + env: |
| 28 | + NODE_OPTIONS: '--max-old-space-size=4096' |
| 29 | + run: | |
| 30 | + # Build with bundle analysis and generate stats file |
| 31 | + pnpm build:analyze |
| 32 | + - name: Upload bundle analysis artifacts |
| 33 | + uses: actions/upload-artifact@v4 |
| 34 | + if: ${{ !cancelled() }} |
| 35 | + with: |
| 36 | + name: head-toolbar-bundle-stats |
| 37 | + path: packages/toolbar/rspack-stats.json |
| 38 | + if-no-files-found: error |
| 39 | + |
| 40 | + build-base-stats: |
| 41 | + name: 'Build base (bundle stats)' |
| 42 | + runs-on: ubuntu-latest |
| 43 | + timeout-minutes: 15 |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + ref: ${{ github.base_ref }} |
| 48 | + - name: Setup pnpm |
| 49 | + uses: pnpm/action-setup@v4 |
| 50 | + - name: Setup Node.js |
| 51 | + uses: actions/setup-node@v4 |
| 52 | + with: |
| 53 | + node-version: '23.5.0' |
| 54 | + cache: 'pnpm' |
| 55 | + - name: Install dependencies |
| 56 | + run: pnpm install --frozen-lockfile |
| 57 | + - name: Build toolbar and generate bundle analysis |
| 58 | + working-directory: packages/toolbar |
| 59 | + env: |
| 60 | + NODE_OPTIONS: '--max-old-space-size=4096' |
| 61 | + run: | |
| 62 | + # Build with bundle analysis and generate stats file |
| 63 | + pnpm build:analyze |
| 64 | + - name: Upload bundle analysis artifacts |
| 65 | + uses: actions/upload-artifact@v4 |
| 66 | + if: ${{ !cancelled() }} |
| 67 | + with: |
| 68 | + name: base-toolbar-bundle-stats |
| 69 | + path: packages/toolbar/rspack-stats.json |
| 70 | + if-no-files-found: error |
| 71 | + |
| 72 | + compare-bundle-sizes: |
| 73 | + name: 'Compare toolbar bundle sizes' |
| 74 | + runs-on: ubuntu-latest |
| 75 | + needs: [build-base-stats, build-head-stats] |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v4 |
| 78 | + - name: Download base bundle artifacts |
| 79 | + uses: actions/download-artifact@v4 |
| 80 | + with: |
| 81 | + name: base-toolbar-bundle-stats |
| 82 | + path: base-stats |
| 83 | + - name: Download head bundle artifacts |
| 84 | + uses: actions/download-artifact@v4 |
| 85 | + with: |
| 86 | + name: head-toolbar-bundle-stats |
| 87 | + path: head-stats |
| 88 | + - name: Compare toolbar bundle sizes |
| 89 | + uses: launchdarkly-labs/webpack-bundle-diff-action@c903b35abed2d2315a06128757cb5c80a6b7abca # pin@main |
| 90 | + with: |
| 91 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 92 | + base-bundle-analysis-report-path: ./base-stats/rspack-stats.json |
| 93 | + head-bundle-analysis-report-path: ./head-stats/rspack-stats.json |
| 94 | + increase-label: '⚠️ toolbar bundle increase' |
| 95 | + decrease-label: '🎉 toolbar bundle decrease' |
| 96 | + # No bundle size budgets - just track changes for now |
| 97 | + should-block-pr-on-exceeded-budget: false |
| 98 | + skip-comment-on-no-changes: true |
0 commit comments