tests workflow (Fatal1ty/mashumaro)
The tests workflow from Fatal1ty/mashumaro, explained and optimized by Latchkey.
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.
What it does
This is the tests workflow from the Fatal1ty/mashumaro 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: tests
on:
push:
branches:
- '*'
pull_request:
branches:
- master
jobs:
test-code-style:
name: Code style tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
run: |
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
pip install .
- name: Run ruff
run: |
source .venv/bin/activate
ruff check mashumaro
- name: Run mypy
run: |
source .venv/bin/activate
mypy mashumaro
- name: Run black
run: |
source .venv/bin/activate
black --check .
- name: Run codespell
run: |
source .venv/bin/activate
codespell mashumaro tests .github/*.md
codespell README.md --ignore-words-list brunch
test-posix:
name: Tests on Posix
needs:
- test-code-style
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
run: |
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
pip install .
- name: Run tests with coverage
run: |
source .venv/bin/activate
pytest --cov=mashumaro --cov=tests --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
test-windows:
name: Tests on Windows
needs:
- test-code-style
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
run: |
python -m venv .venv
.venv/Scripts/activate
pip install -r requirements-dev.txt
pip install .
pip install tzdata
- name: Run tests with coverage
run: |
.venv/Scripts/activate
pytest --cov=mashumaro --cov=tests --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
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: tests on: push: branches: - '*' pull_request: branches: - master concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: test-code-style: timeout-minutes: 30 name: Code style tests runs-on: latchkey-small strategy: fail-fast: false matrix: python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: cache: 'pip' python-version: ${{ matrix.python-version }} allow-prereleases: true - name: Install dependencies run: | python -m venv .venv source .venv/bin/activate pip install -r requirements-dev.txt pip install . - name: Run ruff run: | source .venv/bin/activate ruff check mashumaro - name: Run mypy run: | source .venv/bin/activate mypy mashumaro - name: Run black run: | source .venv/bin/activate black --check . - name: Run codespell run: | source .venv/bin/activate codespell mashumaro tests .github/*.md codespell README.md --ignore-words-list brunch test-posix: timeout-minutes: 30 name: Tests on Posix needs: - test-code-style runs-on: latchkey-small strategy: fail-fast: false matrix: python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: cache: 'pip' python-version: ${{ matrix.python-version }} allow-prereleases: true - name: Install dependencies run: | python -m venv .venv source .venv/bin/activate pip install -r requirements-dev.txt pip install . - name: Run tests with coverage run: | source .venv/bin/activate pytest --cov=mashumaro --cov=tests --cov-report=xml - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} test-windows: timeout-minutes: 30 name: Tests on Windows needs: - test-code-style runs-on: windows-latest strategy: fail-fast: false matrix: python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: cache: 'pip' python-version: ${{ matrix.python-version }} allow-prereleases: true - name: Install dependencies run: | python -m venv .venv .venv/Scripts/activate pip install -r requirements-dev.txt pip install . pip install tzdata - name: Run tests with coverage run: | .venv/Scripts/activate pytest --cov=mashumaro --cov=tests --cov-report=xml - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }}
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. - Cancel superseded runs when a branch or PR gets a newer push.
- Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
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:
- Dependency installs
This workflow runs 3 jobs (15 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.