Skip to content

Commit f0f9ddd

Browse files
committed
feat(ci): Load json_infra json files into database
1 parent a26f1a4 commit f0f9ddd

File tree

6 files changed

+526
-2
lines changed

6 files changed

+526
-2
lines changed

.github/workflows/test.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,19 @@ jobs:
9393
with:
9494
python-version: "3.11"
9595
- uses: ./.github/actions/setup-env
96+
- name: Cache fixture database
97+
id: cache-fixtures-db
98+
uses: actions/cache@v4
99+
with:
100+
path: tests/json_infra/fixtures.db
101+
key: fixtures-db-${{ hashFiles('tests/json_infra/fixtures/**/*.json') }}
102+
- name: Build fixture database if cache miss
103+
if: steps.cache-fixtures-db.outputs.cache-hit != 'true'
104+
run: uv run python tests/json_infra/build_fixture_db.py
96105
- name: Run json infra tests
97106
run: tox -e json_infra
107+
env:
108+
EELS_USE_FIXTURE_DB: 1
98109
- name: Upload coverage reports to Codecov
99110
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7
100111
with:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,6 @@ logs/
8282
env.yaml
8383

8484
site/
85+
86+
# fixture db
87+
tests/json_infra/fixtures.db
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Build SQLite database from JSON test fixtures.
4+
5+
Usage:
6+
python -m tests.json_infra.build_fixture_db
7+
"""
8+
9+
import sys
10+
from pathlib import Path
11+
12+
from tests.json_infra.helpers.fixture_db import FixtureDatabase
13+
14+
# Add project root to path
15+
project_root = Path(__file__).parent.parent.parent
16+
sys.path.insert(0, str(project_root))
17+
18+
19+
def main():
20+
"""Build fixture DB."""
21+
db_path = "tests/json_infra/fixtures.db"
22+
db = FixtureDatabase(db_path)
23+
db.initialize_schema()
24+
db.load_all_state_tests()
25+
db.load_all_blockchain_tests()
26+
db.close()
27+
28+
29+
if __name__ == "__main__":
30+
main()

0 commit comments

Comments
 (0)