Skip to content
Latchkey

Continuous Integration workflow (emdgroup/baybe)

The Continuous Integration workflow from emdgroup/baybe, explained and optimized by Latchkey.

A

CI health: A - excellent

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

Grade your own workflow free or run it on Latchkey →
Source: emdgroup/baybe.github/workflows/ci.ymlLicense Apache-2.0View source

What it does

This is the Continuous Integration workflow from the emdgroup/baybe repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

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

The workflow

workflow (.yml)
name: Continuous Integration
on:
  push:
    branches:
      - main
      - 'dev/**'
  pull_request:
    branches:
      - main
      - 'dev/**'
  workflow_dispatch:

env:
  COVERAGE_OVERALL_THRESH: 70      # threshold for overall coverage check
  COVERAGE_INDIVIDUAL_THRESH: 45   # threshold for individual coverage check

permissions:
  contents: read

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  changelog:
    name: "Changelog"
    runs-on: ubuntu-latest
    if: ${{ github.event_name == 'pull_request' }}
    continue-on-error: true
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - name: Assert Changelog Edit
        run: |
          git fetch origin main:main
          NUM_ADDED=`git diff --numstat main HEAD CHANGELOG.md | cut -d$'\t' -f1`
          echo "Changelog differences: $NUM_ADDED"
          if [ "$NUM_ADDED" -gt "0" ]; then
            echo "SUCCESS"
            exit 0
          else
            echo "ERROR - Nothing has been added to CHANGELOG.md"
            exit 1
          fi

  reminder:
    runs-on: ubuntu-latest
    name: "Reminder"
    continue-on-error: true
    permissions:
      issues: write  # Required for reminder-action to post issue comments
    steps:
      - name: check reminders and notify
        uses: agrc/reminder-action@76a6297d144adb572b4cf6d9c0ee667f0ec6b832 # v1

  lint:
    strategy:
      matrix:
        py-version: [ {semantic: '3.14', tox: 'py314'} ]
    name: Lint ${{ matrix.py-version.semantic }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        id: setup-python
        with:
          python-version: ${{ matrix.py-version.semantic }}
      - name: Run linting
        run: |
          pip install tox-uv
          tox -e lint-${{ matrix.py-version.tox }}

  build-docs:
    name: "Build Docs"
    runs-on: ubuntu-latest
    needs: [lint]
    permissions:
      contents: read
      pages: write     # Required to deploy to GitHub Pages
      id-token: write  # Required for OIDC authentication to GitHub Pages
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        with: {python-version: "3.10"}
      - name: Build Docs
        run: |
          pip install tox-uv
          tox -e docs-py310 -- -r
          
  typecheck:
    needs: [lint]
    strategy:
      matrix:
        py-version: [ {semantic: '3.14', tox: 'py314'} ]
    name: Type Check ${{ matrix.py-version.semantic }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        id: setup-python
        with:
          python-version: ${{ matrix.py-version.semantic }}
      - name: Run type check
        run: |
          pip install tox-uv
          tox -e mypy-${{ matrix.py-version.tox }}

  audit:
    needs: [lint]
    strategy:
      matrix:
        py-version: [ {semantic: '3.14', tox: 'py314'} ]
    name: Audit ${{ matrix.py-version.semantic }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        id: setup-python
        with:
          python-version: ${{ matrix.py-version.semantic }}
      - name: Run pip-audit
        run: |
          pip install tox-uv
          tox -e audit-${{ matrix.py-version.tox }}

  coretest:
    needs: [typecheck]
    strategy:
      matrix:
        py-version: [ {semantic: '3.10', tox: 'py310'}, {semantic: '3.14', tox: 'py314'} ]
    name: Core Tests ${{ matrix.py-version.semantic }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        id: setup-python
        with:
          python-version: ${{ matrix.py-version.semantic }}
      - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
        with:
          path: .tox/coretest-${{ matrix.py-version.tox }}
          key: coretest-${{ matrix.py-version.tox }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('tox.ini') }}
      - name: Run core tests
        run: |
          pip install tox-uv
          tox -e coretest-${{ matrix.py-version.tox }}

  fulltest:
    needs: [typecheck]
    strategy:
      fail-fast: false  # Remove once we have solved the regular "LinAlgErrors"
      matrix:
        py-version: [ {semantic: '3.10', tox: 'py310'}, {semantic: '3.13', tox: 'py313'} ]
    name: Full Tests ${{ matrix.py-version.semantic }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        id: setup-python
        with:
          python-version: ${{ matrix.py-version.semantic }}
      - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
        with:
          path: .tox/fulltest-${{ matrix.py-version.tox }}
          key: fulltest-${{ matrix.py-version.tox }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('tox.ini') }}
      - name: Run full tests
        run: |
          pip install tox-uv
          tox -e fulltest-${{ matrix.py-version.tox }} -- --cov-report=xml
      - name: "Assert Overall Coverage"
        run: |
          pip install coverage
          coverage report --fail-under=${{ env.COVERAGE_OVERALL_THRESH }}
      - name: "Assert Individual Coverage"
        shell: bash
        run: |
          coverage report |
          grep -E -o '[0-9]+%' |
          tr -d '%' |
          sed '$d' |
          awk '{if ( $1<${{ env.COVERAGE_INDIVIDUAL_THRESH }} ) exit 1 }'

  gputest:
    needs: [typecheck]
    if: ${{ github.event_name == 'workflow_dispatch' }}
    strategy:
      matrix:
        py-version: [ {semantic: '3.10', tox: 'py310'} ]
    name: GPU Tests ${{ matrix.py-version.semantic }}
    runs-on: XS-GPU
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        id: setup-python
        with:
          python-version: ${{ matrix.py-version.semantic }}
      - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
        with:
          path: .tox/gputest-${{ matrix.py-version.tox }}
          key: gputest-${{ matrix.py-version.tox }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('tox.ini') }}
      - name: Run GPU tests
        run: |
          pip install tox-uv
          tox -e gputest-${{ matrix.py-version.tox }}

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
      - 'dev/**'
  pull_request:
    branches:
      - main
      - 'dev/**'
  workflow_dispatch:
 
env:
  COVERAGE_OVERALL_THRESH: 70      # threshold for overall coverage check
  COVERAGE_INDIVIDUAL_THRESH: 45   # threshold for individual coverage check
 
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  changelog:
    name: "Changelog"
    runs-on: latchkey-small
    if: ${{ github.event_name == 'pull_request' }}
    continue-on-error: true
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - name: Assert Changelog Edit
        run: |
          git fetch origin main:main
          NUM_ADDED=`git diff --numstat main HEAD CHANGELOG.md | cut -d$'\t' -f1`
          echo "Changelog differences: $NUM_ADDED"
          if [ "$NUM_ADDED" -gt "0" ]; then
            echo "SUCCESS"
            exit 0
          else
            echo "ERROR - Nothing has been added to CHANGELOG.md"
            exit 1
          fi
 
  reminder:
    runs-on: latchkey-small
    name: "Reminder"
    continue-on-error: true
    permissions:
      issues: write  # Required for reminder-action to post issue comments
    steps:
      - name: check reminders and notify
        uses: agrc/reminder-action@76a6297d144adb572b4cf6d9c0ee667f0ec6b832 # v1
 
  lint:
    strategy:
      matrix:
        py-version: [ {semantic: '3.14', tox: 'py314'} ]
    name: Lint ${{ matrix.py-version.semantic }}
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        id: setup-python
        with:
          cache: 'pip'
          python-version: ${{ matrix.py-version.semantic }}
      - name: Run linting
        run: |
          pip install tox-uv
          tox -e lint-${{ matrix.py-version.tox }}
 
  build-docs:
    name: "Build Docs"
    runs-on: latchkey-small
    needs: [lint]
    permissions:
      contents: read
      pages: write     # Required to deploy to GitHub Pages
      id-token: write  # Required for OIDC authentication to GitHub Pages
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        with: {python-version: "3.10"}
          cache: 'pip'
      - name: Build Docs
        run: |
          pip install tox-uv
          tox -e docs-py310 -- -r
          
  typecheck:
    needs: [lint]
    strategy:
      matrix:
        py-version: [ {semantic: '3.14', tox: 'py314'} ]
    name: Type Check ${{ matrix.py-version.semantic }}
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        id: setup-python
        with:
          cache: 'pip'
          python-version: ${{ matrix.py-version.semantic }}
      - name: Run type check
        run: |
          pip install tox-uv
          tox -e mypy-${{ matrix.py-version.tox }}
 
  audit:
    needs: [lint]
    strategy:
      matrix:
        py-version: [ {semantic: '3.14', tox: 'py314'} ]
    name: Audit ${{ matrix.py-version.semantic }}
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        id: setup-python
        with:
          cache: 'pip'
          python-version: ${{ matrix.py-version.semantic }}
      - name: Run pip-audit
        run: |
          pip install tox-uv
          tox -e audit-${{ matrix.py-version.tox }}
 
  coretest:
    needs: [typecheck]
    strategy:
      matrix:
        py-version: [ {semantic: '3.10', tox: 'py310'}, {semantic: '3.14', tox: 'py314'} ]
    name: Core Tests ${{ matrix.py-version.semantic }}
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        id: setup-python
        with:
          cache: 'pip'
          python-version: ${{ matrix.py-version.semantic }}
      - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
        with:
          path: .tox/coretest-${{ matrix.py-version.tox }}
          key: coretest-${{ matrix.py-version.tox }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('tox.ini') }}
      - name: Run core tests
        run: |
          pip install tox-uv
          tox -e coretest-${{ matrix.py-version.tox }}
 
  fulltest:
    needs: [typecheck]
    strategy:
      fail-fast: false  # Remove once we have solved the regular "LinAlgErrors"
      matrix:
        py-version: [ {semantic: '3.10', tox: 'py310'}, {semantic: '3.13', tox: 'py313'} ]
    name: Full Tests ${{ matrix.py-version.semantic }}
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        id: setup-python
        with:
          cache: 'pip'
          python-version: ${{ matrix.py-version.semantic }}
      - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
        with:
          path: .tox/fulltest-${{ matrix.py-version.tox }}
          key: fulltest-${{ matrix.py-version.tox }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('tox.ini') }}
      - name: Run full tests
        run: |
          pip install tox-uv
          tox -e fulltest-${{ matrix.py-version.tox }} -- --cov-report=xml
      - name: "Assert Overall Coverage"
        run: |
          pip install coverage
          coverage report --fail-under=${{ env.COVERAGE_OVERALL_THRESH }}
      - name: "Assert Individual Coverage"
        shell: bash
        run: |
          coverage report |
          grep -E -o '[0-9]+%' |
          tr -d '%' |
          sed '$d' |
          awk '{if ( $1<${{ env.COVERAGE_INDIVIDUAL_THRESH }} ) exit 1 }'
 
  gputest:
    needs: [typecheck]
    if: ${{ github.event_name == 'workflow_dispatch' }}
    strategy:
      matrix:
        py-version: [ {semantic: '3.10', tox: 'py310'} ]
    name: GPU Tests ${{ matrix.py-version.semantic }}
    runs-on: XS-GPU
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
        with:
          persist-credentials: false
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
        id: setup-python
        with:
          cache: 'pip'
          python-version: ${{ matrix.py-version.semantic }}
      - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
        with:
          path: .tox/gputest-${{ matrix.py-version.tox }}
          key: gputest-${{ matrix.py-version.tox }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('tox.ini') }}
      - name: Run GPU tests
        run: |
          pip install tox-uv
          tox -e gputest-${{ matrix.py-version.tox }}

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 9 jobs (11 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