-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (139 loc) · 4.83 KB
/
Copy pathtest.yml
File metadata and controls
153 lines (139 loc) · 4.83 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Protocols Tests
on:
push:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
env:
CARGO_TERM_COLOR: always
jobs:
tests:
name: Unit Tests
runs-on: ubuntu-24.04
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- name: Update Rust to ${{ matrix.toolchain }}
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-test-environment
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: cargo build --verbose
- name: Run unit tests (Debug)
run: cargo test --verbose
- name: Run Runt tests for interpreter
run: runt runt/interp
- name: Run Runt tests for graph-interpreter
run: runt runt/graph_interp
- name: Run Runt tests for bi
run: runt runt/bi
- name: Run Runt tests for waveform
run: runt runt/waveform
- name: Run Runt tests for fail
run: runt runt/fail
test-freshness:
name: Check Generated Runt Configs are Fresh
runs-on: ubuntu-24.04
strategy:
matrix:
toolchain:
- stable
steps:
- name: Update Rust to ${{ matrix.toolchain }}
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-test-environment
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: cargo build --verbose
# Regenerate the runt configs from the catalog to check freshness
- name: Check Runt configs are up to date
run: |
python3 scripts/generate_runt_configs.py
if [ -n "$(git status --porcelain -- runt)" ]; then
echo "::error::runt configs are out of date. Run 'python3 scripts/generate_runt_configs.py' and commit the result."
git --no-pager diff -- runt
exit 1
fi
msrv:
name: Check Minimum Rust Version for protocols library
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: taiki-e/cache-cargo-install-action@v2
with:
tool: cargo-msrv
- name: Check MSRV
working-directory: protocols
run: cargo msrv verify
format:
name: Check Formatting
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- run: cargo fmt --check
clippy:
name: Clippy Lints
runs-on: ubuntu-24.04
timeout-minutes: 10
env:
# Pin Rust version to prevent new Clippy lints from breaking CI
RUST_VERSION: "1.95.0"
steps:
- uses: actions/checkout@v4
- name: Install Rust ${{ env.RUST_VERSION }}
run: |
rustup toolchain install ${{ env.RUST_VERSION }} --component clippy
rustup default ${{ env.RUST_VERSION }}
- name: Run Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
python-checks:
name: Type-check, lint & format Python files
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-uv
- name: Use ty to typecheck python files
run: uv run --group dev ty check
- name: Use ruff to lint Python files
run: uv run --group dev ruff check
- name: Use ruff (via uv) to format Python files
# We pass in `--preview-features format` to suppress
# uv's warning messages about the formatter being experimental
run: uv format --check --preview-features format
verilog:
name: Verilog Backend Tests
runs-on: ubuntu-24.04
timeout-minutes: 3
strategy:
matrix:
toolchain:
- stable
steps:
- name: Update Rust to ${{ matrix.toolchain }}
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-test-environment
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Icarus Verilog Version
# we intentionally ignore the fact that `iverilog -v` returns a non-zero exit code
run: iverilog -v || which iverilog
- name: Build
run: cargo build --bin protocols-cli
- name: Run Verilog Testbench for AES128
run: cargo run --bin protocols-cli -- -p=examples/tinyaes128/aes128.prot run-verilog --transactions=examples/tinyaes128/aes128.tx --verilog=examples/tinyaes128/aes_128.v --clock=clk run_dir/tinyaes128
- name: Rerun testbench manually to catch a bad exit code
run: iverilog -g2012 run_dir/tinyaes128/tb.v examples/tinyaes128/aes_128.v && ./a.out
- uses: actions/upload-artifact@v4
with:
name: tinyaes128.vcd
path: run_dir/tinyaes128/dump.vcd