Skip to content
Latchkey

Benchmark workflow (prisma/prisma)

The Benchmark workflow from prisma/prisma, explained and optimized by Latchkey.

B

CI health: B - good

Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: prisma/prisma.github/workflows/benchmark.ymlLicense Apache-2.0View source

What it does

This is the Benchmark workflow from the prisma/prisma repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Benchmark
# Run on `push` only for main, if not it will trigger `push` & `pull_request` on PRs at the same time
on:
  push:
    branches:
      - main
      - '*.*.x'
    paths-ignore:
      # Any update here needs to be done for `pull_request` (see below) and all files
      # (test.yml, benchmark.yml, release.yml, bundle-size.yml, ci-aux-files.yml)
      - '*.md'
      # - '*.bench.ts' -> should not be ignored in this workflow
      - 'LICENSE'
      - '.dockerignore'
      - 'scripts/ci/publish.ts'
      - '.github/CODEOWNERS'
      - '.github/ISSUE_TEMPLATE/**'
      - '.github/DISCUSSION_TEMPLATE/**'
      - '.devcontainer/**'
      - '.vscode/**'
      - 'graphs/**'
      - 'sandbox/**'
  pull_request:
    paths-ignore:
      # Any update here needs to be done for `branches` (see above) and all files
      # (test.yml, benchmark.yml, release.yml, bundle-size.yml, ci-aux-files.yml)
      - '*.md'
      # - '*.bench.ts' -> should not be ignored in this workflow
      - 'LICENSE'
      - '.dockerignore'
      - 'scripts/ci/publish.ts'
      - '.github/CODEOWNERS'
      - '.github/ISSUE_TEMPLATE/**'
      - '.github/DISCUSSION_TEMPLATE/**'
      - '.devcontainer/**'
      - '.vscode/**'
      - 'graphs/**'
      - 'sandbox/**'
  workflow_dispatch:

env:
  PRISMA_TELEMETRY_INFORMATION: 'prisma benchmark.yml'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  benchmark:
    name: Benchmark
    runs-on: ubuntu-latest
    # Only run on main repo (not on forks)
    # This avoids notifications to be sent to `alert-comment-cc-users`, see below
    if: github.repository == 'prisma/prisma'
    steps:
      - uses: actions/checkout@v6

      - name: Install & build
        uses: ./.github/actions/setup
        with:
          node-version: '20.19.0'
          skip-tsc: false

      - name: Run benchmarks
        run: pnpm run bench

      - name: Store benchmark result
        if: ${{ github.ref == 'refs/heads/main' }}
        uses: rhysd/github-action-benchmark@v1
        with:
          name: Benchmark.js Benchmark
          tool: 'benchmarkjs'
          output-file-path: output.txt
          # Note: must use personal access token
          github-token: ${{ secrets.GITHUB_TOKEN }}
          auto-push: true
          # Show alert with commit comment on detecting possible performance regression
          alert-threshold: '200%'
          comment-on-alert: true
          fail-on-alert: true
          alert-comment-cc-users: '@millsp,@aqrln,@SevInf,@jkomyno'

      - name: Run benchmarks for Codspeed
        uses: CodSpeedHQ/action@v4
        with:
          mode: simulation
          run: pnpm run bench-stdout-only
          token: ${{ secrets.CODSPEED_TOKEN }}
        env:
          CODSPEED_BENCHMARK: true

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Benchmark
# Run on `push` only for main, if not it will trigger `push` & `pull_request` on PRs at the same time
on:
  push:
    branches:
      - main
      - '*.*.x'
    paths-ignore:
      # Any update here needs to be done for `pull_request` (see below) and all files
      # (test.yml, benchmark.yml, release.yml, bundle-size.yml, ci-aux-files.yml)
      - '*.md'
      # - '*.bench.ts' -> should not be ignored in this workflow
      - 'LICENSE'
      - '.dockerignore'
      - 'scripts/ci/publish.ts'
      - '.github/CODEOWNERS'
      - '.github/ISSUE_TEMPLATE/**'
      - '.github/DISCUSSION_TEMPLATE/**'
      - '.devcontainer/**'
      - '.vscode/**'
      - 'graphs/**'
      - 'sandbox/**'
  pull_request:
    paths-ignore:
      # Any update here needs to be done for `branches` (see above) and all files
      # (test.yml, benchmark.yml, release.yml, bundle-size.yml, ci-aux-files.yml)
      - '*.md'
      # - '*.bench.ts' -> should not be ignored in this workflow
      - 'LICENSE'
      - '.dockerignore'
      - 'scripts/ci/publish.ts'
      - '.github/CODEOWNERS'
      - '.github/ISSUE_TEMPLATE/**'
      - '.github/DISCUSSION_TEMPLATE/**'
      - '.devcontainer/**'
      - '.vscode/**'
      - 'graphs/**'
      - 'sandbox/**'
  workflow_dispatch:
 
env:
  PRISMA_TELEMETRY_INFORMATION: 'prisma benchmark.yml'
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  benchmark:
    timeout-minutes: 30
    name: Benchmark
    runs-on: latchkey-small
    # Only run on main repo (not on forks)
    # This avoids notifications to be sent to `alert-comment-cc-users`, see below
    if: github.repository == 'prisma/prisma'
    steps:
      - uses: actions/checkout@v6
 
      - name: Install & build
        uses: ./.github/actions/setup
        with:
          node-version: '20.19.0'
          skip-tsc: false
 
      - name: Run benchmarks
        run: pnpm run bench
 
      - name: Store benchmark result
        if: ${{ github.ref == 'refs/heads/main' }}
        uses: rhysd/github-action-benchmark@v1
        with:
          name: Benchmark.js Benchmark
          tool: 'benchmarkjs'
          output-file-path: output.txt
          # Note: must use personal access token
          github-token: ${{ secrets.GITHUB_TOKEN }}
          auto-push: true
          # Show alert with commit comment on detecting possible performance regression
          alert-threshold: '200%'
          comment-on-alert: true
          fail-on-alert: true
          alert-comment-cc-users: '@millsp,@aqrln,@SevInf,@jkomyno'
 
      - name: Run benchmarks for Codspeed
        uses: CodSpeedHQ/action@v4
        with:
          mode: simulation
          run: pnpm run bench-stdout-only
          token: ${{ secrets.CODSPEED_TOKEN }}
        env:
          CODSPEED_BENCHMARK: true
 

What changed

2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow