docs: update examples (#21860) #6571
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: Benchmarks | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| # Every push to `main` shares one group, so cancelling leaves that commit with | |
| # no run for CodSpeed to compare against — it then falls back to an older | |
| # `main`, attributing the commits in between to the pull request. Only a | |
| # superseded pull request run is dropped. | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| id-token: write # Required for OIDC authentication with CodSpeed | |
| jobs: | |
| benchmark: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1/4, 2/4, 3/4, 4/4] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-tags: true | |
| fetch-depth: 0 | |
| - name: Use Node.js | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: lts/* | |
| cache: yarn | |
| - run: yarn --frozen-lockfile | |
| - run: yarn link --frozen-lockfile || true | |
| - run: yarn link webpack --frozen-lockfile | |
| - name: Check Memory Status | |
| run: > | |
| node -e 'const os=require("os"); | |
| const toGb=b=>(b/1024**3).toFixed(2)+" GB"; | |
| console.log(`--- Memory Status ---\nTotal: ${toGb(os.totalmem())}\nFree: ${toGb(os.freemem())}\nUsed: ${toGb(os.totalmem()-os.freemem())}`)' | |
| - name: Run benchmarks | |
| uses: CodSpeedHQ/action@4296e51e7041e24dadb86d1d6e8b9320d223dbe8 # v5.0.3 | |
| with: | |
| run: yarn benchmark --ci | |
| mode: "simulation" | |
| env: | |
| LAST_COMMIT: 1 | |
| NEGATIVE_FILTER: on-schedule | |
| SHARD: ${{ matrix.shard }} | |
| # Single libuv thread → deterministic fs-completion order, removing the | |
| # last I/O race that perturbs allocation counts between runs. | |
| UV_THREADPOOL_SIZE: 1 | |
| benchmark-memory: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1/4, 2/4, 3/4, 4/4] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-tags: true | |
| fetch-depth: 0 | |
| - name: Use Node.js | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: lts/* | |
| cache: yarn | |
| - run: yarn --frozen-lockfile | |
| - run: yarn link --frozen-lockfile || true | |
| - run: yarn link webpack --frozen-lockfile | |
| - name: Check Memory Status | |
| run: > | |
| node -e 'const os=require("os"); | |
| const toGb=b=>(b/1024**3).toFixed(2)+" GB"; | |
| console.log(`--- Memory Status ---\nTotal: ${toGb(os.totalmem())}\nFree: ${toGb(os.freemem())}\nUsed: ${toGb(os.totalmem()-os.freemem())}`)' | |
| - name: Run memory benchmarks | |
| uses: CodSpeedHQ/action@4296e51e7041e24dadb86d1d6e8b9320d223dbe8 # v5.0.3 | |
| with: | |
| run: yarn benchmark --ci | |
| mode: "memory" | |
| token: ${{ secrets.CODSPEED_TOKEN }} | |
| env: | |
| LAST_COMMIT: 1 | |
| NEGATIVE_FILTER: on-schedule | |
| SHARD: ${{ matrix.shard }} | |
| # Single libuv thread → deterministic fs-completion order, removing the | |
| # last I/O race that perturbs allocation counts between runs. | |
| UV_THREADPOOL_SIZE: 1 |