Skip to content

Commit 25f462f

Browse files
author
Marcos
committed
ci: build Verilator 5.040 from source (apt ships 5.020, cocotb 2.x needs 5.036+)
The first CI run failed with: cocotb requires Verilator 5.036 or later, but using 5.020. Ubuntu 24.04 ships Verilator 5.020 in apt. Build 5.040 from source on cache miss; subsequent CI runs hit the cache and reuse the install in seconds. This is exactly the kind of environment drift CI exists to catch — the local dev box has Verilator 5.048 (Manjaro), so tests passed locally but the CI environment was different. Fixed once, cached forever (until we bump the version). Signed-off-by: Marcos <m@pop.coop>
1 parent 78e3ce4 commit 25f462f

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,36 @@ jobs:
1616
- name: Checkout
1717
uses: actions/checkout@v4
1818

19-
- name: Install Verilator
19+
- name: Install Verilator build deps
2020
run: |
2121
sudo apt-get update
22-
sudo apt-get install -y verilator
23-
verilator --version
22+
sudo apt-get install -y \
23+
git make autoconf flex bison \
24+
libfl2 libfl-dev zlib1g zlib1g-dev \
25+
help2man perl ccache
26+
27+
- name: Cache Verilator install
28+
id: verilator-cache
29+
uses: actions/cache@v4
30+
with:
31+
path: ~/.local/verilator
32+
key: verilator-v5.040-${{ runner.os }}-x64
33+
34+
- name: Build Verilator 5.040 from source (only on cache miss)
35+
if: steps.verilator-cache.outputs.cache-hit != 'true'
36+
run: |
37+
git clone --branch v5.040 --depth 1 \
38+
https://github.com/verilator/verilator.git /tmp/verilator
39+
cd /tmp/verilator
40+
autoconf
41+
./configure --prefix=$HOME/.local/verilator
42+
make -j$(nproc)
43+
make install
44+
45+
- name: Add Verilator to PATH and verify
46+
run: |
47+
echo "$HOME/.local/verilator/bin" >> $GITHUB_PATH
48+
$HOME/.local/verilator/bin/verilator --version
2449
2550
- name: Set up Python 3.12
2651
uses: actions/setup-python@v5

0 commit comments

Comments
 (0)