Skip to content
Latchkey

CI workflow (borntyping/python-colorlog)

The CI workflow from borntyping/python-colorlog, explained and optimized by Latchkey.

C

CI health: C - fair

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: borntyping/python-colorlog.github/workflows/ci.ymlLicense MITView source

What it does

This is the CI workflow from the borntyping/python-colorlog 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", "pull_request"]
jobs:
  lint:
    name: "🐍 Lint Python modules"
    runs-on: "ubuntu-latest"
    strategy:
      matrix:
        python-version:
          - "3.14"
    steps:
      - uses: "actions/checkout@master"
      - name: "🐍 Set up Python ${{ matrix.python-version }}"
        uses: "actions/setup-python@v2"
        with:
          python-version: "${{ matrix.python-version }}"
      - name: "🐍 Display Python version"
        run: "python --version"
      - name: "🐍 Install dependencies"
        run: "python -m pip install --user --pre black flake8 mypy types-PyYAML"
      - name: "🐍 Run mypy"
        run: "python -m mypy ."
      - name: "🐍 Run flake8"
        run: "python -m flake8"
      - name: "🐍 Run black"
        run: "python -m black --check ."
  test:
    name: "🐍 Test Python modules"
    runs-on: "ubuntu-latest"
    strategy:
      matrix:
        python-version:
          - "3.8"
          - "3.9"
          - "3.10"
          - "3.11"
          - "3.12"
          - "3.13"
          - "3.14"
        dependencies:
          - ""
          - "colorama"
    steps:
      - uses: "actions/checkout@master"
      - name: "🐍 Set up Python ${{ matrix.python-version }}"
        uses: "actions/setup-python@v2"
        with:
          python-version: "${{ matrix.python-version }}"
          allow-prereleases: true
      - name: "🐍 Display Python version"
        run: "python --version"
      - name: "🐍 Install dependencies"
        run: "python -m pip install --user pytest ${{ matrix.dependencies }}"
      - name: "🐍 Run pytest"
        run: "python -m pytest"
  publish:
    name: "πŸ“¦ Publish Python distributions"
    if: "startsWith(github.ref, 'refs/tags')"
    runs-on: "ubuntu-latest"
    environment: "publish"
    permissions:
      id-token: write
    strategy:
      matrix:
        python-version:
          - "3.14"
    steps:
      - uses: "actions/checkout@master"
      - name: "🐍 Set up Python ${{ matrix.python-version }}"
        uses: "actions/setup-python@v2"
        with:
          python-version: "${{ matrix.python-version }}"
      - name: "🐍 Display Python version"
        run: "python --version"
      - name: "🐍 Install wheel"
        run: "python -m pip install setuptools wheel --user"
      - name: "🐍 Build a binary wheel and a source tarball"
        run: "python setup.py sdist bdist_wheel"
      - name: "πŸ“¦ Publish package distributions to PyPI"
        uses: "pypa/gh-action-pypi-publish@release/v1"

The same workflow, on Latchkey

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

name: "CI"
on: ["push", "pull_request"]
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  lint:
    timeout-minutes: 30
    name: "🐍 Lint Python modules"
    runs-on: "ubuntu-latest"
    strategy:
      matrix:
        python-version:
          - "3.14"
    steps:
      - uses: "actions/checkout@master"
      - name: "🐍 Set up Python ${{ matrix.python-version }}"
        uses: "actions/setup-python@v2"
        with:
          python-version: "${{ matrix.python-version }}"
      - name: "🐍 Display Python version"
        run: "python --version"
      - name: "🐍 Install dependencies"
        run: "python -m pip install --user --pre black flake8 mypy types-PyYAML"
      - name: "🐍 Run mypy"
        run: "python -m mypy ."
      - name: "🐍 Run flake8"
        run: "python -m flake8"
      - name: "🐍 Run black"
        run: "python -m black --check ."
  test:
    timeout-minutes: 30
    name: "🐍 Test Python modules"
    runs-on: "ubuntu-latest"
    strategy:
      matrix:
        python-version:
          - "3.8"
          - "3.9"
          - "3.10"
          - "3.11"
          - "3.12"
          - "3.13"
          - "3.14"
        dependencies:
          - ""
          - "colorama"
    steps:
      - uses: "actions/checkout@master"
      - name: "🐍 Set up Python ${{ matrix.python-version }}"
        uses: "actions/setup-python@v2"
        with:
          python-version: "${{ matrix.python-version }}"
          allow-prereleases: true
      - name: "🐍 Display Python version"
        run: "python --version"
      - name: "🐍 Install dependencies"
        run: "python -m pip install --user pytest ${{ matrix.dependencies }}"
      - name: "🐍 Run pytest"
        run: "python -m pytest"
  publish:
    timeout-minutes: 30
    name: "πŸ“¦ Publish Python distributions"
    if: "startsWith(github.ref, 'refs/tags')"
    runs-on: "ubuntu-latest"
    environment: "publish"
    permissions:
      id-token: write
    strategy:
      matrix:
        python-version:
          - "3.14"
    steps:
      - uses: "actions/checkout@master"
      - name: "🐍 Set up Python ${{ matrix.python-version }}"
        uses: "actions/setup-python@v2"
        with:
          python-version: "${{ matrix.python-version }}"
      - name: "🐍 Display Python version"
        run: "python --version"
      - name: "🐍 Install wheel"
        run: "python -m pip install setuptools wheel --user"
      - name: "🐍 Build a binary wheel and a source tarball"
        run: "python setup.py sdist bdist_wheel"
      - name: "πŸ“¦ Publish package distributions to PyPI"
        uses: "pypa/gh-action-pypi-publish@release/v1"
 

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