Skip to content
Latchkey

build workflow (miguelgrinberg/Flask-Migrate)

The build workflow from miguelgrinberg/Flask-Migrate, 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: miguelgrinberg/Flask-Migrate.github/workflows/tests.ymlLicense MITView source

What it does

This is the build workflow from the miguelgrinberg/Flask-Migrate 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: build
on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

permissions: {}

jobs:
  lint:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
        with:
          python-version: 3.14
      - run: python -m pip install --upgrade pip wheel
      - run: pip install tox
      - run: tox -eflake8
      - run: tox -edocs
  tests:
    name: tests
    strategy:
      matrix:
        # TODO: add windows-latest
        os: [ubuntu-latest, macos-latest]
        python: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
        sqla: ['sqlalchemy<2 flask-sqlalchemy<3.1', 'sqlalchemy>=2 flask-sqlalchemy>=3.1']
      fail-fast: false
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
        with:
          python-version: ${{ matrix.python }}
      - run: python -m pip install --upgrade pip wheel
      - run: pip install tox
      - run: SQLALCHEMY_VERSION="${{ matrix.sqla }}" tox -epy
  zizmor:
    name: zizmor
    runs-on: ubuntu-latest
    permissions:
      contents: read
      actions: read
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false
      - uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3
        with:
          advanced-security: false

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: build
on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
 
permissions: {}
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  lint:
    timeout-minutes: 30
    name: lint
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
        with:
          cache: 'pip'
          python-version: 3.14
      - run: python -m pip install --upgrade pip wheel
      - run: pip install tox
      - run: tox -eflake8
      - run: tox -edocs
  tests:
    timeout-minutes: 30
    name: tests
    strategy:
      matrix:
        # TODO: add windows-latest
        os: [ubuntu-latest, macos-latest]
        python: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
        sqla: ['sqlalchemy<2 flask-sqlalchemy<3.1', 'sqlalchemy>=2 flask-sqlalchemy>=3.1']
      fail-fast: false
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
        with:
          cache: 'pip'
          python-version: ${{ matrix.python }}
      - run: python -m pip install --upgrade pip wheel
      - run: pip install tox
      - run: SQLALCHEMY_VERSION="${{ matrix.sqla }}" tox -epy
  zizmor:
    timeout-minutes: 30
    name: zizmor
    runs-on: latchkey-small
    permissions:
      contents: read
      actions: read
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false
      - uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3
        with:
          advanced-security: false
 

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 (30 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