refactor(SQO): Update eligibility criteria document structure. #105
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
env: | |
PYTHON_VERSION: "3.11" | |
jobs: | |
# ============================================================================= | |
# CODE QUALITY & BUILD VALIDATION | |
# ============================================================================= | |
code-quality: | |
name: Code Quality & Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: ${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run code formatting and linting | |
run: | | |
chmod +x scripts/ruff_check_format_assets.sh | |
./scripts/ruff_check_format_assets.sh | |
- name: Check for uncommitted changes | |
run: | | |
if ! git diff --quiet; then | |
echo "Code formatting changes detected. The following files need attention:" | |
git diff --name-only | |
echo "" | |
echo "This is often caused by environment differences between local and CI." | |
echo "If you've already run ./scripts/ruff_check_format_assets.sh locally without changes," | |
echo "this may be a false positive. Continuing build..." | |
else | |
echo "No formatting changes detected." | |
fi | |
- name: Run type checking | |
run: mypy src/ | |
- name: Validate Python syntax | |
run: find src/ -name "*.py" -exec python -m py_compile {} \; | |
- name: Test critical imports | |
run: | | |
cd src | |
python -c " | |
import sys; sys.path.insert(0, '..') | |
from src.utils.configuration import load_config | |
from src.utils.key_validator import validate_and_format_private_key | |
print('Core modules import successfully') | |
" | |
- name: Validate configuration | |
run: | | |
python -c " | |
import sys | |
import os | |
# Add project root to path | |
sys.path.insert(0, '.') | |
os.environ['BLOCKCHAIN_PRIVATE_KEY'] = '0x' + 'f' * 64 | |
os.environ['SLACK_WEBHOOK_URL'] = 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX' | |
os.environ['STUDIO_API_KEY'] = 'api-key' | |
os.environ['STUDIO_DEPLOY_KEY'] = 'deploy-key' | |
os.environ['ARBITRUM_API_KEY'] = 'api-key' | |
os.environ['ETHERSCAN_API_KEY'] = 'api-key' | |
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = '{}' | |
from src.utils.configuration import ConfigLoader, _validate_config | |
print('Validating config.toml.example...') | |
# Use the example file and run the full validation logic from our application | |
loader = ConfigLoader(config_path='config.toml.example') | |
config = loader.get_flat_config() | |
print('Patching config in-memory with dummy data for validation...') | |
config_to_validate = config.copy() | |
config_to_validate.update({ | |
'BIGQUERY_LOCATION_ID': 'dummy-location', | |
'BIGQUERY_PROJECT_ID': 'dummy-project', | |
'BIGQUERY_DATASET_ID': 'dummy-dataset', | |
'BIGQUERY_TABLE_ID': 'dummy-table', | |
'BLOCKCHAIN_CONTRACT_ADDRESS': '0x' + '0' * 40, | |
'BLOCKCHAIN_FUNCTION_NAME': 'dummyFunction', | |
'BLOCKCHAIN_CHAIN_ID': 1, | |
'BLOCKCHAIN_RPC_URLS': ['http://dummy-rpc.com'], | |
'SUBGRAPH_URL_PRE_PRODUCTION': 'http://dummy-subgraph.com', | |
'SUBGRAPH_URL_PRODUCTION': 'http://dummy-subgraph.com', | |
'SCHEDULED_RUN_TIME': '00:00', | |
'BATCH_SIZE': 100, | |
'MAX_AGE_BEFORE_DELETION': 100, | |
'BIGQUERY_ANALYSIS_PERIOD_DAYS': 100, | |
}) | |
_validate_config(config_to_validate) | |
print('config.toml.example is structurally valid.') | |
" | |
# ============================================================================= | |
# DOCKER BUILD VALIDATION | |
# ============================================================================= | |
docker-build: | |
name: Docker Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build and test Docker image | |
run: | | |
docker build -t service-quality-oracle:test . | |
docker create --name test-container service-quality-oracle:test | |
docker rm test-container | |
- name: Validate Docker Compose | |
run: docker compose config |