Skip to content
Latchkey

decorator workflow (micheles/decorator)

The decorator workflow from micheles/decorator, explained and optimized by Latchkey.

D

CI health: D - needs work

Point runs-on at Latchkey and get caching, run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: micheles/decorator.github/workflows/python-package.ymlLicense BSD-2-ClauseView source

What it does

This is the decorator workflow from the micheles/decorator repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-2-Clause license.

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

The workflow

workflow (.yml)
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: decorator

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']

    steps:
    - uses: actions/checkout@v6
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v6
      with:
        python-version: ${{ matrix.python-version }}
        allow-prereleases: true
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install codespell flake8
        python -m pip install -e .
    - run: codespell --ignore-words-list="assertIn,ba,claus,vas" --quiet-level=2
    - run: flake8 . --count --ignore=E122,E226,E265,E741,E742 --max-complexity=23 --max-line-length=124 --show-source --statistics
    - run: python tests/test.py -v

  stubtest:

    runs-on: ubuntu-latest
    strategy:
      fail-fast: false

    steps:
    - uses: actions/checkout@v6
    - name: Set up Python 3.x
      uses: actions/setup-python@v6
      with:
        python-version: 3.x
        allow-prereleases: true
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install mypy
        python -m pip install -e .
    - run: |
        python -m mypy.stubtest decorator
        python -m mypy src/decorator/__init__.py

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.

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
 
name: decorator
 
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build:
    timeout-minutes: 30
 
    runs-on: latchkey-small
    strategy:
      fail-fast: false
      matrix:
        python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
 
    steps:
    - uses: actions/checkout@v6
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v6
      with:
        cache: 'pip'
        python-version: ${{ matrix.python-version }}
        allow-prereleases: true
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install codespell flake8
        python -m pip install -e .
    - run: codespell --ignore-words-list="assertIn,ba,claus,vas" --quiet-level=2
    - run: flake8 . --count --ignore=E122,E226,E265,E741,E742 --max-complexity=23 --max-line-length=124 --show-source --statistics
    - run: python tests/test.py -v
 
  stubtest:
    timeout-minutes: 30
 
    runs-on: latchkey-small
    strategy:
      fail-fast: false
 
    steps:
    - uses: actions/checkout@v6
    - name: Set up Python 3.x
      uses: actions/setup-python@v6
      with:
        cache: 'pip'
        python-version: 3.x
        allow-prereleases: true
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install mypy
        python -m pip install -e .
    - run: |
        python -m mypy.stubtest decorator
        python -m mypy src/decorator/__init__.py
 
 

What changed

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 2 jobs (8 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