Skip to content
Latchkey

Benchmarks workflow (meltano/meltano)

The Benchmarks workflow from meltano/meltano, explained and optimized by Latchkey.

A

CI health: A - excellent

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: meltano/meltano.github/workflows/benchmark.ymlLicense MITView source

What it does

This is the Benchmarks workflow from the meltano/meltano repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

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

The workflow

workflow (.yml)
name: Benchmarks

on:
  pull_request:
    paths:
      - src/**
      - tests/benchmarks/**
      - uv.lock
      - .github/workflows/benchmark.yml
  push:
    branches:
      - main
      - 'v*'
    paths:
      - src/**
      - tests/benchmarks/**
      - uv.lock
      - .github/workflows/benchmark.yml
  workflow_dispatch:
    inputs: {}

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

env:
  FORCE_COLOR: "1"
  PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
  UV_PYTHON_DOWNLOADS: "never"

permissions:
  contents: read

jobs:
  benchmark:
    name: "Run benchmarks with CodSpeed"
    runs-on: codspeed-macro
    timeout-minutes: 10

    steps:
    - name: Check out the repository
      uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      with:
        persist-credentials: false

    - name: Setup Python
      uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
      id: setup-python

    - name: Setup uv
      uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
      with:
        cache-suffix: bench
        python-version: ${{ steps.setup-python.outputs.python-version }}

    - name: Install dependencies
      run: |
        uv sync --group testing

    - name: Run benchmarks
      uses: CodSpeedHQ/action@a4a36bb07c0638b0b4ca52bf1f3dad1b4289e52f # v4.18.1
      with:
        mode: walltime
        run: uv run python -m pytest tests/benchmarks/ --codspeed -p no:randomly

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: Benchmarks
 
on:
  pull_request:
    paths:
      - src/**
      - tests/benchmarks/**
      - uv.lock
      - .github/workflows/benchmark.yml
  push:
    branches:
      - main
      - 'v*'
    paths:
      - src/**
      - tests/benchmarks/**
      - uv.lock
      - .github/workflows/benchmark.yml
  workflow_dispatch:
    inputs: {}
 
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true
 
env:
  FORCE_COLOR: "1"
  PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
  UV_PYTHON_DOWNLOADS: "never"
 
permissions:
  contents: read
 
jobs:
  benchmark:
    name: "Run benchmarks with CodSpeed"
    runs-on: codspeed-macro
    timeout-minutes: 10
 
    steps:
    - name: Check out the repository
      uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
      with:
        persist-credentials: false
 
    - name: Setup Python
      uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
      with:
        cache: 'pip'
      id: setup-python
 
    - name: Setup uv
      uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
      with:
        cache-suffix: bench
        python-version: ${{ steps.setup-python.outputs.python-version }}
 
    - name: Install dependencies
      run: |
        uv sync --group testing
 
    - name: Run benchmarks
      uses: CodSpeedHQ/action@a4a36bb07c0638b0b4ca52bf1f3dad1b4289e52f # v4.18.1
      with:
        mode: walltime
        run: uv run python -m pytest tests/benchmarks/ --codspeed -p no:randomly
 

What changed

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