name: CodSpeed # Parse, stringify and patch benchmarks under CodSpeed's CPU simulation, which counts instructions # instead of timing, so the results barely depend on the runner. Runs on the # default branch record the baseline that pull requests are compared with. # # The job runs once the repository is enabled on codspeed.io and the repository # variable CODSPEED_ENABLED is set to `true`. Uploads authenticate with OIDC, so # no token secret is needed. on: push: branches: [latest] pull_request: paths: - 'src/**' - 'benchmark/**' - 'package.json' - 'pnpm-lock.yaml' - '.github/workflows/codspeed.yml' workflow_dispatch: permissions: contents: read id-token: write # OIDC authentication with CodSpeed jobs: codspeed: name: CodSpeed benchmarks if: vars.CODSPEED_ENABLED == 'true' runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v7 with: submodules: true # the parse and stringify documents - name: Setup Node.js uses: actions/setup-node@v7 with: node-version: 24.x - name: Setup pnpm uses: pnpm/action-setup@v6 with: run_install: false # Protection Against Supply Chain Attacks: https://socket.dev/blog/introducing-socket-firewall - uses: socketdev/action@ba6de6cc0565af1f42295590380973573297e31f # v1.3.2 with: mode: firewall firewall-version: latest # or use a pinned version (see releases) - name: Install run: sfw pnpm install --frozen-lockfile env: CI: true - name: Build run: pnpm run build - name: Run benchmarks uses: CodSpeedHQ/action@v5 with: mode: simulation run: pnpm run codspeed