Skip to content
Latchkey

Continuous Integration workflow (yezz123/fastapi-class)

The Continuous Integration workflow from yezz123/fastapi-class, 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: yezz123/fastapi-class.github/workflows/ci.ymlLicense MITView source

What it does

This is the Continuous Integration workflow from the yezz123/fastapi-class 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: Continuous Integration

on:
  push:
    branches:
      - main
  pull_request: {}

jobs:
  mypy:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.12"]
      fail-fast: false

    steps:
      - uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: setup uv
        uses: yezz123/setup-uv@v4.1
        with:
          uv-venv: ".venv"

      - name: Install Dependencies
        run: uv sync --group lint --all-extras

      - name: Typecheck with mypy
        run: bash scripts/lint.sh

  tests:

    name: test py${{ matrix.python-version }} on ${{ matrix.os }}

    runs-on: ${{ matrix.os }}-latest


    strategy:

      matrix:

        python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13"]

        os: [ubuntu]

    steps:
      - uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}

      - name: setup UV
        uses: yezz123/setup-uv@v4.1
        with:
          uv-venv: ".venv"

      - name: Install Dependencies
        run: uv sync --group test --all-extras

      - name: Test with pytest - ${{ matrix.os }} - py${{ matrix.python-version }}
        run: bash scripts/test.sh
        env:
          CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}-with-deps

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v5
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: ./coverage.xml

  # https://github.com/marketplace/actions/alls-green#why
  # used for branch protection checks
  check:
    if: always()

    needs: [mypy, tests]
    runs-on: ubuntu-latest
    steps:
      - name: Decide whether the needed jobs succeeded or failed
        uses: re-actors/alls-green@release/v1
        with:
          jobs: ${{ toJSON(needs) }}

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: Continuous Integration
 
on:
  push:
    branches:
      - main
  pull_request: {}
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  mypy:
    timeout-minutes: 30
    runs-on: latchkey-small
    strategy:
      matrix:
        python-version: ["3.12"]
      fail-fast: false
 
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: ${{ matrix.python-version }}
 
      - name: setup uv
        uses: yezz123/setup-uv@v4.1
        with:
          uv-venv: ".venv"
 
      - name: Install Dependencies
        run: uv sync --group lint --all-extras
 
      - name: Typecheck with mypy
        run: bash scripts/lint.sh
 
  tests:
    timeout-minutes: 30
 
    name: test py${{ matrix.python-version }} on ${{ matrix.os }}
 
    runs-on: ${{ matrix.os }}-latest
 
 
    strategy:
 
      matrix:
 
        python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13"]
 
        os: [ubuntu]
 
    steps:
      - uses: actions/checkout@v4
 
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          cache: 'pip'
          python-version: ${{ matrix.python-version }}
 
      - name: setup UV
        uses: yezz123/setup-uv@v4.1
        with:
          uv-venv: ".venv"
 
      - name: Install Dependencies
        run: uv sync --group test --all-extras
 
      - name: Test with pytest - ${{ matrix.os }} - py${{ matrix.python-version }}
        run: bash scripts/test.sh
        env:
          CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}-with-deps
 
      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v5
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: ./coverage.xml
 
  # https://github.com/marketplace/actions/alls-green#why
  # used for branch protection checks
  check:
    timeout-minutes: 30
    if: always()
 
    needs: [mypy, tests]
    runs-on: latchkey-small
    steps:
      - name: Decide whether the needed jobs succeeded or failed
        uses: re-actors/alls-green@release/v1
        with:
          jobs: ${{ toJSON(needs) }}
 

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.

This workflow runs 3 jobs (7 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