Repository navigation
108 lines (94 loc) · 2.68 KB
/
Copy pathci.yml
File metadata and controls
108 lines (94 loc) · 2.68 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
name: CI
on:
push:
branches: [main, develop]
paths:
- "backend/**"
- "frontend/**"
- ".github/workflows/ci.yml"
pull_request:
branches: [main]
paths:
- "backend/**"
- "frontend/**"
env:
PYTHON_VERSION: "3.12"
WORKING_DIR: backend
jobs:
frontend-ci:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- run: npm ci
- run: npm run lint
- run: npm run build
lint-and-test:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: none
defaults:
run:
working-directory: ${{ env.WORKING_DIR }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-lock.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
run: |
python -m pip install --upgrade pip
pip install -r requirements-lock.txt
pip install pytest pytest-asyncio ruff
- name: Lint with ruff
run: ruff check app/
# Compile check — verify all .py files parse
- name: Compile check
run: |
python -c "
import ast, os, sys
errors = []
for root, dirs, files in os.walk('app'):
for f in files:
if f.endswith('.py'):
path = os.path.join(root, f)
try:
ast.parse(open(path, encoding='utf-8').read())
except SyntaxError as e:
errors.append(f'{path}: {e}')
if errors:
for e in errors:
print(f'FAIL: {e}')
sys.exit(1)
print(f'All Python files compiled OK')
"
# Run unit tests (no server needed)
- name: Run unit tests
run: |
python -m pytest tests/ -v --tb=short --disable-warnings
# Check for common issues
- name: Check env template
run: |
if [ -f .env.example ]; then
echo ".env.example exists — good"
else
echo "WARNING: no .env.example found"
fi