Skip to content

Commit 12f3632

Browse files
committed
script for CI automation
1 parent 36ffaa2 commit 12f3632

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

scripts/ci.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# This file is a CI script and aids in:
3+
# 1) Code lint checking
4+
# 2) Runs tests from tests/
5+
# 3) Runs tests in Verilog dataset
6+
#
7+
# Author: Abhishek Sriram <noobsiecoder@gmail.com>
8+
# Date: Aug 20th, 2025
9+
# Place: Boston, MA
10+
set -e
11+
12+
# Place: Boston, MA
13+
14+
# Step 1: Code lint checking with ruff
15+
echo "=== Running Code Linting ==="
16+
uv run ruff check .
17+
uv run ruff format --check .
18+
19+
# Step 2: Run tests
20+
echo "=== Running Python Script(s) Tests ==="
21+
uv run pytest -v tests/test_evals.py tests/test_models.py::test_api_connection_with_no_env_load
22+
23+
# Step 3: Run tests for ground truth with corresponding testbench
24+
echo "=== Running Verilog Tests ==="
25+
cd dataset/testbench/hdlbits
26+
find . -name "tb_*.v" | while read tb_path; do
27+
dir=$(dirname "$tb_path")
28+
tb_file=$(basename "$tb_path")
29+
base=${tb_file#tb_}
30+
base=${base%.v}
31+
answer_file="answer_${base}.v"
32+
answer_path="${dir}/${answer_file}"
33+
if [ -f "$answer_path" ]; then
34+
echo "Testing: ${dir}/${base}"
35+
cd "$dir"
36+
iverilog -o test_${base} ${tb_file} ${answer_file}
37+
vvp test_${base} || (echo "✗ Test failed: ${dir}/${base}" && exit 1)
38+
cd - > /dev/null
39+
else
40+
echo "⚠ Missing answer file: $answer_path"
41+
fi
42+
done
43+
echo "✓ All tests passed!"

0 commit comments

Comments
 (0)