fix[DeepPartial, DeepReadonly, Simplify]: preserve branded primitive types #427
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: Bundle Size | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'src/**' | |
| - 'benchmarks/**' | |
| - 'package.json' | |
| - 'yarn.lock' | |
| - '.github/workflows/bundle-size.yml' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'src/**' | |
| - 'benchmarks/**' | |
| - 'package.json' | |
| - 'yarn.lock' | |
| - '.github/workflows/bundle-size.yml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: read-all | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| IS_FORK_PR: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| # For same-repo pull requests, check out the head branch itself so a | |
| # snapshot update can be pushed back to it. Forks and pushes use the | |
| # default ref. | |
| ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.head.ref || '' }} | |
| - run: corepack enable | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: 'yarn' | |
| - run: yarn install | |
| - name: Check bundle size snapshots | |
| id: check | |
| continue-on-error: true | |
| run: yarn workspace benchmarks vitest run bundle-size --reporter=github-actions | |
| - name: Update stale snapshots | |
| if: steps.check.outcome == 'failure' | |
| run: | | |
| yarn workspace benchmarks vitest run --update bundle-size | |
| yarn prettier --write 'benchmarks/bundle-size/**/*.spec.ts' | |
| - name: Verify updated snapshots | |
| if: steps.check.outcome == 'failure' | |
| run: yarn workspace benchmarks vitest run bundle-size | |
| - name: Push snapshot update to pull request | |
| if: steps.check.outcome == 'failure' && github.event_name == 'pull_request' && env.IS_FORK_PR == 'false' | |
| run: | | |
| git config user.name 'github-actions[bot]' | |
| git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
| git add benchmarks/bundle-size | |
| git commit -m 'test: update bundle size snapshots' | |
| git push origin HEAD:'${{ github.event.pull_request.head.ref }}' | |
| echo "::notice::Bundle size snapshots were stale. An update commit was pushed to this branch." | |
| - name: Open pull request with snapshot update | |
| if: steps.check.outcome == 'failure' && github.event_name == 'push' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| branch=ci/update-bundle-size | |
| git config user.name 'github-actions[bot]' | |
| git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
| git add benchmarks/bundle-size | |
| git commit -m 'test: update bundle size snapshots' | |
| git push --force origin HEAD:refs/heads/"$branch" | |
| if [ -z "$(gh pr list --head "$branch" --state open --json number --jq '.[].number')" ]; then | |
| gh pr create --base main --head "$branch" \ | |
| --title 'test: update bundle size snapshots' \ | |
| --body 'The bundle size snapshots on `main` no longer match the measured sizes, likely because a dependency or source change landed without refreshing them. This pull request was opened automatically by the Bundle Size workflow with the refreshed snapshots.' | |
| fi | |
| echo "::notice::Bundle size snapshots on main were stale. A pull request with the refreshed snapshots was opened." | |
| - name: Report stale snapshots on fork pull request | |
| if: steps.check.outcome == 'failure' && env.IS_FORK_PR == 'true' | |
| run: | | |
| { | |
| echo '### Bundle size snapshots are stale' | |
| echo '' | |
| echo 'This pull request comes from a fork, so the snapshots cannot be updated automatically.' | |
| echo 'Run `yarn workspace benchmarks check-bundle-size` locally and commit the result:' | |
| echo '' | |
| echo '```diff' | |
| git diff benchmarks/bundle-size | |
| echo '```' | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| echo "::error::Bundle size snapshots are stale. Run 'yarn workspace benchmarks check-bundle-size' locally and commit the result." | |
| exit 1 |