Skip to content
Latchkey

CI workflow (mjcumming/wiim)

The CI workflow from mjcumming/wiim, explained and optimized by Latchkey.

D

CI health: D - needs work

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

Grade your own workflow free or run it on Latchkey →
Source: mjcumming/wiim.github/workflows/tests.yamlLicense MITView source

What it does

This is the CI workflow from the mjcumming/wiim 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: CI

# Branch ruleset "Main branch protection" requires status check: Run tests
# Keep the tests job name stable; avoid a single-entry matrix or the check
# becomes "Run tests (3.N)" and GitHub branch protection must be updated.

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

env:
  DEFAULT_PYTHON: "3.13"

jobs:
  tests:
    name: Run tests
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - name: Check out code from GitHub
        uses: actions/checkout@v6

      # Validate standalone integration structure with Home Assistant hassfest action
      - name: Validate with hassfest
        uses: home-assistant/actions/hassfest@master

      - name: Set up Python ${{ env.DEFAULT_PYTHON }}
        uses: actions/setup-python@v6
        with:
          python-version: ${{ env.DEFAULT_PYTHON }}

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install --no-cache-dir --constraint=.github/workflows/constraints.txt -r requirements_test.txt

      - name: Install system libraries
        run: |
          sudo apt-get update
          sudo apt-get install -y libturbojpeg

      - name: Lint with ruff
        run: |
          ruff check custom_components/wiim --line-length 120

      - name: Lint with flake8
        run: |
          flake8 custom_components/wiim --max-line-length=120 --extend-ignore=E203,W503

      - name: Type check with mypy (strict)
        run: |
          mypy --strict custom_components/wiim

      - name: Test with pytest
        run: |
          pytest tests/ --cov=custom_components/wiim --cov-report=xml

      - name: Upload coverage reports to Codecov
        uses: codecov/codecov-action@v6
        env:
          CODECOV_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: CI
 
# Branch ruleset "Main branch protection" requires status check: Run tests
# Keep the tests job name stable; avoid a single-entry matrix or the check
# becomes "Run tests (3.N)" and GitHub branch protection must be updated.
 
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
 
env:
  DEFAULT_PYTHON: "3.13"
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  tests:
    name: Run tests
    runs-on: latchkey-small
    timeout-minutes: 15
    steps:
      - name: Check out code from GitHub
        uses: actions/checkout@v6
 
      # Validate standalone integration structure with Home Assistant hassfest action
      - name: Validate with hassfest
        uses: home-assistant/actions/hassfest@master
 
      - name: Set up Python ${{ env.DEFAULT_PYTHON }}
        uses: actions/setup-python@v6
        with:
          cache: 'pip'
          python-version: ${{ env.DEFAULT_PYTHON }}
 
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install --no-cache-dir --constraint=.github/workflows/constraints.txt -r requirements_test.txt
 
      - name: Install system libraries
        run: |
          sudo apt-get update
          sudo apt-get install -y libturbojpeg
 
      - name: Lint with ruff
        run: |
          ruff check custom_components/wiim --line-length 120
 
      - name: Lint with flake8
        run: |
          flake8 custom_components/wiim --max-line-length=120 --extend-ignore=E203,W503
 
      - name: Type check with mypy (strict)
        run: |
          mypy --strict custom_components/wiim
 
      - name: Test with pytest
        run: |
          pytest tests/ --cov=custom_components/wiim --cov-report=xml
 
      - name: Upload coverage reports to Codecov
        uses: codecov/codecov-action@v6
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
 

What changed

2 third-party actions are referenced by a movable tag. Pin them 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:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow