fix(nitro): bundle-safe runtime config for cloudflare-durable
#90
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: bench | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'packages/evlog/src/**' | |
| - 'packages/evlog/tsdown.config.ts' | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'packages/evlog/src/**' | |
| - 'packages/evlog/tsdown.config.ts' | |
| workflow_dispatch: | |
| jobs: | |
| bundle-size: | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: "1.3.11" | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Build evlog package | |
| run: bunx turbo run build --filter=evlog | |
| - name: Measure current bundle size | |
| working-directory: packages/evlog | |
| run: bun bench/scripts/size.ts --json > /tmp/size-current.json | |
| - name: Get baseline from main | |
| run: | | |
| git show origin/main:packages/evlog/bench/baseline/size.json > /tmp/size-baseline.json 2>/dev/null || echo '{"entries":[],"total":{"raw":0,"gzip":0}}' > /tmp/size-baseline.json | |
| - name: Compare sizes | |
| id: compare | |
| working-directory: packages/evlog | |
| run: | | |
| set +e | |
| REPORT=$(bun bench/scripts/compare.ts \ | |
| --size /tmp/size-baseline.json /tmp/size-current.json) | |
| EXIT_CODE=$? | |
| echo "exit_code=$EXIT_CODE" >> "$GITHUB_OUTPUT" | |
| EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
| echo "report<<$EOF" >> "$GITHUB_OUTPUT" | |
| echo "$REPORT" >> "$GITHUB_OUTPUT" | |
| echo "$EOF" >> "$GITHUB_OUTPUT" | |
| - name: Post PR comment | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const body = `${{ steps.compare.outputs.report }}`; | |
| const marker = '<!-- evlog-size -->'; | |
| const fullBody = `${marker}\n${body}`; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find(c => c.body?.includes(marker)); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body: fullBody, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: fullBody, | |
| }); | |
| } | |
| update-size-baseline: | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: "1.3.11" | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Build evlog package | |
| run: bunx turbo run build --filter=evlog | |
| - name: Measure bundle size | |
| working-directory: packages/evlog | |
| run: | | |
| mkdir -p bench/baseline | |
| bun bench/scripts/size.ts --json > bench/baseline/size.json | |
| - name: Create baseline PR | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| commit-message: "chore(bench): update size baseline" | |
| title: "chore(bench): update size baseline" | |
| body: Automated bundle size baseline update from main. | |
| branch: chore/update-bench-baseline | |
| add-paths: | | |
| packages/evlog/bench/baseline/size.json | |
| delete-branch: true | |
| labels: performance |