Skip to content
Latchkey

ci workflow (litex-hub/litex-boards)

The ci workflow from litex-hub/litex-boards, explained and optimized by Latchkey.

C

CI health: C - fair

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

Grade your own workflow free or run it on Latchkey →
Source: litex-hub/litex-boards.github/workflows/ci.ymlLicense BSD-2-ClauseView source

What it does

This is the ci workflow from the litex-hub/litex-boards repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-2-Clause license.

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

The workflow

workflow (.yml)
name: ci

on: [push, pull_request]

jobs:
  lint:
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v7

      - name: Set up Python 3.9
        uses: actions/setup-python@v6
        with:
          python-version: "3.9"
          cache: "pip"
          cache-dependency-path: "setup.py"

      - name: Install Python dependencies
        run: |
          python3 -m pip install setuptools pytest

      - name: Check README Board List
        run: python3 .github/scripts/sync_readme_boards_list.py --check

      - name: Check Target Parser Style
        run: python3 .github/scripts/check_target_parser_style.py

      - name: Check Target Parser Alignment
        run: python3 .github/scripts/check_target_parser_alignment.py

      - name: Check Board Inventory
        run: python3 .github/scripts/generate_board_inventory.py --check

      - name: Check Board Consistency
        run: python3 .github/scripts/audit_board_consistency.py --check

      - name: Run Fast Lint Tests
        run: python3 -m pytest -q test/test_parser_style.py test/test_parser_alignment.py test/test_targets_parser_api.py test/test_board_guardrails.py

  build:
    needs: lint
    runs-on: ubuntu-22.04
    steps:
      # Checkout Repository
      - name: Checkout
        uses: actions/checkout@v7

      # Install Tools
      - name: Install Tools
        run: |
          sudo apt-get install wget build-essential

      - name: Set up Python 3.9
        uses: actions/setup-python@v6
        with:
          python-version: "3.9"
          cache: "pip"
          cache-dependency-path: "setup.py"

      - name: Install Python dependencies
        run: |
          python3 -m pip install setuptools requests pexpect meson pytest

      # Install (n)Migen / LiteX / Cores
      - name: Install LiteX
        run: |
          wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py
          python3 litex_setup.py --clone-depth=1 init install --user

      # Install Project
      - name: Install Project
        run: python3 setup.py develop --user

      # Validate README board list is in sync with targets.
      - name: Check README Board List
        run: python3 .github/scripts/sync_readme_boards_list.py --check

      # Validate parser style in targets.
      - name: Check Target Parser Style
        run: python3 .github/scripts/check_target_parser_style.py

      # Validate parser argument alignment in targets.
      - name: Check Target Parser Alignment
        run: python3 .github/scripts/check_target_parser_alignment.py

      # Validate generated board inventory and consistency baseline.
      - name: Check Board Guardrails
        run: |
          python3 .github/scripts/generate_board_inventory.py --check
          python3 .github/scripts/audit_board_consistency.py --check
          python3 .github/scripts/check_stale_board_exclusions.py --check

      # Test
      - name: Run Tests
        run: python3 -m pytest -v

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: ci
 
on: [push, pull_request]
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  lint:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - name: Checkout
        uses: actions/checkout@v7
 
      - name: Set up Python 3.9
        uses: actions/setup-python@v6
        with:
          python-version: "3.9"
          cache: "pip"
          cache-dependency-path: "setup.py"
 
      - name: Install Python dependencies
        run: |
          python3 -m pip install setuptools pytest
 
      - name: Check README Board List
        run: python3 .github/scripts/sync_readme_boards_list.py --check
 
      - name: Check Target Parser Style
        run: python3 .github/scripts/check_target_parser_style.py
 
      - name: Check Target Parser Alignment
        run: python3 .github/scripts/check_target_parser_alignment.py
 
      - name: Check Board Inventory
        run: python3 .github/scripts/generate_board_inventory.py --check
 
      - name: Check Board Consistency
        run: python3 .github/scripts/audit_board_consistency.py --check
 
      - name: Run Fast Lint Tests
        run: python3 -m pytest -q test/test_parser_style.py test/test_parser_alignment.py test/test_targets_parser_api.py test/test_board_guardrails.py
 
  build:
    timeout-minutes: 30
    needs: lint
    runs-on: latchkey-small
    steps:
      # Checkout Repository
      - name: Checkout
        uses: actions/checkout@v7
 
      # Install Tools
      - name: Install Tools
        run: |
          sudo apt-get install wget build-essential
 
      - name: Set up Python 3.9
        uses: actions/setup-python@v6
        with:
          python-version: "3.9"
          cache: "pip"
          cache-dependency-path: "setup.py"
 
      - name: Install Python dependencies
        run: |
          python3 -m pip install setuptools requests pexpect meson pytest
 
      # Install (n)Migen / LiteX / Cores
      - name: Install LiteX
        run: |
          wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py
          python3 litex_setup.py --clone-depth=1 init install --user
 
      # Install Project
      - name: Install Project
        run: python3 setup.py develop --user
 
      # Validate README board list is in sync with targets.
      - name: Check README Board List
        run: python3 .github/scripts/sync_readme_boards_list.py --check
 
      # Validate parser style in targets.
      - name: Check Target Parser Style
        run: python3 .github/scripts/check_target_parser_style.py
 
      # Validate parser argument alignment in targets.
      - name: Check Target Parser Alignment
        run: python3 .github/scripts/check_target_parser_alignment.py
 
      # Validate generated board inventory and consistency baseline.
      - name: Check Board Guardrails
        run: |
          python3 .github/scripts/generate_board_inventory.py --check
          python3 .github/scripts/audit_board_consistency.py --check
          python3 .github/scripts/check_stale_board_exclusions.py --check
 
      # Test
      - name: Run Tests
        run: python3 -m pytest -v
 

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 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow