Skip to content

Commit

Permalink
[ci] cache verilator
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragon-Git committed Sep 28, 2024
1 parent 54f9efe commit 08910f7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Cache verilator
uses: actions/cache@v4
env:
cache-name: cache-verilator-new
with:
path: /home/runner/work/verilator
key: verilator-v5${{ env.cache-name }}

- name: Install verilator
run: |
sudo apt-get install -y --no-install-recommends help2man make g++ perl python3 autoconf flex bison libfl2 libfl-dev zlib1g zlib1g-dev
git clone https://github.com/verilator/verilator.git
cd verilator
git reset --hard v5.028
autoconf
./configure
make -j $(nproc)
sudo make install
cd ..
rm -rf verilator
export VERILATOR_ROOT="/home/runner/work/verilator" \
export PATH="$VERILATOR_ROOT/bin:$PATH" \
sudo bash ./script/install_verilator.sh
- name: Install verilator-uvm
run: |
Expand Down
25 changes: 25 additions & 0 deletions script/install_verilator.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#! /bin/bash

# VERILATOR_ROOT="$PWD/verilator"

# Clone repo only if it doesn't exist
if [ ! -d $VERILATOR_ROOT ]; then
cd $VERILATOR_ROOT/../
git clone https://github.com/verilator/verilator.git
fi

cd $VERILATOR_ROOT

# Returns non-zero if no .o files exist
find -name '*.o' | grep -q .

# If .o files don't exist, do autoconf and do make
if [ $? -ne 0 ]; then
git checkout v5.028
autoconf
./configure --prefix="$VERILATOR_ROOT"
make -j `nproc`
make install
else
echo "Verilator already built, skipping compile/install steps"
fi

0 comments on commit 08910f7

Please sign in to comment.