-
Notifications
You must be signed in to change notification settings - Fork 115
132 lines (111 loc) · 4.89 KB
/
Copy pathbuild-test-verilator.yml
File metadata and controls
132 lines (111 loc) · 4.89 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Verilator Hardware Model
on:
push:
branches: ["main"]
pull_request:
merge_group:
workflow_call:
workflow_dispatch:
jobs:
build_and_test:
name: Verilator Build and Test
runs-on: ubuntu-22.04
env:
CARGO_INCREMENTAL: 0
SCCACHE_VERSION: 0.10.0
VERILATOR_VERSION: v5.006
PKG_CONFIG_PATH: /opt/verilator/share/pkgconfig
SCCACHE_GHA_CACHE_TO: sccache-verilator-10000
SCCACHE_GHA_CACHE_FROM: sccache-verilator-
SCCACHE_GHA_ENABLED: "on"
# Change this to a new random value if you suspect the cache is corrupted
SCCACHE_C_CUSTOM_CACHE_BUSTER: 3962471045e8
# Compiler warnings should fail to compile
EXTRA_CARGO_CONFIG: "target.'cfg(all())'.rustflags = [\"-Dwarnings\"]"
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: 'true'
# - name: Restore sccache binary
# uses: actions/cache/restore@v3
# id: sccache_bin_restore
# with:
# path: ~/.cargo/bin/sccache
# key: sccache-bin-${{ env.SCCACHE_VERSION }}-${{ env.SCCACHE_C_CUSTOM_CACHE_BUSTER }}
# - name: Install sccache
# if: steps.sccache_bin_restore.outputs.cache-hit != 'true'
# run: |
# rustup install 1.85
# cargo +1.85 install sccache --version ${SCCACHE_VERSION} --no-default-features --features=gha --locked
# - name: Save sccache binary
# uses: actions/cache/save@v3
# if: steps.sccache_bin_restore.outputs.cache-hit != 'true'
# with:
# path: ~/.cargo/bin/sccache
# key: sccache-bin-${{ env.SCCACHE_VERSION }}-${{ env.SCCACHE_C_CUSTOM_CACHE_BUSTER }}
# - name: Configure sccache
# uses: actions/github-script@v6
# with:
# script: |
# core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
# core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
# core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on');
# - name: Restore verilator dir
# uses: actions/cache/restore@v3
# id: verilator_restore
# with:
# path: /opt/verilator
# key: verilator-${{ env.VERILATOR_VERSION }}-${{ env.SCCACHE_C_CUSTOM_CACHE_BUSTER }}
# - name: Install verilator
# if: steps.verilator_restore.outputs.cache-hit != 'true'
# run: |
# sudo apt-get update -qy && sudo apt-get install flex bison libfl2 libfl-dev help2man
# cd /tmp/
# git clone -b "${VERILATOR_VERSION}" https://github.com/verilator/verilator
# cd verilator
# autoconf
# ./configure --prefix=/opt/verilator CXX="sccache g++"
# make -j6
# sudo make install
# - name: Save verilator dir
# uses: actions/cache/save@v3
# if: steps.verilator_restore.outputs.cache-hit != 'true'
# with:
# path: /opt/verilator
# key: verilator-${{ env.VERILATOR_VERSION }}-${{ env.SCCACHE_C_CUSTOM_CACHE_BUSTER }}
# - name: Setup verilator path
# run: |
# echo /opt/verilator/bin >> $GITHUB_PATH
# - name: Update Cargo index
# run: |
# cargo tree --locked > /dev/null || (
# echo "Please include required changes to Cargo.lock in your pull request"
# exit 1
# )
# - name: Check that generated register code matches caliptra-rtl submodule
# run: |
# cargo run --locked -p caliptra_registers_generator -- --check hw/latest/rtl registers/bin/extra-rdl hw/latest/i3c-core-rtl hw/latest/registers/src
# - name: Check that generated X.509 templates match default templates
# run: |
# cargo test -p caliptra-x509 --features=generate_templates
# - name: Build
# run: |
# export RUSTC_WRAPPER=~/.cargo/bin/sccache
# export CXX="sccache g++"
# sccache --show-stats
# (cd hw-model && cargo build --locked --release --features verilator --jobs 10)
# # build all tests; need to make sure they still build with verilator
# # even if we don't have time to run them.
# cargo --config "$EXTRA_CARGO_CONFIG" test --no-run --locked --release --features=verilator
# sccache --show-stats
# - name: Run unit tests
# run: |
# export RUSTC_WRAPPER=~/.cargo/bin/sccache
# export CXX="sccache g++"
# (cd hw-model && cargo --config "$EXTRA_CARGO_CONFIG" test --locked --release --features verilator)
# (cd hw/verilated && cargo --config "$EXTRA_CARGO_CONFIG" test --locked --release --features verilator)
# - name: Check source-code formatting (run "cargo fmt" if this fails)
# run: |
# (cd hw-model && cargo fmt --check)