-
Notifications
You must be signed in to change notification settings - Fork 271
117 lines (102 loc) · 4.16 KB
/
basic-ci.yml
File metadata and controls
117 lines (102 loc) · 4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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 is in a separate private repository.
# Frontend CI/CD is handled there. This repo only contains pre-built frontend assets.
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.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 Build Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Verify frontend dist exists
run: |
# Since frontend source is in a private repo, we only verify
# that the pre-built frontend assets are present and valid
echo "Checking frontend dist directory..."
if [ -d "frontend/dist" ] && [ "$(ls -A frontend/dist 2>/dev/null)" ]; then
echo "✓ frontend/dist/ exists and is not empty"
echo "Files found:"
find frontend/dist -type f | head -20
else
echo "⚠ frontend/dist/ is empty or missing"
echo "This is expected for initial setup. Run build-frontend.sh or wait for CI to populate it."
fi
- name: Verify Nginx config
run: |
echo "Checking Nginx configuration..."
if [ -f "frontend/nginx.conf" ]; then
echo "✓ frontend/nginx.conf exists"
else
echo "✗ frontend/nginx.conf is missing!"
exit 1
fi
- name: Verify Dockerfile
run: |
echo "Checking frontend Dockerfile..."
if [ -f "frontend/Dockerfile" ]; then
echo "✓ frontend/Dockerfile exists"
else
echo "✗ frontend/Dockerfile is missing!"
exit 1
fi