Add cocotb regression and Verilator ELA coverage runner #75
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| # Cancel in-progress runs on the same branch when a new push lands. | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ── 0. Version sync guard ────────────────────────────────────────── | |
| # Catches the "I bumped VERSION but forgot to regenerate | |
| # rtl/fcapz_version.vh" foot-gun before any other job wastes minutes. | |
| version-sync: | |
| name: VERSION ↔ rtl/fcapz_version.vh in sync | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Verify fcapz_version.vh is regenerated from VERSION | |
| run: python tools/sync_version.py --check | |
| # ── 1. Python lint ──────────────────────────────────────────────── | |
| lint-python: | |
| name: Python lint (ruff) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install ruff | |
| run: pip install "ruff>=0.4.0,<0.13" | |
| - name: ruff check (whole repo) | |
| run: ruff check . | |
| # ── 2. Package install + import smoke test ──────────────────────── | |
| install-smoke: | |
| name: pip install -e . + import fcapz | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Editable install | |
| run: pip install -e ".[dev]" | |
| - name: Verify top-level fcapz package resolves | |
| run: | | |
| python -c " | |
| import fcapz | |
| from fcapz import ( | |
| Analyzer, CaptureConfig, TriggerConfig, ProbeSpec, SequencerStage, | |
| CaptureResult, Transport, OpenOcdTransport, XilinxHwServerTransport, | |
| VendorStubTransport, | |
| find_edges, find_rising_edges, find_falling_edges, find_bursts, | |
| frequency_estimate, summarize, ProbeDefinition, | |
| EioController, EjtagAxiController, AXIError, EjtagUartController, | |
| ) | |
| print('all top-level fcapz exports importable') | |
| " | |
| - name: Verify fcapz CLI entry point is on PATH | |
| run: | | |
| fcapz --help | head -5 | |
| # ── 3. Host unit tests (full suite, all tests/) ─────────────────── | |
| test-host: | |
| name: Host unit tests (pytest) | |
| runs-on: ubuntu-latest | |
| env: | |
| QT_QPA_PLATFORM: offscreen | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install system packages (iverilog + Qt runtime libs) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y iverilog libegl1 libgl1 | |
| - name: Install package (dev + GUI deps for mocked Qt tests) | |
| run: pip install -e ".[dev,gui]" | |
| - name: Run full unit test suite | |
| run: pytest tests/ -v --tb=short | |
| - name: Run JTAG readback pipeline regression tests | |
| run: | | |
| pytest \ | |
| tests/test_transport.py::XilinxHwServerConnectFailureTests::test_parse_block_bits_can_skip_priming_word \ | |
| tests/test_transport.py::XilinxHwServerConnectFailureTests::test_parse_burst_bits_can_skip_priming_scan \ | |
| tests/test_transport.py::XilinxHwServerConnectFailureTests::test_read_block_burst_primes_user2_before_returned_scans \ | |
| tests/test_transport.py::XilinxHwServerConnectFailureTests::test_user1_block_read_has_idle_before_each_capture \ | |
| tests/test_host_stack.py::AnalyzerTests::test_capture_reads_32_bit_timestamps_via_burst_block \ | |
| -v --tb=short | |
| # ── 4. RTL elaboration (iverilog -Wall) ────────────────────────── | |
| lint-rtl: | |
| name: RTL elaboration (iverilog -Wall) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install iverilog | |
| run: sudo apt-get install -y iverilog | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Run shared RTL lint regression | |
| run: python sim/run_sim.py --lint-only | |
| # -- 5. Full RTL driver lint (Verilator) -------------------------- | |
| lint-rtl-verilator: | |
| name: RTL driver lint (Verilator) | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Verilator | |
| run: sudo apt-get install -y verilator | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Run Verilator lint and MULTIDRIVEN self-test | |
| run: python sim/run_verilator_lint.py --self-test | |
| # -- 6. RTL simulation (cocotb + Icarus) -------------------------- | |
| # Sharded so the 16-target ELA suite runs in parallel with the protocol | |
| # benches; cuts wall-clock at the cost of one extra job slot. | |
| sim: | |
| name: RTL simulation (cocotb + Icarus) [${{ matrix.shard }}] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [protocol, ela] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install iverilog | |
| run: sudo apt-get install -y iverilog | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| cache-dependency-path: pyproject.toml | |
| - name: Install cocotb dependencies | |
| run: pip install -e ".[hdl]" | |
| - name: Run cocotb RTL regression (protocol shard) | |
| if: matrix.shard == 'protocol' | |
| run: python sim/run_cocotb.py --runner native --clean --skip-ela | |
| - name: Run cocotb RTL regression (ELA shard) | |
| if: matrix.shard == 'ela' | |
| run: python sim/run_cocotb.py --runner native --clean ela |