pkg: Update build packages (major) #523
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: Benchmark React | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| paths: | |
| - 'packages/react/src/**' | |
| - 'packages/core/src/**' | |
| - 'packages/endpoint/src/schemas/**' | |
| - 'packages/normalizr/src/**' | |
| - 'examples/benchmark-react/**' | |
| - '.github/workflows/benchmark-react.yml' | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - 'packages/react/src/**' | |
| - 'packages/core/src/**' | |
| - 'packages/endpoint/src/schemas/**' | |
| - 'packages/normalizr/src/**' | |
| - 'examples/benchmark-react/**' | |
| - '.github/workflows/benchmark-react.yml' | |
| concurrency: | |
| group: ${{ github.event_name == 'push' && 'gh-pages-bench-react-push' || format('benchmark-react-{0}', github.head_ref) }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| benchmark-react: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 1 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '26' | |
| cache: 'yarn' | |
| - name: Install packages | |
| run: ./scripts/ci-install.sh examples/benchmark-react | |
| - name: Get Playwright version | |
| id: playwright-version | |
| run: | | |
| echo "version=$(node -p "require(require.resolve('playwright/package.json', { paths: ['examples/benchmark-react'] })).version")" >> "$GITHUB_OUTPUT" | |
| - name: Cache Playwright browsers | |
| id: playwright-cache | |
| uses: actions/cache@v6 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }} | |
| - name: Install Playwright (Chromium + system deps) | |
| # System deps can't live in the cache, so install them either way. | |
| run: | | |
| if [ "${{ steps.playwright-cache.outputs.cache-hit }}" = "true" ]; then | |
| npx playwright install-deps chromium | |
| else | |
| npx playwright install chromium --with-deps | |
| fi | |
| - name: Build packages | |
| run: yarn build:benchmark-react | |
| - name: Tune system for benchmarking | |
| run: | | |
| # Pin CPU governor to performance mode (reduces frequency scaling jitter) | |
| for gov in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do | |
| echo performance | sudo tee "$gov" 2>/dev/null || true | |
| done | |
| # Disable swap to prevent memory pressure variance | |
| sudo swapoff -a || true | |
| - name: Run benchmark | |
| run: | | |
| yarn workspace example-benchmark-react preview & | |
| for i in $(seq 1 30); do | |
| curl -sf http://localhost:5173/ > /dev/null && break | |
| sleep 1 | |
| done | |
| cd examples/benchmark-react && taskset -c 0,1 yarn bench | tee react-bench-output.json | |
| # PR comments on changes | |
| - name: Store benchmark result (PR) | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: rhysd/github-action-benchmark@v1 | |
| with: | |
| name: 'Benchmark React' | |
| tool: 'customBiggerIsBetter' | |
| output-file-path: examples/benchmark-react/react-bench-output.json | |
| github-token: "${{ secrets.GITHUB_TOKEN }}" | |
| gh-pages-branch: 'gh-pages-bench' | |
| benchmark-data-dir-path: react-bench | |
| alert-threshold: '150%' | |
| comment-always: true | |
| fail-on-alert: false | |
| alert-comment-cc-users: '@ntucker' | |
| save-data-file: false | |
| auto-push: false | |
| # master reports to history | |
| - name: Store benchmark result (main) | |
| if: ${{ github.event_name == 'push' }} | |
| uses: rhysd/github-action-benchmark@v1 | |
| with: | |
| name: 'Benchmark React' | |
| tool: 'customBiggerIsBetter' | |
| output-file-path: examples/benchmark-react/react-bench-output.json | |
| github-token: "${{ secrets.GITHUB_TOKEN }}" | |
| gh-pages-branch: 'gh-pages-bench' | |
| benchmark-data-dir-path: react-bench | |
| auto-push: true | |
| fail-on-alert: false |