Ecosystem compatibility tests workflow (cocotb/cocotb)
The Ecosystem compatibility tests workflow from cocotb/cocotb, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get caching, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Ecosystem compatibility tests workflow from the cocotb/cocotb repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
# Copyright cocotb contributors
# Licensed under the Revised BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-3-Clause
# Tests to ensure that projects depending on cocotb continue to work with the
# latest development version of cocotb.
#
# Generally, we test the development version of cocotb against supported,
# released versions of the other projects. (It is expected that the projects
# themselves test their in-development code against the released version of
# cocotb.)
name: Ecosystem compatibility tests
on:
# Run daily at midnight (UTC).
schedule:
- cron: '0 0 * * *'
# Allow triggering a CI run from the web UI.
workflow_dispatch:
jobs:
cocotb-coverage:
if: github.repository == 'cocotb/cocotb'
name: Test cocotb-coverage
runs-on: ubuntu-24.04
strategy:
matrix:
cocotb-coverage-version: [ "2.0" ]
steps:
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.11"
- name: Install Icarus Verilog
run: sudo apt-get install -y --no-install-recommends iverilog
- name: Checkout cocotb-coverage repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: mciepluc/cocotb-coverage
path: cocotb-coverage
ref: v${{ matrix.cocotb-coverage-version }}
- name: Install the release version of cocotb-coverage
run: pip install ./cocotb-coverage
- name: Install the development version of cocotb
run: pip install git+https://github.com/cocotb/cocotb.git
- name: Run tests
if: ${{ matrix.cocotb-coverage-version }} == '2.0'
env:
SIM: icarus
TOPLEVEL_LANG: verilog
run: |
pip install pytest cocotb-bus numpy
cd cocotb-coverage
make -k -C tests
make -C examples/fifo/tests
make -C examples/pkt_switch/tests
pyuvm:
if: github.repository == 'cocotb/cocotb'
name: Test pyuvm
runs-on: ubuntu-24.04
strategy:
matrix:
pyuvm-version: [ "4.0.1" ]
steps:
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.11"
- name: Install Icarus Verilog
run: sudo apt-get install -y --no-install-recommends iverilog
- name: Install NVC
uses: nickg/setup-nvc@v1
with:
version: r1.19.3
- name: Checkout pyuvm repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: pyuvm/pyuvm
path: pyuvm
ref: ${{ matrix.pyuvm-version }}
- name: Install pyuvm
run: pip install ./pyuvm
- name: Install the development version of cocotb
run: pip install git+https://github.com/cocotb/cocotb.git
- name: Run tests
if: ${{ matrix.pyuvm-version }} == '4.0.1'
working-directory: pyuvm
env:
VERILOG_SIM: icarus
VHDL_SIM: nvc
run: |
pip install pytest
pytest
make cocotb_tests
forastero:
if: github.repository == 'cocotb/cocotb'
name: Test Forastero
runs-on: ubuntu-24.04
strategy:
matrix:
forastero-version: [ "1.2.1" ]
steps:
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.13"
- name: Install Icarus Verilog
run: sudo apt-get install -y --no-install-recommends iverilog
- name: Checkout Forastero repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: intuity/forastero
path: forastero
ref: ${{ matrix.forastero-version }}
- name: Install the release version of Forastero
run: pip install ./forastero
- name: Install the development version of cocotb
run: pip install git+https://github.com/cocotb/cocotb.git
- name: Run tests
working-directory: forastero
env:
SIM: icarus
TOPLEVEL_LANG: verilog
run: |
make -C examples/arbiter_strict
make -C examples/arbiter_window
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.
# Copyright cocotb contributors # Licensed under the Revised BSD License, see LICENSE for details. # SPDX-License-Identifier: BSD-3-Clause # Tests to ensure that projects depending on cocotb continue to work with the # latest development version of cocotb. # # Generally, we test the development version of cocotb against supported, # released versions of the other projects. (It is expected that the projects # themselves test their in-development code against the released version of # cocotb.) name: Ecosystem compatibility tests on: # Run daily at midnight (UTC). schedule: - cron: '0 0 * * *' # Allow triggering a CI run from the web UI. workflow_dispatch: jobs: cocotb-coverage: timeout-minutes: 30 if: github.repository == 'cocotb/cocotb' name: Test cocotb-coverage runs-on: latchkey-small strategy: matrix: cocotb-coverage-version: [ "2.0" ] steps: - name: Set up Python uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: cache: 'pip' python-version: "3.11" - name: Install Icarus Verilog run: sudo apt-get install -y --no-install-recommends iverilog - name: Checkout cocotb-coverage repository uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: repository: mciepluc/cocotb-coverage path: cocotb-coverage ref: v${{ matrix.cocotb-coverage-version }} - name: Install the release version of cocotb-coverage run: pip install ./cocotb-coverage - name: Install the development version of cocotb run: pip install git+https://github.com/cocotb/cocotb.git - name: Run tests if: ${{ matrix.cocotb-coverage-version }} == '2.0' env: SIM: icarus TOPLEVEL_LANG: verilog run: | pip install pytest cocotb-bus numpy cd cocotb-coverage make -k -C tests make -C examples/fifo/tests make -C examples/pkt_switch/tests pyuvm: timeout-minutes: 30 if: github.repository == 'cocotb/cocotb' name: Test pyuvm runs-on: latchkey-small strategy: matrix: pyuvm-version: [ "4.0.1" ] steps: - name: Set up Python uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: cache: 'pip' python-version: "3.11" - name: Install Icarus Verilog run: sudo apt-get install -y --no-install-recommends iverilog - name: Install NVC uses: nickg/setup-nvc@v1 with: version: r1.19.3 - name: Checkout pyuvm repository uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: repository: pyuvm/pyuvm path: pyuvm ref: ${{ matrix.pyuvm-version }} - name: Install pyuvm run: pip install ./pyuvm - name: Install the development version of cocotb run: pip install git+https://github.com/cocotb/cocotb.git - name: Run tests if: ${{ matrix.pyuvm-version }} == '4.0.1' working-directory: pyuvm env: VERILOG_SIM: icarus VHDL_SIM: nvc run: | pip install pytest pytest make cocotb_tests forastero: timeout-minutes: 30 if: github.repository == 'cocotb/cocotb' name: Test Forastero runs-on: latchkey-small strategy: matrix: forastero-version: [ "1.2.1" ] steps: - name: Set up Python uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 with: cache: 'pip' python-version: "3.13" - name: Install Icarus Verilog run: sudo apt-get install -y --no-install-recommends iverilog - name: Checkout Forastero repository uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: repository: intuity/forastero path: forastero ref: ${{ matrix.forastero-version }} - name: Install the release version of Forastero run: pip install ./forastero - name: Install the development version of cocotb run: pip install git+https://github.com/cocotb/cocotb.git - name: Run tests working-directory: forastero env: SIM: icarus TOPLEVEL_LANG: verilog run: | make -C examples/arbiter_strict make -C examples/arbiter_window
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. - 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 per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.