-
-
Notifications
You must be signed in to change notification settings - Fork 1
161 lines (137 loc) · 6.48 KB
/
benchmark-tests.yml
File metadata and controls
161 lines (137 loc) · 6.48 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
154
155
156
157
158
159
160
161
# VIBEE BitNet Benchmark Tests CI
# φ² + 1/φ² = 3 | PHOENIX = 999
name: Benchmark Tests
on:
push:
branches: [main]
paths:
- 'trinity/output/fpga/driver/python/**'
- 'specs/tri/benchmark*.vibee'
- '.github/workflows/benchmark-tests.yml'
pull_request:
branches: [main]
paths:
- 'trinity/output/fpga/driver/python/**'
- 'specs/tri/benchmark*.vibee'
jobs:
# ═══════════════════════════════════════════════════════════════════════════
# Python Unit Tests
# ═══════════════════════════════════════════════════════════════════════════
test-python:
name: Python Tests (py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
defaults:
run:
working-directory: trinity/output/fpga/driver/python
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: trinity/output/fpga/driver/python/requirements-test.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-test.txt
- name: Run syntax check
run: |
python -m py_compile bitnet/benchmark/*.py
python -m py_compile tests/*.py
echo "✅ Syntax check passed"
- name: Run tests
run: |
python -m pytest tests/ -v \
--tb=short \
--junitxml=test-results/junit.xml \
--cov=bitnet/benchmark \
--cov-report=xml:coverage.xml \
--cov-report=html:htmlcov \
--cov-report=term-missing
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-py${{ matrix.python-version }}
path: trinity/output/fpga/driver/python/test-results/
retention-days: 7
- name: Upload coverage
uses: actions/upload-artifact@v4
if: matrix.python-version == '3.11'
with:
name: coverage-report
path: trinity/output/fpga/driver/python/htmlcov/
retention-days: 7
# ═══════════════════════════════════════════════════════════════════════════
# Lint Check
# ═══════════════════════════════════════════════════════════════════════════
lint:
name: Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: trinity/output/fpga/driver/python
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install linters
run: pip install flake8
- name: Run flake8
run: |
flake8 bitnet/ tests/ \
--max-line-length=100 \
--ignore=E501,W503,E203 \
--exclude=__pycache__ \
|| echo "⚠️ Lint warnings found"
# ═══════════════════════════════════════════════════════════════════════════
# Validate Specs
# ═══════════════════════════════════════════════════════════════════════════
validate-specs:
name: Validate .vibee Specs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate benchmark specs
run: |
echo "Validating benchmark .vibee files..."
for file in specs/tri/benchmark*.vibee; do
if [ -f "$file" ]; then
python3 -c "import yaml; yaml.safe_load(open('$file'))" && \
echo "✅ $file" || echo "❌ $file"
fi
done
# ═══════════════════════════════════════════════════════════════════════════
# Summary
# ═══════════════════════════════════════════════════════════════════════════
summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [test-python, lint, validate-specs]
if: always()
steps:
- name: Check results
run: |
echo "╔══════════════════════════════════════════════════════════════╗"
echo "║ VIBEE Benchmark Tests Summary ║"
echo "╠══════════════════════════════════════════════════════════════╣"
echo "║ Python Tests: ${{ needs.test-python.result }}"
echo "║ Lint: ${{ needs.lint.result }}"
echo "║ Specs: ${{ needs.validate-specs.result }}"
echo "╚══════════════════════════════════════════════════════════════╝"
if [ "${{ needs.test-python.result }}" != "success" ]; then
echo "❌ Python tests failed"
exit 1
fi
echo "✅ All checks passed"