chore: version packages #1949
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 | |
| # Continuous benchmark-regression checking via CodSpeed (free for OSS). | |
| # | |
| # Setup (one-time, by a maintainer): create a CodSpeed account, connect this | |
| # repo via the CodSpeed GitHub App, and add a CODSPEED_TOKEN repo secret. Until | |
| # the secret exists, the CodSpeed step is skipped and the job instead smoke-runs | |
| # the benchmarks so a broken bench still fails CI. Once the secret is set, | |
| # CodSpeed instruments the run and posts a regression report on each PR. | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| jobs: | |
| benchmarks: | |
| name: Benchmarks | |
| runs-on: ubuntu-latest | |
| # Least privilege: default GITHUB_TOKEN perms are read-only; nothing in this | |
| # job needs to write. | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 | |
| with: | |
| bun-version-file: "package.json" | |
| - run: bun install --frozen-lockfile | |
| # Detect the secret's presence without exposing it: the `secrets` context | |
| # is not available in `if:`, and job-level env would leak the token into | |
| # `bun install`/bench steps. This tiny step runs no project code and only | |
| # emits a boolean, after `bun install`, so the token never reaches steps | |
| # that run arbitrary lifecycle/bench code. | |
| - name: Detect CodSpeed token | |
| id: codspeed | |
| env: | |
| CODSPEED_TOKEN: ${{ secrets.CODSPEED_TOKEN }} | |
| run: | | |
| if [ -n "$CODSPEED_TOKEN" ]; then | |
| echo "present=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "present=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| # Until CodSpeed is connected, just prove the benches still run. | |
| - name: Smoke-run benchmarks | |
| if: steps.codspeed.outputs.present == 'false' | |
| run: bun run bench | |
| # CodSpeed instruments under Node; tsx runs the TypeScript bench files | |
| # directly, and the withCodSpeed-wrapped benches report to the action. | |
| # CODSPEED_TOKEN is scoped to this step's env only. | |
| - name: CodSpeed regression report | |
| if: steps.codspeed.outputs.present == 'true' | |
| uses: CodSpeedHQ/action@1d13896ef15fbc335e350f1356d4762be9bc1df9 # v3 | |
| env: | |
| CODSPEED_TOKEN: ${{ secrets.CODSPEED_TOKEN }} | |
| with: | |
| run: npx tsx benchmarks/index.ts | |
| token: ${{ env.CODSPEED_TOKEN }} |