Signed-off-by: TIANHE <TIANHE@GMAIL.COM>
This commit is contained in:
TIANHE
2026-01-06 03:57:59 +08:00
parent 493d375f6e
commit 9b4f0c16ac
+55 -24
View File
@@ -1,7 +1,7 @@
name: Basic CI name: Basic CI
# Minimal CI workflow for basic sanity checks. # Basic CI workflow for syntax and lint checks.
# This workflow ensures the codebase is importable and has no critical syntax errors. # This workflow ensures the codebase has no syntax errors and passes linting.
# It does NOT run tests, start servers, or require external services. # It does NOT run tests, start servers, or require external services.
on: on:
@@ -11,39 +11,41 @@ on:
branches: [main, master] branches: [main, master]
jobs: jobs:
sanity-check: python-check:
name: Python Sanity Check name: Python Syntax Check
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
# Checkout step is required to access repository files.
- name: Set up Python 3.10 - name: Set up Python 3.12
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.10' python-version: '3.12'
# Use Python 3.10 as the minimum version per README.md requirements. # Use Python 3.12 to match Dockerfile and support f-string expressions with backslashes (PEP 701)
# This is the lowest reasonable version for this project.
- name: Install dependencies - name: Install dependencies
working-directory: ./backend_api_python working-directory: ./backend_api_python
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
# Install project dependencies to verify they are installable # Install dependencies to verify they are installable and enable import checks.
# and to enable import checks in the next step.
# Using pip install (not pip install --user) for simplicity.
- name: Python syntax and import check - name: Python syntax check
working-directory: ./backend_api_python working-directory: ./backend_api_python
run: | run: |
# Check Python syntax for all .py files (catches syntax errors early) # 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 py_compile run.py
python -m compileall -q app/ || (echo "Syntax check failed" && exit 1) python -m compileall -q app/ scripts/ || (echo "Python syntax check failed" && exit 1)
echo "✓ Python syntax check passed"
# Verify critical modules can be imported (validates import resolution)
- 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: # We import but do NOT call create_app() to avoid triggering:
# - Database connections # - Database connections
# - Worker threads # - Worker threads
@@ -58,15 +60,44 @@ jobs:
from app.routes import health from app.routes import health
print('✓ Core modules imported successfully') print('✓ Core modules imported successfully')
print('✓ No critical syntax or import errors detected') print('✓ No critical import errors detected')
" "
# This step will FAIL if: # This will FAIL if:
# - Python syntax errors exist (caught by py_compile/compileall)
# - Critical imports fail (missing dependencies, broken module structure) # - Critical imports fail (missing dependencies, broken module structure)
# This step will PASS if: # This will PASS if:
# - Code is syntactically valid
# - Dependencies are available and importable # - Dependencies are available and importable
# - Core module structure is intact # - Core module structure is intact
# Note: We do NOT call create_app() to avoid runtime dependencies.
# Runtime errors that require DB/external services are not checked here. frontend-check:
name: Frontend Syntax Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '16'
# Use Node.js 16 as per README.md requirements.
- name: Install dependencies
working-directory: ./quantdinger_vue
run: |
npm ci
# Use npm ci for faster, reliable, reproducible builds in CI.
- name: Frontend lint check
working-directory: ./quantdinger_vue
run: |
# Run ESLint to check JavaScript/Vue syntax and code quality
# Using --no-fix to ensure we only check, not modify code
npm run lint:nofix
# This will FAIL if:
# - JavaScript/Vue syntax errors exist
# - ESLint rules are violated
# This will PASS if:
# - Code is syntactically valid
# - Code passes ESLint rules