Skip to content
Latchkey

Test workflow (kivymd/KivyMD)

The Test workflow from kivymd/KivyMD, explained and optimized by Latchkey.

D

CI health: D - needs work

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: kivymd/KivyMD.github/workflows/test.ymlLicense MITView source

What it does

This is the Test workflow from the kivymd/KivyMD 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: Test
on:
  push:
    branches-ignore:
      - data
      - gh-pages
    tags:
      - '**'
  pull_request:
    branches-ignore:
      - data
      - gh-pages
  workflow_dispatch:

jobs:

  # Test job. Runs pytest on Ubuntu, MacOS and Windows, uploads coverage report
  test:
    name: Test [${{ matrix.python-version }} | Kivy ${{ matrix.kivy-version }} | ${{ matrix.os }} ${{ matrix.architecture }}]
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        python-version: ['3.13']
        architecture: [x64]
        kivy-version: [2.3.1]
    runs-on: ${{ matrix.os }}
    env:
      PYTHONUNBUFFERED: 1

    steps:
    - name: Checkout
      uses: actions/checkout@v4

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

    - name: Cache MacOS deps
      uses: actions/cache@v4
      if: startswith(matrix.os, 'macos')
      with:
        path: macos-cache
        key: ${{ runner.OS }}-deps-${{ hashFiles('.ci/macos_versions.sh') }}

    - name: Cache MacOS gst-devel deps
      uses: actions/cache@v4
      if: startswith(matrix.os, 'macos')
      with:
        path: macos-cache-gst-devel
        key: gst-devel-${{ runner.OS }}-deps-gst-devel-${{ hashFiles('.ci/macos_versions.sh') }}

    - name: Install dependencies for Ubuntu
      if: startswith(matrix.os, 'ubuntu')
      env:
        KIVY_VERSION: ${{ matrix.kivy-version }}
      run: .ci/ubuntu_dependencies.sh

    - name: Install dependencies for MacOS
      if: startswith(matrix.os, 'macos')
      env:
        KIVY_VERSION: ${{ matrix.kivy-version }}
      run: .ci/macos_dependencies.sh

    - name: Install dependencies for Windows
      if: startswith(matrix.os, 'windows')
      env:
        KIVY_VERSION: ${{ matrix.kivy-version }}
      run: .ci\windows_dependencies.ps1

    - name: Install KivyMD
      run: python -m pip install -e .

    - name: Test
      run: python -m pytest kivymd/tests --timeout=300 --cov=kivymd --cov-report=term

    - name: Test packaging with PyInstaller
      run: python -m PyInstaller.utils.run_tests --include_only kivymd.

    # Only from Ubuntu
    - name: Upload coverage report
      if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'kivymd/KivyMD' && startswith(matrix.os, 'ubuntu')
      continue-on-error: true
      env:
        COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
      run: python -m coveralls

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: Test
on:
  push:
    branches-ignore:
      - data
      - gh-pages
    tags:
      - '**'
  pull_request:
    branches-ignore:
      - data
      - gh-pages
  workflow_dispatch:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
 
  # Test job. Runs pytest on Ubuntu, MacOS and Windows, uploads coverage report
  test:
    timeout-minutes: 30
    name: Test [${{ matrix.python-version }} | Kivy ${{ matrix.kivy-version }} | ${{ matrix.os }} ${{ matrix.architecture }}]
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        python-version: ['3.13']
        architecture: [x64]
        kivy-version: [2.3.1]
    runs-on: ${{ matrix.os }}
    env:
      PYTHONUNBUFFERED: 1
 
    steps:
    - name: Checkout
      uses: actions/checkout@v4
 
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v5
      with:
        cache: 'pip'
        python-version: ${{ matrix.python-version }}
        architecture: ${{ matrix.architecture }}
 
    - name: Cache MacOS deps
      uses: actions/cache@v4
      if: startswith(matrix.os, 'macos')
      with:
        path: macos-cache
        key: ${{ runner.OS }}-deps-${{ hashFiles('.ci/macos_versions.sh') }}
 
    - name: Cache MacOS gst-devel deps
      uses: actions/cache@v4
      if: startswith(matrix.os, 'macos')
      with:
        path: macos-cache-gst-devel
        key: gst-devel-${{ runner.OS }}-deps-gst-devel-${{ hashFiles('.ci/macos_versions.sh') }}
 
    - name: Install dependencies for Ubuntu
      if: startswith(matrix.os, 'ubuntu')
      env:
        KIVY_VERSION: ${{ matrix.kivy-version }}
      run: .ci/ubuntu_dependencies.sh
 
    - name: Install dependencies for MacOS
      if: startswith(matrix.os, 'macos')
      env:
        KIVY_VERSION: ${{ matrix.kivy-version }}
      run: .ci/macos_dependencies.sh
 
    - name: Install dependencies for Windows
      if: startswith(matrix.os, 'windows')
      env:
        KIVY_VERSION: ${{ matrix.kivy-version }}
      run: .ci\windows_dependencies.ps1
 
    - name: Install KivyMD
      run: python -m pip install -e .
 
    - name: Test
      run: python -m pytest kivymd/tests --timeout=300 --cov=kivymd --cov-report=term
 
    - name: Test packaging with PyInstaller
      run: python -m PyInstaller.utils.run_tests --include_only kivymd.
 
    # Only from Ubuntu
    - name: Upload coverage report
      if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'kivymd/KivyMD' && startswith(matrix.os, 'ubuntu')
      continue-on-error: true
      env:
        COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
      run: python -m coveralls
 

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 1 job (3 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