1
+ name : CI
2
+
3
+ on :
4
+ pull_request :
5
+ branches : [ main ]
6
+ push :
7
+ branches : [ main ]
8
+
9
+ env :
10
+ PYTHON_VERSION : " 3.11"
11
+
12
+ jobs :
13
+ # =============================================================================
14
+ # CODE QUALITY & BUILD VALIDATION
15
+ # =============================================================================
16
+ code-quality :
17
+ name : Code Quality & Build
18
+ runs-on : ubuntu-latest
19
+ steps :
20
+ - name : Checkout code
21
+ uses : actions/checkout@v4
22
+
23
+ - name : Set up Python
24
+ uses : actions/setup-python@v4
25
+ with :
26
+ python-version : ${{ env.PYTHON_VERSION }}
27
+
28
+ - name : Cache dependencies
29
+ uses : actions/cache@v3
30
+ with :
31
+ path : ~/.cache/pip
32
+ key : ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
33
+ restore-keys : ${{ runner.os }}-pip-
34
+
35
+ - name : Install dependencies
36
+ run : |
37
+ python -m pip install --upgrade pip
38
+ pip install ruff mypy tomli
39
+ pip install pandas web3 tenacity
40
+
41
+ - name : Run code formatting and linting
42
+ run : |
43
+ chmod +x scripts/ruff_check_format_assets.sh
44
+ ./scripts/ruff_check_format_assets.sh
45
+
46
+ - name : Check for uncommitted changes
47
+ run : |
48
+ if ! git diff --quiet; then
49
+ echo "Code formatting changes detected. Run ./scripts/ruff_check_format_assets.sh locally and commit changes."
50
+ git diff --name-only
51
+ exit 1
52
+ fi
53
+
54
+ - name : Run type checking
55
+ run : mypy src/ --ignore-missing-imports --no-strict-optional
56
+
57
+ - name : Validate Python syntax
58
+ run : find src/ -name "*.py" -exec python -m py_compile {} \;
59
+
60
+ - name : Test critical imports
61
+ run : |
62
+ cd src
63
+ python -c "
64
+ import sys; sys.path.insert(0, '..')
65
+ from src.utils.config_loader import load_config
66
+ from src.utils.key_validator import validate_and_format_private_key
67
+ print('Core modules import successfully')
68
+ "
69
+
70
+ - name : Validate configuration
71
+ run : |
72
+ python -c "
73
+ import tomli
74
+ with open('config.toml.example', 'rb') as f:
75
+ config = tomli.load(f)
76
+ required = ['bigquery', 'blockchain', 'scheduling', 'secrets']
77
+ for section in required:
78
+ if section not in config:
79
+ raise ValueError(f'Missing section: {section}')
80
+ print('Configuration valid')
81
+ "
82
+
83
+ # =============================================================================
84
+ # DOCKER BUILD VALIDATION
85
+ # =============================================================================
86
+ docker-build :
87
+ name : Docker Build
88
+ runs-on : ubuntu-latest
89
+ steps :
90
+ - name : Checkout code
91
+ uses : actions/checkout@v4
92
+
93
+ - name : Build and test Docker image
94
+ run : |
95
+ docker build -t service-quality-oracle:test .
96
+ docker create --name test-container service-quality-oracle:test
97
+ docker rm test-container
98
+
99
+ - name : Validate Docker Compose
100
+ run : docker-compose config
0 commit comments