benchmark: parallelize cases for CI performance #1881
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 }} | |
| cancel-in-progress: true | |
| 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-tags: true | |
| fetch-depth: 0 | |
| - name: Use Node.js | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.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@d872884a306dd4853acf0f584f4b706cf0cc72a2 # v4.13.0 | |
| with: | |
| run: yarn benchmark --ci | |
| mode: "simulation" | |
| env: | |
| LAST_COMMIT: 1 | |
| NEGATIVE_FILTER: on-schedule | |
| SHARD: ${{ matrix.shard }} | |
| benchmark-memory: | |
| strategy: | |
| fail-fast: false | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-tags: true | |
| fetch-depth: 0 | |
| - name: Use Node.js | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: lts/* | |
| cache: yarn | |
| - run: yarn --frozen-lockfile | |
| - run: yarn link --frozen-lockfile || true | |
| - run: yarn link webpack --frozen-lockfile | |
| - name: Run memory benchmarks | |
| uses: CodSpeedHQ/action@d872884a306dd4853acf0f584f4b706cf0cc72a2 # v4.13.0 | |
| with: | |
| run: yarn benchmark --ci | |
| mode: "memory" | |
| token: ${{ secrets.CODSPEED_TOKEN }} | |
| env: | |
| LAST_COMMIT: 1 | |
| NEGATIVE_FILTER: on-schedule |