Skip to content
Latchkey

CI workflow (siboehm/lleaves)

The CI workflow from siboehm/lleaves, explained and optimized by Latchkey.

F

CI health: F - at risk

Point runs-on at Latchkey and get caching, run de-duplication, 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: siboehm/lleaves.github/workflows/ci.ymlLicense MITView source

What it does

This is the CI workflow from the siboehm/lleaves 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: CI
on:
  push:
    branches: [ master ]
    tags:
      - '*'
  pull_request:
    branches: ['*']
  workflow_dispatch:

jobs:
  linux-unittest:
    name: Linux unittest - ${{ matrix.PYTHON_VERSION }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        PYTHON_VERSION: ["3.10", "3.11", "3.12", "3.13"]
    steps:
      # Fast shallow checkout for testing
      - uses: actions/checkout@v4
      - name: Set up Python ${{ matrix.PYTHON_VERSION }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.PYTHON_VERSION }}
      - name: Install uv
        uses: astral-sh/setup-uv@v3
        with:
          version: "latest"
      - name: Setup uv cache
        uses: actions/cache@v4
        with:
          path: ~/.cache/uv
          key: uv-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}-${{ matrix.PYTHON_VERSION }}
          restore-keys: |
            uv-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}-
            uv-${{ runner.os }}-
      - name: Setup hypothesis DB cache
        uses: actions/cache@v4
        with:
          path: ./.hypothesis
          key: hypothesisDB ${{ matrix.PYTHON_VERSION }}
      - name: Run the unittests
        run: ./.github/ci.sh ${{ matrix.PYTHON_VERSION }}

  pre-commit-checks:
    name: "Pre-commit checks - Python 3.13"
    runs-on: ubuntu-latest
    steps:
      # Fast shallow checkout for linting
      - name: Checkout branch
        uses: actions/checkout@v4
      - name: Install Python 3.13
        uses: actions/setup-python@v5
        with:
          python-version: 3.13
      - name: Run pre-commit checks
        uses: pre-commit/action@v3.0.1

  release:
    name: "Build and publish to PyPI"
    needs: [linux-unittest, pre-commit-checks]  # Only after tests pass
    runs-on: ubuntu-latest
    if: startsWith(github.ref, 'refs/tags/v')  # Only on version tags
    steps:
      # Deep checkout for setuptools_scm (only when releasing)
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0  # Full git history for setuptools_scm
      - name: Set up Python 3.13
        uses: actions/setup-python@v5
        with:
          python-version: 3.13
      - name: Install uv
        uses: astral-sh/setup-uv@v3
        with:
          version: "latest"
      - name: Install build dependencies
        run: uv pip install --system build
      - name: Build package
        run: python -m build
      - name: Publish to PyPI
        uses: pypa/gh-action-pypi-publish@v1.9.0
        with:
          user: __token__
          password: ${{ secrets.PYPI_API_TOKEN }}

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: CI
on:
  push:
    branches: [ master ]
    tags:
      - '*'
  pull_request:
    branches: ['*']
  workflow_dispatch:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  linux-unittest:
    timeout-minutes: 30
    name: Linux unittest - ${{ matrix.PYTHON_VERSION }}
    runs-on: latchkey-small
    strategy:
      fail-fast: false
      matrix:
        PYTHON_VERSION: ["3.10", "3.11", "3.12", "3.13"]
    steps:
      # Fast shallow checkout for testing
      - uses: actions/checkout@v4
      - name: Set up Python ${{ matrix.PYTHON_VERSION }}
        uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: ${{ matrix.PYTHON_VERSION }}
      - name: Install uv
        uses: astral-sh/setup-uv@v3
        with:
          version: "latest"
      - name: Setup uv cache
        uses: actions/cache@v4
        with:
          path: ~/.cache/uv
          key: uv-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}-${{ matrix.PYTHON_VERSION }}
          restore-keys: |
            uv-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}-
            uv-${{ runner.os }}-
      - name: Setup hypothesis DB cache
        uses: actions/cache@v4
        with:
          path: ./.hypothesis
          key: hypothesisDB ${{ matrix.PYTHON_VERSION }}
      - name: Run the unittests
        run: ./.github/ci.sh ${{ matrix.PYTHON_VERSION }}
 
  pre-commit-checks:
    timeout-minutes: 30
    name: "Pre-commit checks - Python 3.13"
    runs-on: latchkey-small
    steps:
      # Fast shallow checkout for linting
      - name: Checkout branch
        uses: actions/checkout@v4
      - name: Install Python 3.13
        uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: 3.13
      - name: Run pre-commit checks
        uses: pre-commit/action@v3.0.1
 
  release:
    timeout-minutes: 30
    name: "Build and publish to PyPI"
    needs: [linux-unittest, pre-commit-checks]  # Only after tests pass
    runs-on: latchkey-small
    if: startsWith(github.ref, 'refs/tags/v')  # Only on version tags
    steps:
      # Deep checkout for setuptools_scm (only when releasing)
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0  # Full git history for setuptools_scm
      - name: Set up Python 3.13
        uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: 3.13
      - name: Install uv
        uses: astral-sh/setup-uv@v3
        with:
          version: "latest"
      - name: Install build dependencies
        run: uv pip install --system build
      - name: Build package
        run: python -m build
      - name: Publish to PyPI
        uses: pypa/gh-action-pypi-publish@v1.9.0
        with:
          user: __token__
          password: ${{ secrets.PYPI_API_TOKEN }}
 

What changed

3 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.

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 3 jobs (6 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow