Skip to content
Latchkey

Benchmarks workflow (abey79/vpype)

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

B

CI health: B - good

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: abey79/vpype.github/workflows/benchmarks.ymlLicense MITView source

What it does

This is the Benchmarks workflow from the abey79/vpype 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

# NOTE: manually disabled on GitHub. Most likely needs work to get running again.

on:
  schedule:
    # * is a special character in YAML so you have to quote this string
    - cron: '* 3 * * *'
  workflow_dispatch:

jobs:
  benchmark:
    defaults:
      run:
        shell: bash
    runs-on: macos-latest

    steps:
    - uses: actions/checkout@v3
    - name: Install poetry
      run: pipx install poetry
    - name: Set up Python
      uses: actions/setup-python@v5
      with:
        python-version: '3.11'
        cache: 'poetry'
    - name: Install project
      run: poetry install -E all --with docs,dev
    - name: Pytest (benchmark)
      run: |
        poetry run pytest tests/test_benchmarks.py --benchmark-enable --benchmark-json output.json
    - name: Store benchmark result
      uses: rhysd/github-action-benchmark@v1
      with:
        tool: 'pytest'
        output-file-path: output.json
        # push to gh-page
        github-token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
        auto-push: true
        # Show alert with commit comment on detecting possible performance regression
        alert-threshold: '150%'
        comment-on-alert: true
        fail-on-alert: true

The same workflow, on Latchkey

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

name: Benchmarks
 
# NOTE: manually disabled on GitHub. Most likely needs work to get running again.
 
on:
  schedule:
    # * is a special character in YAML so you have to quote this string
    - cron: '* 3 * * *'
  workflow_dispatch:
 
jobs:
  benchmark:
    timeout-minutes: 30
    defaults:
      run:
        shell: bash
    runs-on: macos-latest
 
    steps:
    - uses: actions/checkout@v3
    - name: Install poetry
      run: pipx install poetry
    - name: Set up Python
      uses: actions/setup-python@v5
      with:
        python-version: '3.11'
        cache: 'poetry'
    - name: Install project
      run: poetry install -E all --with docs,dev
    - name: Pytest (benchmark)
      run: |
        poetry run pytest tests/test_benchmarks.py --benchmark-enable --benchmark-json output.json
    - name: Store benchmark result
      uses: rhysd/github-action-benchmark@v1
      with:
        tool: 'pytest'
        output-file-path: output.json
        # push to gh-page
        github-token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
        auto-push: true
        # Show alert with commit comment on detecting possible performance regression
        alert-threshold: '150%'
        comment-on-alert: true
        fail-on-alert: true
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

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