77 lines (71 loc) · 2.27 KB
/
build-verilator.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Verilator Build
on:
workflow_call:
jobs:
verilator:
name: Build Verilator
runs-on: ubuntu-latest
strategy:
matrix:
include:
- version: v5.010
repo: verilator/verilator
commit: v5.010
- version: uvm
repo: verilator/verilator
commit: 7ca2d6470a
env:
TOOL_NAME: verilator
TOOL_VERSION: ${{ matrix.version }}
TOOL_REPO: ${{ matrix.repo }}
TOOL_COMMIT: ${{ matrix.commit }}
DEBIAN_FRONTEND: "noninteractive"
steps:
- name: Setup Cache Metadata
id: cache_metadata
run: |
cache_date=$(date +"%Y_%m_%d")
cache_name=cache_${{ env.TOOL_NAME }}_${{ env.TOOL_VERSION }}_${{ env.TOOL_COMMIT }}
echo "Cache date: "$cache_date
echo "Cache name: "$cache_name
echo "cache_date=$cache_date" >> "$GITHUB_ENV"
echo "cache_name=$cache_name" >> "$GITHUB_ENV"
- name: Setup cache
uses: actions/cache@v3
id: cache
timeout-minutes: 60
with:
path: |
/opt/verilator
/opt/verilator/.cache
key: ${{ env.cache_name }}_${{ env.cache_date }}
restore-keys: ${{ env.cache_name }}_
- name: Install prerequisities
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
sudo apt -qqy update && sudo apt -qqy --no-install-recommends install \
autoconf automake autotools-dev \
bc bison build-essential \
ccache curl \
flex \
gawk git gperf \
help2man \
libexpat-dev libfl-dev libfl2 libgmp-dev \
libmpc-dev libmpfr-dev libtool \
ninja-build \
patchutils python3 python3-pip \
texinfo \
zlib1g zlib1g-dev
- name: Build Verilator
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
export CCACHE_DIR=/opt/verilator/.cache
ccache --show-config | grep cache_dir
git clone https://github.com/${{ env.TOOL_REPO }} verilator
pushd verilator
git checkout ${{ env.TOOL_COMMIT }}
autoconf
./configure --prefix=/opt/verilator
make -j `nproc`
make install
popd