Mistral Common CI workflow (mistralai/mistral-common)
The Mistral Common CI workflow from mistralai/mistral-common, explained and optimized by Latchkey.
CI health: A - excellent
Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Mistral Common CI workflow from the mistralai/mistral-common 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
name: Mistral Common CI
permissions:
contents: read
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
# we cancel all runs of previous commits in PR. On main we run the CI on all commits
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || 'no-pr' }}
cancel-in-progress: ${{ github.event.pull_request.number != null }}
jobs:
build_lint_test:
if: ${{ github.event.pull_request.draft != true }}
runs-on: ubuntu-latest
strategy:
matrix:
# Support all LTS versions of Python
python-version: [
"3.10",
"3.11",
"3.12",
"3.13",
"3.14",
]
steps:
- name: Checkout
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
python-version: ${{ matrix.python-version }}
- name: Check uv lock
run: |
uv lock --check
# Install
- name: Install Dependencies
run: |
uv sync --frozen --all-extras --group dev
# Ruff Linter
- name: Ruff Linter
run: |
uv run ruff check .
# Ruff Format
- name: Ruff Format
run: |
uv run ruff format . --check
# Mypy
- name: Mypy Check
run: |
uv run mypy .
# PyTest
- name: Tests
run: |
uv run pytest --cov=mistral_common tests/ --ignore=tests/integrations --cov-report "xml:coverage.xml"
# Doctests
- name: Doctests
run: |
uv run pytest --doctest-modules ./src
build_docs:
if: ${{ github.event.pull_request.draft != true }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
python-version: 3.14
- name: Install Dependencies
run: |
uv sync --frozen --all-extras --group docs
- name: Build Docs
run: |
uv run mkdocs build --strict
integration_tests:
if: ${{ github.event.pull_request.draft != true }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [
"3.10",
"3.11",
"3.12",
"3.13",
"3.14",
]
steps:
- name: Checkout
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
- name: Install uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
uv sync --frozen --all-extras --group dev --group test-integrations
- name: Integration Tests
run: |
uv run --no-sync pytest tests/integrations/ -v
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Mistral Common CI permissions: contents: read on: push: branches: - main pull_request: types: - opened - synchronize - reopened - ready_for_review # we cancel all runs of previous commits in PR. On main we run the CI on all commits concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || 'no-pr' }} cancel-in-progress: ${{ github.event.pull_request.number != null }} jobs: build_lint_test: timeout-minutes: 30 if: ${{ github.event.pull_request.draft != true }} runs-on: latchkey-small strategy: matrix: # Support all LTS versions of Python python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14", ] steps: - name: Checkout uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 - name: Install uv uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5 with: python-version: ${{ matrix.python-version }} - name: Check uv lock run: | uv lock --check # Install - name: Install Dependencies run: | uv sync --frozen --all-extras --group dev # Ruff Linter - name: Ruff Linter run: | uv run ruff check . # Ruff Format - name: Ruff Format run: | uv run ruff format . --check # Mypy - name: Mypy Check run: | uv run mypy . # PyTest - name: Tests run: | uv run pytest --cov=mistral_common tests/ --ignore=tests/integrations --cov-report "xml:coverage.xml" # Doctests - name: Doctests run: | uv run pytest --doctest-modules ./src build_docs: timeout-minutes: 30 if: ${{ github.event.pull_request.draft != true }} runs-on: latchkey-small steps: - name: Checkout uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 - name: Install uv uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5 with: python-version: 3.14 - name: Install Dependencies run: | uv sync --frozen --all-extras --group docs - name: Build Docs run: | uv run mkdocs build --strict integration_tests: timeout-minutes: 30 if: ${{ github.event.pull_request.draft != true }} runs-on: latchkey-small strategy: matrix: python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14", ] steps: - name: Checkout uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 - name: Install uv uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5 with: python-version: ${{ matrix.python-version }} - name: Install Dependencies run: | uv sync --frozen --all-extras --group dev --group test-integrations - name: Integration Tests run: | uv run --no-sync pytest tests/integrations/ -v
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 3 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.