-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (108 loc) · 3.46 KB
/
ci.yml
File metadata and controls
130 lines (108 loc) · 3.46 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
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI - Test Frontend and Backend
on:
push:
branches: [ main, dev, develop ]
pull_request:
branches: [ main, dev, develop ]
workflow_dispatch:
jobs:
backend-tests:
name: Backend Tests (Python)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('backend/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
working-directory: ./backend
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
working-directory: ./backend
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
- name: Check code formatting with black
working-directory: ./backend
run: |
black --check .
- name: Run tests with pytest
working-directory: ./backend
env:
GEMINI_API_KEY: "dummy-key-for-tests"
run: |
PYTHONPATH=. pytest --cov=. --cov-report=term-missing --cov-report=xml --verbose
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./backend/coverage.xml
flags: backend
name: backend-coverage
fail_ci_if_error: false
frontend-tests:
name: Frontend Tests (Node.js)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
working-directory: ./frontend
run: npm ci
- name: Run tests with coverage
working-directory: ./frontend
run: npm run test:coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./frontend/coverage/coverage-final.json
flags: frontend
name: frontend-coverage
fail_ci_if_error: false
# Optional: Build verification job
build-verification:
name: Build Verification
runs-on: ubuntu-latest
needs: [backend-tests, frontend-tests]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install frontend dependencies
working-directory: ./frontend
run: npm ci
- name: Build frontend
working-directory: ./frontend
run: npm run build
- name: Verify frontend build artifacts
working-directory: ./frontend
run: |
if [ ! -d "dist" ]; then
echo "Frontend build failed - no dist directory found"
exit 1
fi
echo "Frontend build successful - dist directory exists"
ls -la dist/