Skip to content

v3.0.22

v3.0.22 #294

Workflow file for this run

name: Basic CI
# Basic CI workflow for backend syntax and lint checks.
# This workflow ensures the backend codebase has no syntax errors and passes linting.
# It does NOT run tests, start servers, or require external services.
#
# Note: Frontend source code and CI live in the private QuantDinger-Vue repo.
# The published `ghcr.io/<owner>/quantdinger-frontend` image is consumed
# directly by both docker-compose files — no frontend source or build
# artefacts are checked in here.
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
python-check:
name: Python Syntax Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
# Use Python 3.12 to match Dockerfile and support f-string expressions with backslashes (PEP 701)
- name: Install dependencies
working-directory: ./backend_api_python
run: |
python -m pip install --upgrade pip
# Install dependencies, excluding Windows-only packages (MetaTrader5)
# MetaTrader5 is Windows-only and not available on Linux, so we filter it out
grep -v "MetaTrader5" requirements.txt > /tmp/requirements_ci.txt
pip install -r /tmp/requirements_ci.txt
# Install dependencies to verify they are installable and enable import checks.
- name: Python syntax check
working-directory: ./backend_api_python
run: |
# Check Python syntax for all .py files using compileall
# This catches syntax errors, indentation issues, and basic structural problems
echo "Checking Python syntax..."
python -m py_compile run.py
python -m compileall -q app/ scripts/ || (echo "Python syntax check failed" && exit 1)
echo "✓ Python syntax check passed"
- name: Python import check
working-directory: ./backend_api_python
run: |
# Verify critical modules can be imported
# We import but do NOT call create_app() to avoid triggering:
# - Database connections
# - Worker threads
# - Network services
python -c "
import sys
sys.path.insert(0, '.')
# Import key modules to verify they are loadable
from app import create_app
from app.config import settings
from app.openapi import init_openapi
print('✓ Core modules imported successfully')
print('✓ No critical import errors detected')
"
# This will FAIL if:
# - Critical imports fail (missing dependencies, broken module structure)
# This will PASS if:
# - Dependencies are available and importable
# - Core module structure is intact
compose-check:
name: Docker Compose Validation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate docker-compose.yml (build mode)
run: docker compose -f docker-compose.yml config -q
- name: Validate docker-compose.ghcr.yml (GHCR mode)
run: docker compose -f docker-compose.ghcr.yml config -q
- name: Validate docker-compose.yml + build override (merged)
run: docker compose -f docker-compose.yml -f docker-compose.build.yml config -q
version-check:
name: Version Consistency
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Verify VERSION matches all declarations
# Fails if any *tracked* version constant drifts from repo-root VERSION.
# Frontend paths under QuantDinger-Vue-src/ are gitignored (private FE
# repo) and are skipped when absent. Run bump_version.py locally with
# the full FE checkout to sync those files before building the image.
run: python scripts/check_version.py