Skip to content

Commit 11018e1

Browse files
fix(enhanced): use webpack sources from internal webpack obj
1 parent 4e00723 commit 11018e1

File tree

1 file changed

+43
-38
lines changed

1 file changed

+43
-38
lines changed

.github/workflows/bundle-size.yml

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches: [main]
66

77
jobs:
8-
build:
8+
check-packages:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
@@ -33,52 +33,57 @@ jobs:
3333
restore-keys: |
3434
${{ runner.os }}-pnpm-store-
3535
36-
- name: Install dependencies
37-
run: pnpm install
38-
39-
- name: Build and compare sizes
36+
- name: Check package build sizes
4037
uses: preactjs/compressed-size-action@v2
4138
with:
42-
build-script: 'build:pkg && app:next:build'
43-
pattern: '{./packages/**/dist/**/*.{js,mjs,cjs},./apps/**/dist/**/*.{js,mjs,cjs}}'
39+
repo-token: '${{ secrets.GITHUB_TOKEN }}'
40+
build-script: 'build:pkg'
41+
pattern: './packages/**/dist/**/*.{js,mjs,cjs}'
4442
exclude: '{**/*.map,**/node_modules/**}'
45-
clean-script: 'rm -rf packages/*/dist apps/*/dist'
4643
compression: 'gzip'
47-
save-stats: true
48-
stats-path: 'bundle-stats.json'
44+
comment-key: 'packages'
45+
46+
check-apps:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
4950

50-
- name: Generate detailed report
51-
uses: NejcZdovc/bundle-size-diff@v1
51+
- name: Setup Node.js
52+
uses: actions/setup-node@v4
5253
with:
53-
base_path: './bundle-stats.json'
54-
pr_path: './bundle-stats.json'
55-
excluded_assets: ".*\\.map$"
54+
node-version: '18'
5655

57-
- name: Comment PR
58-
uses: actions/github-script@v7
56+
- name: Install pnpm
57+
uses: pnpm/action-setup@v2
5958
with:
60-
script: |
61-
const stats = require('./bundle-stats.json');
62-
const comment = `## Bundle Size Report
59+
version: 8.11.0
6360

64-
### Package Builds
65-
${Object.entries(stats.packages || {})
66-
.map(([name, size]) => `- ${name}: ${size}`)
67-
.join('\n')}
61+
- name: Get pnpm store directory
62+
shell: bash
63+
run: |
64+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
6865
69-
### App Builds
70-
${Object.entries(stats.apps || {})
71-
.map(([name, size]) => `- ${name}: ${size}`)
72-
.join('\n')}
66+
- name: Setup pnpm cache
67+
uses: actions/cache@v3
68+
with:
69+
path: ${{ env.STORE_PATH }}
70+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
71+
restore-keys: |
72+
${{ runner.os }}-pnpm-store-
7373
74-
### Total Changes
75-
- Total Size: ${stats.total}
76-
- Gzipped Size: ${stats.gzipped}
77-
`;
74+
- name: Install dependencies
75+
run: pnpm install
7876

79-
github.rest.issues.createComment({
80-
issue_number: context.issue.number,
81-
owner: context.repo.owner,
82-
repo: context.repo.repo,
83-
body: comment
84-
});
77+
- name: Build packages (prerequisite for building apps)
78+
run: pnpm build:pkg
79+
80+
- name: Check app build sizes
81+
uses: preactjs/compressed-size-action@v2
82+
with:
83+
repo-token: '${{ secrets.GITHUB_TOKEN }}'
84+
build-script: 'app:next:build'
85+
pattern: './apps/**/dist/**/*.{js,mjs,cjs}'
86+
exclude: '{**/*.map,**/node_modules/**}'
87+
compression: 'gzip'
88+
comment-key: 'apps'
89+
clean-script: 'rm -rf apps/*/dist'

0 commit comments

Comments
 (0)