ci workflow (litex-hub/litex-boards)
The ci workflow from litex-hub/litex-boards, explained and optimized by Latchkey.
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.
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
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
- 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.
- Add a job timeout so a hung step cannot burn hours of runner time.
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
- Network fetches
This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.