|
1 |
| -name: Bundle Analysis |
2 |
| - |
3 |
| -on: |
4 |
| - pull_request: |
5 |
| - paths: |
6 |
| - - packages/bits-ui/** |
7 |
| - - bundle-analyzer/** |
8 |
| - types: [opened, synchronize, reopened] |
9 |
| - |
10 |
| -concurrency: |
11 |
| - group: ${{ github.workflow }}-${{ github.event.number }} |
12 |
| - cancel-in-progress: true |
13 |
| - |
14 |
| -jobs: |
15 |
| - bundle-analysis: |
16 |
| - name: Bundle Size Analysis |
17 |
| - runs-on: ubuntu-latest |
18 |
| - |
19 |
| - permissions: |
20 |
| - contents: read |
21 |
| - pull-requests: write |
22 |
| - |
23 |
| - steps: |
24 |
| - - uses: actions/checkout@v4 |
25 |
| - with: |
26 |
| - fetch-depth: 0 |
27 |
| - - uses: pnpm/action-setup@v4 |
28 |
| - - uses: actions/setup-node@v4 |
29 |
| - with: |
30 |
| - node-version: 20 |
31 |
| - cache: pnpm |
32 |
| - |
33 |
| - - name: Install dependencies |
34 |
| - run: pnpm install --frozen-lockfile |
35 |
| - |
36 |
| - - name: Build packages |
37 |
| - run: pnpm build:packages |
38 |
| - |
39 |
| - - name: Run bundle analysis on PR |
40 |
| - run: pnpm bundle:analyze |
41 |
| - |
42 |
| - - name: Create temp directory and save PR bundle report |
43 |
| - run: | |
44 |
| - mkdir -p /tmp/bundle-analysis |
45 |
| - cp ./bundle-analyzer/bundle-reports/latest.json /tmp/bundle-analysis/pr-current.json |
46 |
| -
|
47 |
| - - name: Checkout target branch |
48 |
| - run: | |
49 |
| - git stash push -m "temp stash for bundle analysis" || true |
50 |
| - git fetch origin ${{ github.base_ref }} |
51 |
| - git checkout origin/${{ github.base_ref }} |
52 |
| -
|
53 |
| - - name: Get target branch bundle report |
54 |
| - id: check-target-bundle |
55 |
| - run: | |
56 |
| - if git cat-file -e HEAD:bundle-analyzer/bundle-reports/latest.json 2>/dev/null; then |
57 |
| - echo "exists=true" >> $GITHUB_OUTPUT |
58 |
| - git show HEAD:bundle-analyzer/bundle-reports/latest.json > /tmp/bundle-analysis/target-baseline.json |
59 |
| - else |
60 |
| - echo "exists=false" >> $GITHUB_OUTPUT |
61 |
| - fi |
62 |
| -
|
63 |
| - - name: Checkout PR branch |
64 |
| - run: | |
65 |
| - git checkout ${{ github.head_ref }} |
66 |
| - git stash pop || true |
67 |
| -
|
68 |
| - - name: Generate target baseline if missing |
69 |
| - if: steps.check-target-bundle.outputs.exists == 'false' |
70 |
| - run: | |
71 |
| - git stash push -m "temp stash for baseline generation" || true |
72 |
| - git checkout origin/${{ github.base_ref }} |
73 |
| - pnpm install --frozen-lockfile |
74 |
| - pnpm build:packages |
75 |
| - pnpm bundle:analyze || echo "Bundle analysis failed" |
76 |
| - if [ -f "./bundle-analyzer/bundle-reports/latest.json" ]; then |
77 |
| - cp ./bundle-analyzer/bundle-reports/latest.json /tmp/bundle-analysis/target-baseline.json |
78 |
| - else |
79 |
| - echo '{"timestamp":"","results":[]}' > /tmp/bundle-analysis/target-baseline.json |
80 |
| - fi |
81 |
| - git checkout ${{ github.head_ref }} |
82 |
| - git stash pop || true |
83 |
| -
|
84 |
| - - name: Generate bundle comparison comment |
85 |
| - id: bundle-comment |
86 |
| - run: | |
87 |
| - node ./bundle-analyzer/generate-pr-comment.js \ |
88 |
| - /tmp/bundle-analysis/pr-current.json \ |
89 |
| - /tmp/bundle-analysis/target-baseline.json |
90 |
| -
|
91 |
| - - name: Find existing comment |
92 |
| - uses: peter-evans/find-comment@a723a15ad60cf9419c01a6b8c9548ddd15e79531 |
93 |
| - id: existing-comment |
94 |
| - with: |
95 |
| - issue-number: ${{ github.event.pull_request.number }} |
96 |
| - comment-author: "github-actions[bot]" |
97 |
| - body-includes: "## 📦 Bundle Size Analysis" |
98 |
| - |
99 |
| - - name: Update or create comment |
100 |
| - uses: peter-evans/create-or-update-comment@be17e0c03de886b7aff3fb3224d28bfb6fc5d114 |
101 |
| - with: |
102 |
| - comment-id: ${{ steps.existing-comment.outputs.comment-id }} |
103 |
| - issue-number: ${{ github.event.pull_request.number }} |
104 |
| - body-path: /tmp/bundle-analysis/comment.md |
105 |
| - edit-mode: replace |
| 1 | +# name: Bundle Analysis |
| 2 | + |
| 3 | +# on: |
| 4 | +# pull_request: |
| 5 | +# paths: |
| 6 | +# - packages/bits-ui/** |
| 7 | +# - bundle-analyzer/** |
| 8 | +# types: [opened, synchronize, reopened] |
| 9 | + |
| 10 | +# concurrency: |
| 11 | +# group: ${{ github.workflow }}-${{ github.event.number }} |
| 12 | +# cancel-in-progress: true |
| 13 | + |
| 14 | +# jobs: |
| 15 | +# bundle-analysis: |
| 16 | +# name: Bundle Size Analysis |
| 17 | +# runs-on: ubuntu-latest |
| 18 | + |
| 19 | +# permissions: |
| 20 | +# contents: read |
| 21 | +# pull-requests: write |
| 22 | + |
| 23 | +# steps: |
| 24 | +# - uses: actions/checkout@v4 |
| 25 | +# with: |
| 26 | +# fetch-depth: 0 |
| 27 | +# - uses: pnpm/action-setup@v4 |
| 28 | +# - uses: actions/setup-node@v4 |
| 29 | +# with: |
| 30 | +# node-version: 20 |
| 31 | +# cache: pnpm |
| 32 | + |
| 33 | +# - name: Install dependencies |
| 34 | +# run: pnpm install --frozen-lockfile |
| 35 | + |
| 36 | +# - name: Build packages |
| 37 | +# run: pnpm build:packages |
| 38 | + |
| 39 | +# - name: Run bundle analysis on PR |
| 40 | +# run: pnpm bundle:analyze |
| 41 | + |
| 42 | +# - name: Create temp directory and save PR bundle report |
| 43 | +# run: | |
| 44 | +# mkdir -p /tmp/bundle-analysis |
| 45 | +# cp ./bundle-analyzer/bundle-reports/latest.json /tmp/bundle-analysis/pr-current.json |
| 46 | + |
| 47 | +# - name: Checkout target branch |
| 48 | +# run: | |
| 49 | +# git stash push -m "temp stash for bundle analysis" || true |
| 50 | +# git fetch origin ${{ github.base_ref }} |
| 51 | +# git checkout origin/${{ github.base_ref }} |
| 52 | + |
| 53 | +# - name: Get target branch bundle report |
| 54 | +# id: check-target-bundle |
| 55 | +# run: | |
| 56 | +# if git cat-file -e HEAD:bundle-analyzer/bundle-reports/latest.json 2>/dev/null; then |
| 57 | +# echo "exists=true" >> $GITHUB_OUTPUT |
| 58 | +# git show HEAD:bundle-analyzer/bundle-reports/latest.json > /tmp/bundle-analysis/target-baseline.json |
| 59 | +# else |
| 60 | +# echo "exists=false" >> $GITHUB_OUTPUT |
| 61 | +# fi |
| 62 | + |
| 63 | +# - name: Checkout PR branch |
| 64 | +# run: | |
| 65 | +# git checkout ${{ github.head_ref }} |
| 66 | +# git stash pop || true |
| 67 | + |
| 68 | +# - name: Generate target baseline if missing |
| 69 | +# if: steps.check-target-bundle.outputs.exists == 'false' |
| 70 | +# run: | |
| 71 | +# git stash push -m "temp stash for baseline generation" || true |
| 72 | +# git checkout origin/${{ github.base_ref }} |
| 73 | +# pnpm install --frozen-lockfile |
| 74 | +# pnpm build:packages |
| 75 | +# pnpm bundle:analyze || echo "Bundle analysis failed" |
| 76 | +# if [ -f "./bundle-analyzer/bundle-reports/latest.json" ]; then |
| 77 | +# cp ./bundle-analyzer/bundle-reports/latest.json /tmp/bundle-analysis/target-baseline.json |
| 78 | +# else |
| 79 | +# echo '{"timestamp":"","results":[]}' > /tmp/bundle-analysis/target-baseline.json |
| 80 | +# fi |
| 81 | +# git checkout ${{ github.head_ref }} |
| 82 | +# git stash pop || true |
| 83 | + |
| 84 | +# - name: Generate bundle comparison comment |
| 85 | +# id: bundle-comment |
| 86 | +# run: | |
| 87 | +# node ./bundle-analyzer/generate-pr-comment.js \ |
| 88 | +# /tmp/bundle-analysis/pr-current.json \ |
| 89 | +# /tmp/bundle-analysis/target-baseline.json |
| 90 | + |
| 91 | +# - name: Find existing comment |
| 92 | +# uses: peter-evans/find-comment@a723a15ad60cf9419c01a6b8c9548ddd15e79531 |
| 93 | +# id: existing-comment |
| 94 | +# with: |
| 95 | +# issue-number: ${{ github.event.pull_request.number }} |
| 96 | +# comment-author: "github-actions[bot]" |
| 97 | +# body-includes: "## 📦 Bundle Size Analysis" |
| 98 | + |
| 99 | +# - name: Update or create comment |
| 100 | +# uses: peter-evans/create-or-update-comment@be17e0c03de886b7aff3fb3224d28bfb6fc5d114 |
| 101 | +# with: |
| 102 | +# comment-id: ${{ steps.existing-comment.outputs.comment-id }} |
| 103 | +# issue-number: ${{ github.event.pull_request.number }} |
| 104 | +# body-path: /tmp/bundle-analysis/comment.md |
| 105 | +# edit-mode: replace |
0 commit comments