Skip to content
Latchkey

CI workflow (cltk/cltk)

The CI workflow from cltk/cltk, 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: cltk/cltk.github/workflows/ci.ymlLicense MITView source

What it does

This is the CI workflow from the cltk/cltk 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: ["**"]
    tags: ["**"]
  pull_request:
    branches: ["**"]

permissions:
  contents: read

jobs:
  build-and-test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.13"

      - name: Install uv
        run: |
          python -m pip install --upgrade pip
          pip install uv

      - name: Sync dependencies (dev + extras)
        run: |
          uv sync --python 3.13 --frozen --all-extras

      - name: Run test suite
        run: make test

  build-and-test-wheel:
    runs-on: ubuntu-latest
    needs: build-and-test
    if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/')
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.13"

      - name: Install uv
        run: |
          python -m pip install --upgrade pip
          pip install uv

      - name: Test built wheel with all extras
        run: make SHELL=/usr/bin/bash testBuilt

  publish-pypi:
    runs-on: ubuntu-latest
    needs: [build-and-test, build-and-test-wheel]
    if: startsWith(github.ref, 'refs/tags/') && github.repository == 'cltk/cltk'
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.13"

      - name: Install uv
        run: |
          python -m pip install --upgrade pip
          pip install uv

      - name: Publish to PyPI
        env:
          UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
        run: |
          if [ -z "${UV_PUBLISH_TOKEN}" ]; then
            echo "PYPI_API_TOKEN secret is not set" >&2
            exit 1
          fi
          make publishPyPI

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: ["**"]
    tags: ["**"]
  pull_request:
    branches: ["**"]
 
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  build-and-test:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
 
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: "3.13"
 
      - name: Install uv
        run: |
          python -m pip install --upgrade pip
          pip install uv
 
      - name: Sync dependencies (dev + extras)
        run: |
          uv sync --python 3.13 --frozen --all-extras
 
      - name: Run test suite
        run: make test
 
  build-and-test-wheel:
    timeout-minutes: 30
    runs-on: latchkey-small
    needs: build-and-test
    if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/')
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
 
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: "3.13"
 
      - name: Install uv
        run: |
          python -m pip install --upgrade pip
          pip install uv
 
      - name: Test built wheel with all extras
        run: make SHELL=/usr/bin/bash testBuilt
 
  publish-pypi:
    timeout-minutes: 30
    runs-on: latchkey-small
    needs: [build-and-test, build-and-test-wheel]
    if: startsWith(github.ref, 'refs/tags/') && github.repository == 'cltk/cltk'
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
 
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: "3.13"
 
      - name: Install uv
        run: |
          python -m pip install --upgrade pip
          pip install uv
 
      - name: Publish to PyPI
        env:
          UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
        run: |
          if [ -z "${UV_PUBLISH_TOKEN}" ]; then
            echo "PYPI_API_TOKEN secret is not set" >&2
            exit 1
          fi
          make publishPyPI
 

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

Actions used in this workflow