Files
DinQuant/.github/workflows/basic-ci.yml
T
TIANHE 5b5ededb1d new
2026-01-06 04:00:41 +08:00

107 lines
3.6 KiB
YAML

name: Basic CI
# Basic CI workflow for syntax and lint checks.
# This workflow ensures the codebase has no syntax errors and passes linting.
# It does NOT run tests, start servers, or require external services.
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
pip install -r requirements.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.routes import health
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
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: |
# Project uses yarn (as specified in package.json packageManager field)
# Enable corepack to use the correct yarn version
corepack enable
yarn install --frozen-lockfile
# Use --frozen-lockfile to ensure reproducible builds and fail if lockfile is out of sync
- 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